/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --bg:           #070711;
  --card:         #0D0D1F;
  --card-hover:   #11112A;
  --border:       #1A1A2E;
  --border-light: #252540;
  --purple:       #8B5CF6;
  --purple-l:     #A78BFA;
  --purple-d:     #6D28D9;
  --purple-glow:  rgba(139,92,246,0.12);
  --txt:          #F1F1F8;
  --txt-2:        #9494B0;
  --txt-m:        #5A5A7A;
  --green:        #10B981;
  --yellow:       #F59E0B;
  --red:          #EF4444;
  --blue:         #3B82F6;
  --red-dim:      rgba(239,68,68,.14);
  --yellow-dim:   rgba(245,158,11,.14);
  --green-dim:    rgba(16,185,129,.14);
  --blue-dim:     rgba(59,130,246,.14);
  --sidebar-w:    256px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple-d); }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

#main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

#page-content {
  flex: 1;
}

.page { padding: 2rem 2.5rem; max-width: 1280px; animation: fadeUp .3s ease; }
.page-ai { padding: 2rem 2.5rem; height: 100vh; display: flex; flex-direction: column; }

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

/* An UPDATE, not an arrival — see transitions.js. Pressing a filter or turning
   a page repainted #page-content, which replayed the whole arrival: the screen
   dropping 12px and fading from zero, while the reader was mid-sentence. The
   class is set by Transitions.update before the paint, so the incoming node is
   created with no animation rather than having one cancelled a frame later.

   Only .page is quieted. A chat message that appears during an update really
   is arriving, and should still say so. */
#page-content.tx-quiet .page { animation: none; }

/* Readers who have asked their system for less movement get none of it. What
   is disabled is travel and decoration — things that arrive, pulse or shimmer
   for effect. The spinner keeps turning, because a still spinner is not calm,
   it is a hang. */
@media (prefers-reduced-motion: reduce) {
  .page, .chat-msg, .auth-modal, .quiz-card, .settings-panel { animation: none !important; }
  .typing-dot, .recite-mic-btn.listening, .qword-active,
  .quran-mic-header-btn.active, .session-mic-dot.listening { animation: none !important; }
  * { scroll-behavior: auto !important; }
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 16px;
}
.logo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8B5CF6, #6D28D9);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.logo-text { font-size: 15px; font-weight: 700; color: var(--txt); }
.logo-sub  { font-size: 11px; color: var(--txt-m); margin-top: 1px; }

.child-mode-banner {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 12px 10px;
  padding: 8px 12px;
  background: var(--accent-soft, rgba(124,77,255,.12));
  border: 1px solid var(--accent, #7c4dff);
  border-radius: var(--radius-sm);
  font-size: 12px; color: var(--txt);
}
.child-mode-banner button {
  font-size: 11px; font-weight: 600; color: var(--accent, #7c4dff);
  padding: 3px 8px; border-radius: 4px; border: 1px solid var(--accent, #7c4dff);
  background: transparent; cursor: pointer;
}
.child-mode-banner button:hover { background: var(--accent, #7c4dff); color: #fff; }

.role-toggle {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin: 0 12px 12px;
}
.role-btn {
  flex: 1; padding: 6px; font-size: 12px; font-weight: 500;
  border-radius: 6px; transition: all .2s; color: var(--txt-m);
}
.role-btn.active { background: var(--purple); color: #fff; }

.sidebar-nav { flex: 1; padding: 4px 10px; overflow-y: auto; min-height: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--txt-2);
  transition: all .15s; margin-bottom: 2px;
  border-left: 2px solid transparent;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--txt); }
.nav-item.active {
  background: var(--purple-glow);
  color: var(--purple-l);
  border-left-color: var(--purple);
}
.nav-icon { font-size: 15px; width: 20px; text-align: center; }
.nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--purple); margin-left: auto;
}

.sidebar-bottom {
  flex-shrink: 0;
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.lang-toggle {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding: 0 4px;
}
.lang-label { font-size: 11px; color: var(--txt-m); }
.lang-btns { display: flex; background: var(--bg); border-radius: 6px; padding: 2px; }
.lang-btn {
  padding: 3px 10px; font-size: 11px; border-radius: 4px; transition: all .15s;
  color: var(--txt-m);
}
.lang-btn.active { background: var(--border-light); color: var(--txt); }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 4px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #8B5CF6, #4C1D95);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 600; color: var(--txt); }
.user-sub  { font-size: 11px; color: var(--txt-m); }

/* ── Typography ─────────────────────────────────────────────────────────────── */
.page-title  { font-size: 28px; font-weight: 800; color: var(--txt); margin-bottom: 4px; }
.page-sub    { font-size: 13px; color: var(--txt-2); }
.page-header { margin-bottom: 28px; display: flex; align-items: flex-start; justify-content: space-between; }

.gradient-text {
  background: linear-gradient(135deg, #A78BFA, #8B5CF6, #6D28D9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.arabic {
  font-family: 'Amiri', serif;
  direction: rtl;
  line-height: 2;
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: 0 0 0 1px var(--border-light), 0 8px 32px rgba(139,92,246,.06); }
.card-pad { padding: 20px; }
.card-pad-lg { padding: 24px; }

.stat-card { padding: 20px; }
.stat-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--txt-m); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--txt-2); margin-top: 4px; }
.stat-icon  { font-size: 18px; }
.stat-top   { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-icon-box {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Grid helpers ───────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
.col-8 { grid-column: span 8; }
.col-4 { grid-column: span 4; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 600;
  border: 1px solid transparent;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-sm { padding: 2px 6px; font-size: 10px; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  transition: all .15s; cursor: pointer;
}
.btn-primary { background: var(--purple); color: #fff; border: 1px solid var(--purple); }
.btn-primary:hover { opacity: .88; }
.btn-ghost { background: transparent; color: var(--txt-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,.04); color: var(--txt); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Tabs ───────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; width: fit-content; margin-bottom: 20px; }
.tab { padding: 7px 16px; font-size: 13px; font-weight: 500; border-radius: 6px; color: var(--txt-2); transition: all .15s; cursor: pointer; }
.tab.active { background: var(--purple); color: #fff; }

/* ── Filters (small pills) ──────────────────────────────────────────────────── */
.filter-group { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-btn {
  padding: 5px 14px; font-size: 12px; font-weight: 500; border-radius: 99px;
  border: 1px solid var(--border); color: var(--txt-2); background: var(--card);
  transition: all .15s; cursor: pointer;
}
.filter-btn.active { background: var(--purple); color: #fff; border-color: var(--purple); }

/* ── Progress bar ───────────────────────────────────────────────────────────── */
.pbar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.pbar-fill { height: 100%; border-radius: 2px; transition: width .6s ease; }
.pbar-sm { height: 3px; }
.pbar-lg { height: 6px; }

/* ── Juz Grid ───────────────────────────────────────────────────────────────── */
.juz-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.juz-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  transition: transform .15s;
  cursor: pointer;
  border: 1px solid transparent;
}
.juz-cell:hover { transform: scale(1.06); }

/* ── Surah Grid ─────────────────────────────────────────────────────────────── */
.surah-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.surah-card {
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: transform .15s;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
}
.surah-card:hover { transform: scale(1.01); }
.surah-num  { font-size: 10px; color: var(--txt-m); }
.surah-ar   { font-size: 22px; font-family: 'Amiri',serif; margin: 2px 0; }
.surah-name { font-size: 12px; font-weight: 600; color: var(--txt); }
.surah-meta { font-size: 11px; color: var(--txt-m); margin-top: 2px; }

/* ── Page heatmap ───────────────────────────────────────────────────────────── */
.page-heatmap {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 3px;
}
.page-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  transition: transform .1s;
  cursor: pointer;
  min-height: 26px;
}
.page-cell:hover { transform: scale(1.25); z-index: 10; position: relative; }

/* ── Activity heatmap ───────────────────────────────────────────────────────── */
.activity-heatmap { display: flex; gap: 3px; }
.activity-cell {
  flex: 1; aspect-ratio: 1; border-radius: 3px;
  cursor: default; transition: transform .1s;
}
.activity-cell:hover { transform: scale(1.2); }

/* ── Revision queue item ────────────────────────────────────────────────────── */
.rev-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  transition: background .15s;
}
.rev-item:hover { background: rgba(255,255,255,.02); }
.rev-num {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700;
}
.rev-num-value { font-size: 17px; line-height: 1; }
.rev-num-label { font-size: 9px; margin-top: 1px; }
.rev-info { flex: 1; min-width: 0; }
.rev-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rev-name  { font-size: 14px; font-weight: 600; color: var(--txt); }
.rev-name-ar { font-size: 13px; font-family: 'Amiri',serif; color: var(--txt-2); }
.rev-meta  { font-size: 12px; color: var(--txt-m); }
.rev-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.rev-due   { font-size: 12px; font-weight: 600; }
.difficulty-row { display: flex; align-items: center; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.diff-label { font-size: 11px; color: var(--txt-m); }
.diff-btn {
  padding: 2px 8px; font-size: 11px; font-weight: 600; border-radius: 99px; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
}

/* ── Progress ring ──────────────────────────────────────────────────────────── */
.ring-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}

/* ── Chat ───────────────────────────────────────────────────────────────────── */
.chat-container {
  flex: 1; overflow-y: auto; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border);
  padding: 16px; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 0;
}
.chat-msg {
  display: flex; gap: 10px;
  animation: fadeUp .2s ease;
}
.chat-msg.user { flex-direction: row-reverse; }
.chat-avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.chat-bubble {
  max-width: 72%; padding: 12px 14px; font-size: 13.5px; line-height: 1.6;
}
.chat-msg.user .chat-bubble {
  background: var(--purple); color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.chat-msg.assistant .chat-bubble {
  background: var(--bg); color: var(--txt);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
}
.chat-bubble strong { font-weight: 700; }
.typing-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--purple); display: inline-block; margin: 0 2px;
  animation: typingPulse 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingPulse { 0%,80%,100%{opacity:.3} 40%{opacity:1} }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.suggestion-btn {
  padding: 6px 12px; font-size: 12px; font-weight: 500; border-radius: 99px; cursor: pointer;
  background: var(--purple-glow); color: var(--purple-l); border: 1px solid rgba(109,40,217,.3);
  transition: all .15s;
}
.suggestion-btn:hover { opacity: .8; }

.chat-input-row { display: flex; gap: 10px; }
.chat-input {
  flex: 1; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px;
  background: var(--card); border: 1px solid var(--border); color: var(--txt); outline: none;
  transition: border-color .15s;
}
.chat-input:focus { border-color: var(--purple); }
.chat-send {
  padding: 12px 20px; background: var(--purple); color: #fff; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; transition: opacity .15s;
}
.chat-send:hover { opacity: .88; }
.chat-send:disabled { opacity: .4; cursor: not-allowed; }

/* ── Teacher ────────────────────────────────────────────────────────────────── */
.student-row {
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card);
  cursor: pointer; transition: all .15s;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 6px;
}
.student-row:hover { border-color: var(--border-light); }
.student-row.active { border-color: var(--purple); background: rgba(139,92,246,.06); }
.student-row.danger { border-color: rgba(239,68,68,.3); }
.stu-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--purple-d), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
}
.stu-info { flex: 1; min-width: 0; }
.stu-name { font-size: 14px; font-weight: 600; color: var(--txt); display: flex; align-items: center; gap: 6px; }
.stu-meta { font-size: 12px; color: var(--txt-m); margin-top: 2px; }
.stu-juz-mini {
  display: grid; grid-template-columns: repeat(30, 1fr); gap: 1px; margin-top: 6px;
}
.stu-juz-bar { height: 5px; border-radius: 1px; }

.detail-panel { padding: 20px; }
.detail-juz-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.detail-juz-cell {
  aspect-ratio: 1; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; border: 1px solid transparent;
}

/* ── Leaderboard ────────────────────────────────────────────────────────────── */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 16px; margin-bottom: 32px; }
.podium-col { display: flex; flex-direction: column; align-items: center; }
.podium-avatar {
  width: 56px; height: 56px; border-radius: 50%; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
}
.podium-name  { font-size: 13px; font-weight: 600; text-align: center; color: var(--txt); }
.podium-value { font-size: 12px; color: var(--txt-m); text-align: center; margin-bottom: 6px; }
.podium-base  { width: 96px; border-radius: 10px 10px 0 0; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.podium-base.h1 { height: 90px; }
.podium-base.h2 { height: 64px; }
.podium-base.h3 { height: 48px; }

.lb-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; transition: background .15s;
}
.lb-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.lb-row.me { border-left: 3px solid var(--purple); background: rgba(139,92,246,.05); }
.lb-rank { width: 32px; text-align: center; font-size: 13px; font-weight: 700; color: var(--txt-m); }
.lb-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-size: 14px; font-weight: 600; color: var(--txt); display: flex; align-items: center; gap: 6px; }
.lb-mini-bar { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.lb-mini-track { width: 80px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.lb-mini-fill  { height: 100%; border-radius: 2px; background: var(--purple); }
.lb-streak { text-align: center; width: 64px; }
.lb-streak-val { font-size: 13px; font-weight: 600; color: var(--yellow); }
.lb-streak-lab { font-size: 11px; color: var(--txt-m); }
.lb-value { text-align: right; width: 72px; }
.lb-val { font-size: 18px; font-weight: 800; }
.lb-val-lab { font-size: 11px; color: var(--txt-m); }

/* ── Landing ────────────────────────────────────────────────────────────────── */
.landing { margin-left: 0 !important; }
.landing-wrap { max-width: 100%; padding: 0; }
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 48px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(7,7,17,.9); backdrop-filter: blur(12px); z-index: 50;
}
.landing-nav-logo { display: flex; align-items: center; gap: 10px; }
.landing-nav-links { display: flex; align-items: center; gap: 28px; }
.landing-nav-links a { font-size: 14px; color: var(--txt-2); transition: color .15s; }
.landing-nav-links a:hover { color: var(--txt); }
.landing-hero {
  text-align: center; padding: 80px 48px 60px; position: relative;
}
.landing-glow {
  position: absolute; top: 60px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 350px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(139,92,246,.1) 0%, transparent 70%);
  pointer-events: none;
}
.landing-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--purple-glow); color: var(--purple-l);
  border: 1px solid rgba(109,40,217,.3); margin-bottom: 28px;
}
.landing-h1 { font-size: 56px; font-weight: 800; line-height: 1.1; margin-bottom: 16px; }
.landing-h1 .line2 { display: block; }
.landing-ayah { font-size: 22px; font-family: 'Amiri',serif; color: var(--purple-l); margin-bottom: 20px; direction: rtl; }
.landing-sub { font-size: 17px; color: var(--txt-2); max-width: 580px; margin: 0 auto 32px; line-height: 1.7; }
.landing-cta { display: flex; align-items: center; justify-content: center; gap: 12px; }
.landing-btn-primary {
  padding: 14px 32px; font-size: 15px; font-weight: 700; border-radius: var(--radius);
  background: var(--purple); color: #fff; transition: all .2s;
  box-shadow: 0 0 30px rgba(139,92,246,.3);
}
.landing-btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.landing-btn-ghost {
  padding: 14px 28px; font-size: 15px; font-weight: 600; border-radius: var(--radius);
  background: var(--card); color: var(--txt); border: 1px solid var(--border); transition: all .2s;
}
.landing-btn-ghost:hover { border-color: var(--border-light); }
.stats-bar {
  display: flex; justify-content: center; gap: 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 32px 48px;
}
.stats-bar-item { flex: 1; text-align: center; border-right: 1px solid var(--border); padding: 0 32px; }
.stats-bar-item:last-child { border-right: none; }
.stats-val  { font-size: 36px; font-weight: 800; }
.stats-lab  { font-size: 13px; color: var(--txt-m); margin-top: 4px; }
.features-section { padding: 64px 48px; max-width: 1100px; margin: 0 auto; }
.features-section h2 { font-size: 36px; font-weight: 800; text-align: center; margin-bottom: 10px; }
.features-section p  { font-size: 16px; color: var(--txt-2); text-align: center; margin-bottom: 40px; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature-card { padding: 22px; }
.feature-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; margin-bottom: 14px; background: var(--purple-glow); color: var(--purple-l); }
.feature-title { font-size: 15px; font-weight: 700; color: var(--txt); margin-bottom: 6px; }
.feature-desc  { font-size: 13px; color: var(--txt-2); line-height: 1.6; }
.landing-cta-section {
  margin: 0 48px 64px; border-radius: 24px; padding: 56px;
  text-align: center; position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(109,40,217,.15), rgba(139,92,246,.06));
  border: 1px solid rgba(109,40,217,.3);
}
.landing-cta-section h2 { font-size: 40px; font-weight: 800; margin-bottom: 12px; }
.landing-cta-section p  { font-size: 16px; color: var(--txt-2); margin-bottom: 28px; }
.landing-footer { text-align: center; padding: 24px; border-top: 1px solid var(--border); font-size: 13px; color: var(--txt-m); }

/* ── App Footer ──────────────────────────────────────────────────────────────── */
#app-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 40px 48px 24px;
  margin-top: 48px;
}
.app-footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
.app-footer-brand-name { font-size: 15px; font-weight: 700; color: var(--txt); margin-bottom: 6px; }
.app-footer-brand-desc { font-size: 12px; color: var(--txt-m); line-height: 1.6; margin-bottom: 14px; }
.app-footer-sub-btn {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 99px;
  background: var(--purple-glow); color: var(--purple-l);
  border: 1px solid var(--purple-d); cursor: pointer; text-decoration: none;
}
.app-footer-col-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--txt-m); margin-bottom: 12px; }
.app-footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.app-footer-links a { font-size: 12px; color: var(--txt-2); text-decoration: none; }
.app-footer-links a:hover { color: var(--purple-l); }
.app-footer-bottom { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 20px; font-size: 11px; color: var(--txt-m); }

/* ── Misc ───────────────────────────────────────────────────────────────────── */
.section-title { font-size: 15px; font-weight: 700; color: var(--txt); margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.section-link  { font-size: 12px; color: var(--purple-l); font-weight: 500; }
.divider-section { margin-top: 6px; }
.overdue-section { margin-bottom: 6px; }
.reviewed-check { font-size: 12px; color: var(--green); margin-top: 4px; }
.alert-card { padding: 12px; border-radius: var(--radius-sm); margin-bottom: 8px; }
.alert-head  { font-size: 12px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.alert-body  { font-size: 12px; color: var(--txt-2); line-height: 1.5; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.cal-day { border-radius: var(--radius); padding: 10px; min-height: 120px; }
.cal-day-name { font-size: 11px; color: var(--txt-m); text-align: center; }
.cal-day-num  { font-size: 20px; font-weight: 700; text-align: center; margin: 2px 0 6px; }
.cal-day-today { border-color: var(--purple) !important; background: rgba(139,92,246,.06); }
.cal-item { font-size: 11px; font-weight: 600; padding: 3px 6px; border-radius: 5px; margin-bottom: 3px; }
.history-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); margin-bottom: 6px; }
.class-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.class-table th { padding: 6px 4px; color: var(--txt-m); font-weight: 500; text-align: center; }
.class-table td { padding: 4px 4px; }
.class-juz-box { width: 22px; height: 22px; border-radius: 5px; margin: auto; }
.notice-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 99px; font-size: 10px; font-weight: 600;
}
.note-textarea {
  width: 100%; min-height: 80px; padding: 12px; border-radius: var(--radius-sm); resize: vertical;
  background: var(--bg); border: 1px solid var(--border); color: var(--txt); font-size: 13px; outline: none;
  transition: border-color .15s;
}
.note-textarea:focus { border-color: var(--purple); }
.spacer { height: 20px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--txt-m); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }

/* ── Auth overlay ───────────────────────────────────────────────────────────── */
#auth-overlay { position: fixed; inset: 0; z-index: 9999; }
.auth-backdrop {
  width: 100%; height: 100%;
  background: rgba(7,7,17,.95);
  backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-modal {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 36px 40px;
  width: 100%; max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(139,92,246,.1);
  animation: fadeUp .25s ease;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-title { font-size: 24px; font-weight: 800; color: var(--txt); margin-bottom: 6px; }
.auth-sub   { font-size: 14px; color: var(--txt-2); margin-bottom: 24px; line-height: 1.5; }
.auth-field { margin-bottom: 16px; }
.auth-label { display: block; font-size: 12px; font-weight: 600; color: var(--txt-2); margin-bottom: 6px; }
.auth-input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border-light);
  color: var(--txt); font-size: 14px; outline: none; transition: border-color .15s;
}
.auth-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,92,246,.12); }
.auth-btn {
  width: 100%; padding: 13px; border-radius: var(--radius-sm);
  background: var(--purple); color: #fff; font-size: 15px; font-weight: 700;
  transition: all .15s; cursor: pointer; border: none;
  box-shadow: 0 4px 20px rgba(139,92,246,.3);
}
.auth-btn:hover { opacity: .9; transform: translateY(-1px); }
.auth-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.auth-btn-ghost {
  padding: 11px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  background: transparent; color: var(--txt-2); border: 1px solid var(--border-light);
  cursor: pointer; transition: all .15s;
}
.auth-btn-ghost:hover { background: rgba(255,255,255,.04); color: var(--txt); }
.auth-row { display: flex; gap: 10px; margin-top: 16px; }
.auth-row .auth-btn { flex: 1; }
.auth-foot { margin-top: 20px; text-align: center; font-size: 13px; color: var(--txt-m); }
.auth-link { color: var(--purple-l); cursor: pointer; font-weight: 600; }
.auth-link:hover { text-decoration: underline; }
.auth-btn-google {
  width: 100%; padding: 11px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg2);
  color: var(--txt); font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.15s, border-color 0.15s; margin-bottom: 4px;
}
.auth-btn-google:hover { background: var(--card); border-color: var(--purple); }
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--txt-m); font-size: 12px; margin: 10px 0;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-error {
  display: none; padding: 10px 14px; border-radius: var(--radius-sm);
  background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3);
  color: #FC8181; font-size: 13px; margin-bottom: 16px;
}

/* Auth steps */
.auth-steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 28px;
}
.auth-step {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--border); color: var(--txt-m);
  border: 2px solid var(--border-light);
  transition: all .2s;
}
.auth-step.active { background: var(--purple); color: #fff; border-color: var(--purple); }
.auth-step.done   { background: var(--green); color: #fff; border-color: var(--green); }
.auth-step-line {
  flex: 1; height: 2px; background: var(--border-light); transition: background .2s;
}
.auth-step-line.active { background: var(--purple); }

/* Role cards */
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 4px; }
.role-card {
  padding: 20px 16px; border-radius: var(--radius); border: 2px solid var(--border-light);
  cursor: pointer; transition: all .15s; text-align: center; position: relative;
  background: var(--bg);
}
.role-card:hover { border-color: var(--purple-d); background: var(--purple-glow); }
.role-card.selected { border-color: var(--purple); background: rgba(139,92,246,.08); }
.role-icon  { font-size: 28px; margin-bottom: 8px; }
.role-title { font-size: 15px; font-weight: 700; color: var(--txt); margin-bottom: 4px; }
.role-desc  { font-size: 11px; color: var(--txt-m); line-height: 1.5; }
.role-check {
  position: absolute; top: 8px; right: 8px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--purple); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}

/* Classroom code */
.classroom-code-box {
  text-align: center; padding: 24px 20px;
  background: var(--purple-glow); border: 2px dashed var(--purple-d);
  border-radius: var(--radius-lg); cursor: pointer; transition: all .15s;
}
.classroom-code-box:hover { background: rgba(139,92,246,.15); }
.classroom-code-label { font-size: 11px; font-weight: 600; color: var(--txt-m); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.classroom-code { font-size: 40px; font-weight: 800; letter-spacing: .3em; color: var(--purple-l); font-family: monospace; }
.classroom-code-hint { font-size: 12px; color: var(--txt-m); margin-top: 8px; }

/* Classroom code input */
.code-input {
  text-align: center; font-size: 28px; font-weight: 800;
  letter-spacing: .3em; font-family: monospace;
}

/* Logout button */
.btn-logout {
  width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--txt-m); cursor: pointer;
  transition: all .15s; background: transparent; border: none;
}
.btn-logout:hover { background: rgba(239,68,68,.12); color: var(--red); }

/* ── Rating buttons ──────────────────────────────────────────────────────────── */
.tracker-juz-card { padding: 0; overflow: hidden; cursor: default; }
.rating-btns {
  display: flex; border-top: 1px solid var(--border); width: 100%;
}
.rating-btn {
  flex: 1 1 0; min-width: 0; padding: 6px 3px; font-size: 10px; font-weight: 700;
  cursor: pointer; border: none; background: transparent;
  transition: all .15s; color: var(--txt-m);
  letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rating-btn:not(:last-child) { border-right: 1px solid var(--border); }
.rating-btn:hover { background: rgba(255,255,255,.05); }
.rating-btn.perfect        { color: var(--txt-m); }
.rating-btn.perfect:hover,
.rating-btn.perfect.active { background: rgba(139,92,246,.15); color: #8B5CF6; }
.rating-btn.good        { color: var(--txt-m); }
.rating-btn.good:hover,
.rating-btn.good.active { background: rgba(16,185,129,.15); color: #10B981; }
.rating-btn.ok          { color: var(--txt-m); }
.rating-btn.ok:hover,
.rating-btn.ok.active   { background: rgba(245,158,11,.15); color: #F59E0B; }
.rating-btn.hard        { color: var(--txt-m); }
.rating-btn.hard:hover,
.rating-btn.hard.active { background: rgba(249,115,22,.15); color: #F97316; }
.rating-btn.bad         { color: var(--txt-m); }
.rating-btn.bad:hover,
.rating-btn.bad.active  { background: rgba(239,68,68,.15); color: #EF4444; }

/* ── Quran Browser ───────────────────────────────────────────────────────────── */
.quran-surah-card { cursor: pointer; }
.quran-surah-card:hover { border-color: var(--border-light); transform: scale(1.01); }

.juz-browser-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
}
.juz-browser-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 14px; text-align: center; transition: all .15s;
  display: flex; flex-direction: column; align-items: center;
}
.juz-browser-card:hover { border-color: var(--purple-d); background: var(--purple-glow); transform: translateY(-2px); }
.juz-browser-num  { font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 2px; }

.page-browser-grid {
  display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px;
}
.page-browser-cell {
  aspect-ratio: 1; border-radius: 3px; background: var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: all .1s;
}
.page-browser-cell:hover { background: var(--purple-d); transform: scale(1.3); z-index: 5; position: relative; }

/* Surah detail */
.surah-detail { display: flex; flex-direction: column; gap: 16px; }
.surah-detail-header { }
.surah-audio-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.audio-btn-main {
  padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 700;
  background: var(--purple); color: #fff; border: none; cursor: pointer; transition: all .15s;
}
.audio-btn-main:hover { opacity: .88; }
.audio-btn-sec {
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  background: var(--bg); color: var(--txt-2); border: 1px solid var(--border-light);
  cursor: pointer; transition: all .15s;
}
.audio-btn-sec:hover { background: rgba(255,255,255,.04); color: var(--txt); }

.now-playing {
  font-size: 12px; color: var(--purple-l); font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; background: var(--purple-glow); border-radius: 6px;
  width: fit-content;
}

.bismillah {
  text-align: center; font-size: 24px; color: var(--purple-l);
  padding: 20px; background: var(--purple-glow);
  border: 1px solid rgba(139,92,246,.2); border-radius: var(--radius);
  line-height: 2;
}

.verses-list { display: flex; flex-direction: column; gap: 2px; }
.verse-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border);
  transition: all .15s;
}
.verse-row:hover { background: rgba(139,92,246,.04); border-color: var(--border-light); }
.verse-row.verse-active {
  background: rgba(139,92,246,.08); border-color: var(--purple-d);
  box-shadow: 0 0 0 1px rgba(139,92,246,.2);
}
.verse-num {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--purple-l);
  background: var(--purple-glow); border: 1px solid rgba(139,92,246,.2);
}
.verse-text { flex: 1; font-size: 20px; line-height: 2; direction: rtl; text-align: right; }
.verse-active .verse-text { color: var(--purple-l); }
.verse-play-btn {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--border); color: var(--txt-m);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 11px; transition: all .15s;
}
.verse-play-btn:hover, .verse-play-btn.playing {
  background: var(--purple); border-color: var(--purple); color: #fff;
}

.reciter-select {
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  background: var(--card); border: 1px solid var(--border-light); color: var(--txt);
  cursor: pointer; outline: none;
}
.reciter-select:focus { border-color: var(--purple); }

.quran-loading {
  text-align: center; padding: 80px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  font-size: 14px; color: var(--txt-m);
}
.quran-loading-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--purple);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── AI Insights ─────────────────────────────────────────────────────────────── */
.insights-empty {
  text-align: center; padding: 80px 32px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.insights-loading {
  padding: 32px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.insights-skeleton {
  width: 100%; height: 18px; border-radius: 8px;
  background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── XP bar ────────────────────────────────────────────────────────────────── */
.xp-bar-container {
  width: 100%; height: 7px; border-radius: 99px;
  background: var(--border); overflow: hidden;
}
.xp-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--purple), var(--accent));
  transition: width .6s ease;
}

/* ── Goal bar ──────────────────────────────────────────────────────────────── */
.goal-bar-container {
  width: 100%; height: 7px; border-radius: 99px;
  background: var(--border); overflow: hidden;
}
.goal-bar-fill {
  height: 100%; border-radius: 99px;
  transition: width .6s ease;
}

/* ── Streak heatmap ────────────────────────────────────────────────────────── */
.heatmap-grid {
  display: flex; gap: 2px; width: 100%;
}
.heatmap-col {
  display: flex; flex-direction: column; gap: 2px;
}
.heatmap-cell {
  width: 10px; height: 10px; border-radius: 2px;
  background: var(--border);
}
.heatmap-cell--0 { background: var(--border); }
.heatmap-cell--1 { background: var(--accent); opacity: .75; }

.insights-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.insights-side { display: flex; flex-direction: column; gap: 12px; }
.insights-section-title { font-size: 13px; font-weight: 700; color: var(--txt-m); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }

.insight-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 10px;
}
.insight-card-head {
  font-size: 13px; font-weight: 700; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.insight-card-body { font-size: 13px; color: var(--txt-2); line-height: 1.6; }
.insight-urgency {
  margin-left: auto; padding: 2px 8px; border-radius: 99px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.insight-motivation {
  background: linear-gradient(135deg, rgba(109,40,217,.12), rgba(139,92,246,.06));
  border-color: rgba(109,40,217,.3);
}

/* ── Light mode ──────────────────────────────────────────────────────────────── */
body.light-mode {
  --bg:           #F2F2F8;
  --bg2:          #EBEBF5;
  --card:         #FFFFFF;
  --card-hover:   #EBEBF5;
  --border:       #DCDCE8;
  --border-light: #C4C4D8;
  --txt:          #1A1A2E;
  --txt-2:        #5A5A7A;
  --txt-m:        #8888AA;
  --purple-glow:  rgba(139,92,246,0.09);
  --accent:       #7C3AED;
  --accent-soft:  rgba(124,58,237,.1);
  --red:          #DC2626;
  --green:        #059669;
  --yellow:       #D97706;
  --blue:         #2563EB;
  --red-dim:      rgba(220,38,38,.1);
  --yellow-dim:   rgba(217,119,6,.1);
  --green-dim:    rgba(5,150,105,.1);
  --blue-dim:     rgba(37,99,235,.1);
}
body.light-mode .card        { box-shadow: 0 1px 6px rgba(0,0,0,.07); }
body.light-mode #sidebar     { box-shadow: 2px 0 16px rgba(0,0,0,.08); }
body.light-mode .auth-modal  { box-shadow: 0 16px 60px rgba(0,0,0,.18); }

/* ── Text sizes ──────────────────────────────────────────────────────────────── */
body.text-sm { font-size: 14px; }
body.text-lg { font-size: 18px; }
/* zoom scales all px-based elements proportionally */
body.text-sm #page-content { zoom: 0.88; }
body.text-lg #page-content { zoom: 1.16; }
body.text-sm .sidebar-nav  { font-size: 12px; }
body.text-lg .sidebar-nav  { font-size: 15px; }
body.text-sm .page-title   { font-size: 24px; }
body.text-lg .page-title   { font-size: 33px; }

/* ── Settings panel ──────────────────────────────────────────────────────────── */
#settings-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: flex-end; justify-content: flex-start;
}
.settings-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
}
.settings-panel {
  position: relative; z-index: 1;
  width: 320px; max-height: 90vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border-light);
  border-radius: 0 20px 0 0;
  padding: 24px 22px;
  animation: slideUpPanel .22s ease;
  box-shadow: 0 -8px 40px rgba(0,0,0,.3);
}
@keyframes slideUpPanel {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.settings-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--border); color: var(--txt-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; transition: all .15s;
  border: none;
}
.settings-close:hover { background: var(--border-light); color: var(--txt); }
.settings-section {
  margin-bottom: 18px; padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.settings-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--txt-m); margin-bottom: 10px;
}
.settings-row { display: flex; gap: 6px; flex-wrap: wrap; }
.setting-option {
  flex: 1; padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; text-align: center;
  background: var(--bg); border: 1px solid var(--border-light);
  color: var(--txt-2); cursor: pointer; transition: all .15s; white-space: nowrap;
}
.setting-option:hover { border-color: var(--purple-d); color: var(--txt); }
.setting-option.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.settings-user-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--bg); border-radius: var(--radius-sm);
  margin-bottom: 0;
}


/* ── Juz rating grid (signup step 4) ─────────────────────────────────────────── */
.auth-modal-wide { max-width: 600px; }
.juz-rate-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  margin: 16px 0;
}
.juz-rate-cell {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  background: var(--bg); border: 2px solid var(--border-light);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; transition: all .15s;
}
.juz-rate-cell:hover { border-color: var(--purple-d); background: var(--purple-glow); }
.juz-rate-num  { font-size: 15px; font-weight: 800; color: var(--txt-m); }
.juz-rate-icon { font-size: 13px; font-weight: 700; line-height: 1; }

.juz-rate-legend {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.juz-rate-leg {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px;
}
.juz-rate-leg.good { background: rgba(16,185,129,.15);  color: #10B981; }
.juz-rate-leg.mid  { background: rgba(245,158,11,.15);  color: #F59E0B; }
.juz-rate-leg.bad  { background: rgba(239,68,68,.15);   color: #EF4444; }

/* ── Progress tab ────────────────────────────────────────────────────────────── */
.progress-juz-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px;
}
.progress-juz-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 8px;
  text-align: center; cursor: pointer; transition: all .15s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.progress-juz-card:hover { border-color: var(--border-light); transform: scale(1.02); }

/* ── Verse translation ───────────────────────────────────────────────────────── */
.verse-trans {
  font-size: 12px; color: var(--txt-2); line-height: 1.6;
  padding-top: 6px; border-top: 1px solid var(--border); margin-top: 6px;
  direction: ltr; text-align: left;
}

/* ── Center page content ─────────────────────────────────────────────────────── */
.page { margin-left: auto; margin-right: auto; }

/* ── Logo image ──────────────────────────────────────────────────────────────── */
.logo-icon-img {
  width: 38px; height: 38px; object-fit: contain; flex-shrink: 0; border-radius: 8px;
}

/* ── Quran audio player — sits below the page content in normal flow ─────────── */
.quran-player {
  background: var(--card);
  border-top: 1px solid var(--border-light);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 -2px 16px rgba(0,0,0,.35);
  margin-top: 8px;
}
.has-player { padding-bottom: 0; }
.qp-info { min-width: 120px; flex-shrink: 0; }
.qp-surah { font-size: 13px; font-weight: 700; color: var(--txt); }
.qp-verse-num { font-size: 11px; color: var(--purple-l); margin-top: 2px; }
.qp-main { flex: 1; min-width: 200px; }
.qp-btns { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; justify-content: center; }
.qp-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--border-light); color: var(--txt);
  font-size: 13px; cursor: pointer; transition: all .15s;
}
.qp-btn:hover { border-color: var(--purple-d); background: var(--purple-glow); color: var(--purple-l); }
.qp-play {
  width: 42px; height: 42px; font-size: 16px;
  background: var(--purple); border-color: var(--purple); color: #fff !important;
}
.qp-play:hover { background: #a855f7; border-color: #a855f7; }
.qp-timeline { display: flex; align-items: center; gap: 8px; }
.qp-time { font-size: 10px; color: var(--txt-m); font-variant-numeric: tabular-nums; min-width: 30px; }
.qp-bar {
  flex: 1; height: 5px; background: var(--border); border-radius: 3px;
  cursor: pointer; position: relative;
  transition: height .1s;
}
.qp-bar:hover { height: 7px; }
.qp-fill {
  height: 100%; background: var(--purple); border-radius: 3px;
  pointer-events: none; transition: width .1s linear;
}
.qp-extras { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.qp-speeds { display: flex; gap: 3px; }
.qp-speed {
  font-size: 10px; font-weight: 700; padding: 4px 6px;
  border-radius: 4px; background: var(--bg); border: 1px solid var(--border);
  color: var(--txt-m); cursor: pointer; transition: all .15s;
}
.qp-speed.active { background: var(--purple-glow); border-color: var(--purple-d); color: var(--purple-l); }
.qp-trans-btn { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-sm); }

/* ── Page (Mushaf) layout ────────────────────────────────────────────────────── */
.verse-flow {
  font-family: 'Amiri', serif;
  font-size: 26px;
  line-height: 2.5;
  text-align: center;
  direction: rtl;
  color: var(--txt);
  padding: 28px 32px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.verse-flow-span {
  cursor: pointer; border-radius: 4px; padding: 2px 3px;
  transition: background .12s;
  display: inline;
}
.verse-flow-span:hover { background: var(--purple-glow); }
.verse-span-active { background: var(--purple-glow) !important; color: var(--purple-l); }
.verse-end-num { color: var(--purple-l); font-size: 16px; margin: 0 3px; font-family: 'Amiri', serif; }
.verse-flow-trans { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.verse-flow-item {
  padding: 14px 18px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border);
  cursor: pointer; transition: border-color .15s;
}
.verse-flow-item:hover { border-color: var(--purple-d); }
.verse-flow-arabic {
  font-family: 'Amiri', serif; font-size: 24px;
  text-align: center; direction: rtl; line-height: 2;
  margin-bottom: 6px;
}

/* ── Mushaf page — 17.5 × 25 cm, 15 lines, rectangle ────────────────────────── */
.mushaf-page {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 0;
  width: 100%;
  max-width: 662px;
  height: 944px;          /* JS overrides: pageWidth × (944/662) */
  padding: 5% 6%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  direction: rtl;
  font-family: 'Amiri', serif;
  color: var(--txt);
  box-shadow: 0 4px 28px rgba(0,0,0,.6);
  position: relative;
  margin: 0 auto 16px;
}
/* Lines wrapper — takes all remaining space after page number */
.mushaf-lines-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
/* One div per authentic Mushaf line; height and font-size set by JS.
   font-family intentionally omitted — inherits QCF page font from .mushaf-page. */
.mushaf-line {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  direction: rtl;
  color: var(--txt);
  overflow: hidden;
  box-sizing: border-box;
}
.mushaf-word { display: inline; border-radius: 2px; padding: 0 1px; cursor: pointer; }
.mushaf-word:hover { background: var(--purple-glow); }
.mushaf-word-ayah { background: rgba(139,92,246,.18) !important; border-radius: 2px; }
.mushaf-word-current { background: rgba(139,92,246,.55) !important; color: #fff !important; border-radius: 3px; }
/* Fixed-position word translation tooltip — appended to body by JS so it escapes overflow:hidden */
#mushaf-wt {
  position: fixed;
  transform: translate(-50%, calc(-100% - 8px));
  background: rgba(15,8,40,.96);
  color: #e2d9f3;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 11px;
  border-radius: 6px;
  border: 1px solid rgba(167,139,250,.45);
  pointer-events: none;
  white-space: normal;
  max-width: 280px;
  text-align: center;
  direction: ltr;
  z-index: 9999;
  opacity: 0;
  transition: opacity .15s;
}
.mushaf-verse-end { display: inline; font-family: 'Amiri', serif; font-size: 0.72em; color: var(--purple-l); cursor: pointer; padding: 0 2px; }
.mushaf-verse-end:hover { opacity: 0.6; }

/* Ayah-end medallion — double-ring design matching quran.com, in app purple */
.mushaf-ayah-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Amiri', serif;
  font-size: 0.5em;
  color: var(--purple-l);
  min-width: 2em;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  border: 1.5px solid var(--purple-l);
  /* outer decorative ring: 2px gap then 1px ring — the quran.com double-ring look */
  box-shadow: 0 0 0 2px transparent, 0 0 0 3px rgba(167,139,250,.5);
  background: rgba(139,92,246,.07);
  cursor: pointer;
  vertical-align: middle;
  margin: 0 6px;
  box-sizing: border-box;
  flex-shrink: 0;
  transition: background .15s;
}
.mushaf-ayah-num:hover {
  background: rgba(139,92,246,.2);
  box-shadow: 0 0 0 2px transparent, 0 0 0 3px var(--purple-l);
}
.mushaf-marker { display: inline; font-size: 18px; color: var(--txt-m); opacity: 0.5; }
.mushaf-bismillah-line {
  display: block;
  direction: rtl;
  text-align: center;
  font-family: 'Amiri', serif;
  font-size: 30px;
  line-height: 1.75;
  color: var(--purple-l);
}
/* Flow-based verse renderer (alquran.cloud) — font-size and line-height set by JS */
.mushaf-page .verse-flow {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 0;
  color: var(--txt);
  text-align: justify;
  text-align-last: right;
  direction: rtl;
  overflow: visible; /* scrollHeight must reflect true content height for JS measurement */
}
.mushaf-page .verse-end-num { color: var(--purple-l); font-size: 24px; }
/* .mushaf-page-full inherits all padding from .mushaf-page — no override needed */
.mushaf-page-num {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--txt-m);
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.mushaf-surah-header {
  font-family: 'Amiri', serif; /* must stay Amiri — surah name uses Unicode Arabic, not QCF glyphs */
  text-align: center;
  font-size: 26px;
  color: var(--purple-l);
  margin: 10px 0 6px;
  padding: 8px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  font-weight: 700;
  direction: rtl;
  line-height: 1.7;
}
.mushaf-bismillah {
  text-align: center;
  font-size: 30px;
  color: var(--txt);
  margin: 4px 0 10px;
  direction: rtl;
}
.mushaf-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
.mushaf-page-divider {
  max-width: 660px;
  margin: 6px auto;
  border: none;
  border-top: 1px solid var(--border-light);
}
/* Verse item in translation mode */
.mushaf-trans-mode { text-align: right; overflow: visible; height: auto; }
.mushaf-verse-item {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.mushaf-verse-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.mushaf-verse-text {
  font-family: 'Amiri', serif;
  font-size: 24px;
  line-height: 2;
  direction: rtl;
  text-align: right;
  color: var(--txt);
  margin-bottom: 10px;
}
.mushaf-verse-trans {
  font-size: 13px;
  color: var(--txt-2);
  text-align: left;
  direction: ltr;
  font-style: italic;
  line-height: 1.6;
}

/* ── Word-level hover/click ─────────────────────────────────────────────────── */
.qword {
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 2px;
  transition: background 0.12s;
  position: relative;
  display: inline;
}
.qword:hover { background: rgba(139,92,246,.18); }
.qword-active { background: rgba(139,92,246,.38) !important; border-radius: 3px; color: #e2d4ff; box-shadow: 0 0 0 1px rgba(139,92,246,.4); }

/* Tooltip shown on hover via data-trans attribute */
.qword[data-trans]::after {
  content: attr(data-trans);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,8,25,.97);
  color: #e8e8f4;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  direction: ltr;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 5px 9px;
  border-radius: 5px;
  border: 1px solid rgba(139,92,246,.35);
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.15s 0.3s;
  line-height: 1.5;
}
.qword[data-trans]:hover::after { opacity: 1; }
.qword[data-trans]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(10,8,25,.97);
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.15s 0.3s;
}
.qword[data-trans]:hover::before { opacity: 1; }

/* ── Juz browser play button ────────────────────────────────────────────────── */
.juz-play-btn {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 6px;
  background: var(--purple-glow);
  border: 1px solid var(--purple-d);
  color: var(--purple-l);
  cursor: pointer;
  transition: all .15s;
  width: 100%;
}
.juz-play-btn:hover {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}

/* ── Player advanced controls row ───────────────────────────────────────────── */
.qp-adv-controls {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  flex-wrap: wrap;
}
.qp-ctrl-group {
  display: flex;
  align-items: center;
  gap: 5px;
}
.qp-ctrl-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--txt-m);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.qp-ctrl-input {
  width: 52px;
  height: 26px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--txt);
  font-size: 12px;
  text-align: center;
  padding: 0 4px;
  transition: border-color .15s;
}
.qp-ctrl-input:focus {
  outline: none;
  border-color: var(--purple-d);
}
.qp-rep-info {
  font-size: 10px;
  color: var(--purple-l);
  background: var(--purple-glow);
  border: 1px solid var(--purple-d);
  border-radius: 4px;
  padding: 1px 6px;
  margin-top: 2px;
  display: inline-block;
}
.has-player { padding-bottom: 140px; }

/* ── Recitation Player view ─────────────────────────────────────────────────── */
.player-view-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .player-view-grid { grid-template-columns: 1fr; } }
.pv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.pv-row:last-child { border-bottom: none; }
.pv-row:hover { background: var(--card-hover); }
.pv-row-active { background: var(--purple-glow) !important; }
.pv-row-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--txt-m);
  min-width: 28px;
  text-align: center;
  background: var(--bg);
  border-radius: 4px;
  padding: 2px 6px;
}
.pv-row-active .pv-row-num { background: var(--purple-glow); color: var(--purple-l); }
.pv-row-label { font-size: 13px; color: var(--txt-2); flex: 1; }
.pv-row-active .pv-row-label { color: var(--txt); font-weight: 600; }
.pv-row-icon { font-size: 13px; color: var(--purple-l); }
.pv-ctrl-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--txt-m);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pv-ctrl-input {
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--txt);
  font-size: 14px;
  text-align: center;
  padding: 0 8px;
  transition: border-color .15s;
}
.pv-ctrl-input:focus { outline: none; border-color: var(--purple-d); }

/* ── Subscriptions page ─────────────────────────────────────────────────────── */
.sub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 8px;
}
@media (max-width: 900px) { .sub-grid { grid-template-columns: 1fr; } }
.sub-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  transition: border-color .2s, transform .2s;
}
.sub-card:hover { border-color: var(--border-light); transform: translateY(-3px); }
.sub-card-highlight {
  border-color: var(--purple-d);
  background: linear-gradient(160deg, var(--card) 0%, rgba(109,40,217,.06) 100%);
  box-shadow: 0 0 0 1px var(--purple-d), 0 8px 32px rgba(109,40,217,.18);
}
.sub-card-current {
  border-color: #10B981 !important;
  box-shadow: 0 0 0 1px #10B981, 0 6px 24px rgba(16,185,129,.14) !important;
}
.sub-tag {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 99px;
  white-space: nowrap;
  letter-spacing: .04em;
}
.sub-plan-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--txt-m);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}
.sub-price {
  font-size: 40px;
  font-weight: 800;
  color: var(--txt);
  line-height: 1;
  margin-bottom: 20px;
}
.sub-period {
  font-size: 14px;
  font-weight: 400;
  color: var(--txt-m);
  margin-left: 2px;
}
.sub-features {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  flex: 1;
}
.sub-feature {
  font-size: 13px;
  padding: 5px 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.sub-have { color: var(--txt-2); }
.sub-have::before { content: ''; }
.sub-miss { color: var(--txt-m); }
.sub-cta { width: 100%; text-align: center; margin-top: auto; }
.sub-cta-disabled {
  background: var(--border) !important;
  border-color: var(--border) !important;
  color: var(--txt-m) !important;
  cursor: default !important;
}
.sub-faq {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.sub-faq:last-child { border-bottom: none; }
.sub-faq-q {
  font-size: 14px;
  font-weight: 600;
  color: var(--txt);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sub-faq-q::-webkit-details-marker { display: none; }
.sub-faq-q::after {
  content: '+';
  font-size: 18px;
  color: var(--txt-m);
  flex-shrink: 0;
  margin-left: 12px;
}
details[open] .sub-faq-q::after { content: '−'; }
.sub-faq-a {
  font-size: 13px;
  color: var(--txt-2);
  line-height: 1.7;
  padding-top: 10px;
}

/* ── Recitation / Speech Recognition ───────────────────────────────────────── */
.recite-mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.recite-mode-tab {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  color: var(--txt-2);
  border: none;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.recite-mode-tab.active { background: var(--purple); color: #fff; }
.recite-mic-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--purple);
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  box-shadow: 0 4px 20px rgba(139,92,246,.4);
}
.recite-mic-btn:hover { transform: scale(1.06); opacity: .9; }
.recite-mic-btn.listening {
  background: #ef4444;
  animation: recite-pulse 1.4s ease infinite;
}
@keyframes recite-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,.6); }
  70%  { box-shadow: 0 0 0 18px rgba(239,68,68,.0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,.0); }
}
.recite-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--txt-m);
  text-align: center;
  margin-top: 10px;
  min-height: 20px;
}
.recite-status.listening { color: #ef4444; }
.recite-transcript {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 18px;
  line-height: 1.9;
  direction: rtl;
  text-align: right;
  font-family: 'Amiri', serif;
  color: var(--txt-2);
  min-height: 56px;
  margin: 12px 0;
}
.qword-correct {
  background: rgba(16,185,129,.22) !important;
  color: #6ee7b7 !important;
  box-shadow: 0 0 0 1px rgba(16,185,129,.3);
  border-radius: 3px;
}
.qword-wrong {
  background: rgba(239,68,68,.2) !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 0 1px rgba(239,68,68,.3);
  border-radius: 3px;
}
.qword-active {
  background: rgba(251,191,36,.18) !important;
  color: #fde68a !important;
  box-shadow: 0 0 0 1px rgba(251,191,36,.4);
  border-radius: 3px;
  animation: qword-pulse 0.7s ease-in-out infinite alternate;
}
@keyframes qword-pulse {
  from { box-shadow: 0 0 0 1px rgba(251,191,36,.4); }
  to   { box-shadow: 0 0 0 3px rgba(251,191,36,.7); }
}
.recite-find-result {
  background: var(--purple-glow);
  border: 1px solid rgba(139,92,246,.25);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 8px;
}
.recite-find-meta {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--purple-l);
  margin-bottom: 8px;
}
.recite-find-text {
  font-family: 'Amiri', serif;
  font-size: 22px;
  line-height: 2;
  direction: rtl;
  text-align: right;
  color: var(--txt);
  margin: 10px 0;
}
.recite-stats-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.recite-stat-correct { color: #10b981; }
.recite-stat-wrong   { color: #ef4444; }
.recite-range-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.recite-range-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--txt-m);
}
.recite-range-input {
  width: 64px;
  height: 30px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--txt);
  font-size: 13px;
  text-align: center;
  padding: 0 4px;
}
.recite-range-input:focus { outline: none; border-color: var(--purple-d); }
.recite-complete-card {
  text-align: center;
  padding: 40px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 8px;
}

/* Recite practice toggle active state */
.recite-toggle-on {
  background: rgba(16,185,129,.15) !important;
  border-color: rgba(16,185,129,.4) !important;
  color: #10b981 !important;
}

/* Practice mode — hide mushaf words until revealed by speech */
.mushaf-word.practice-hidden,
.qword.practice-hidden {
  opacity: 0 !important;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#practice-btn.practice-active {
  background: rgba(16,185,129,.15) !important;
  border-color: rgba(16,185,129,.4) !important;
  color: #10b981 !important;
}

/* Quranic markers (۞ hizb, ۩ sajdah) — display inline but no click */
.quran-marker {
  display: inline;
  color: var(--purple-l);
  font-size: 0.8em;
  opacity: 0.7;
  user-select: none;
}

/* ── Quran Browser Header Controls ──────────────────────────────────────────── */
.quran-nav-tab-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--txt-2);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.quran-nav-tab-btn:hover  { border-color: var(--purple-d); color: var(--purple-l); }
.quran-nav-tab-btn.active { background: var(--purple-glow); border-color: var(--purple-d); color: var(--purple-l); }

.quran-mic-header-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.quran-mic-header-btn:hover  { border-color: var(--purple-d); background: var(--purple-glow); }
.quran-mic-header-btn.active { background: #ef4444; border-color: #dc2626; animation: recite-pulse 1.4s ease infinite; }

/* ── Quran Navigation Panel ──────────────────────────────────────────────────── */
.quran-nav-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.quran-nav-panel-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.quran-nav-tabs-row {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}
.quran-nav-tab-item {
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--txt-m);
  cursor: pointer;
  transition: all .12s;
}
.quran-nav-tab-item:hover  { background: var(--purple-glow); color: var(--txt); }
.quran-nav-tab-item.active { background: var(--purple); color: #fff; }
.quran-nav-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--txt-m);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .12s;
}
.quran-nav-close-btn:hover { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.4); color: #fca5a5; }
.quran-nav-panel-body { padding: 14px; }

.quran-nav-surah-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}
.quran-nav-surah-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background .1s;
  width: 100%;
}

/* ── Paywall Modal ───────────────────────────────────────────────────────────── */
.paywall-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
}
.paywall-modal {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.45);
}
.paywall-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--txt-m);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .12s;
}
.paywall-close:hover { background: var(--bg); color: var(--txt); }
.paywall-icon {
  font-size: 44px;
  margin-bottom: 12px;
  color: var(--purple-l);
}
.paywall-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--txt);
  margin-bottom: 10px;
}
.paywall-desc {
  font-size: 13px;
  color: var(--txt-m);
  line-height: 1.6;
  margin-bottom: 18px;
}
.paywall-list {
  list-style: none;
  margin: 0 auto 24px;
  padding: 0;
  text-align: left;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.paywall-list li {
  font-size: 13px;
  color: var(--txt);
}
.paywall-cta {
  width: 100%;
  margin-bottom: 12px;
}
.paywall-foot {
  font-size: 12px;
  color: var(--txt-m);
}
.quran-nav-surah-row:hover   { background: var(--purple-glow); }
.quran-nav-surah-num  { font-size: 11px; font-weight: 700; color: var(--txt-m); min-width: 22px; text-align: right; }
.quran-nav-surah-name { font-size: 13px; font-weight: 600; color: var(--txt); flex: 1; text-align: left; }
.quran-nav-surah-ar   { font-size: 16px; color: var(--purple-l); }
.quran-nav-surah-meta { font-size: 11px; color: var(--txt-m); min-width: 26px; text-align: right; }

.quran-nav-juz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}
.quran-nav-juz-btn {
  padding: 10px 4px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--txt);
  cursor: pointer;
  text-align: center;
  transition: all .12s;
}
.quran-nav-juz-btn:hover { background: var(--purple); color: #fff; border-color: var(--purple-d); }

/* ── Info bar (above mushaf content, full-width, clickable) ──────────────────── */
.quran-info-bar {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 9px 16px;
  margin-bottom: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--txt);
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  box-sizing: border-box;
}
.quran-info-bar:hover  { border-color: var(--purple-d); background: var(--purple-glow); }
.quran-info-bar.active { background: var(--purple-glow); border-color: var(--purple-d); color: var(--purple-l); }
.quran-info-bar-arrow  { margin-left: auto; font-size: 11px; opacity: .5; }

/* ── Mic button in filter group ──────────────────────────────────────────────── */
.quran-mic-filter-btn         { color: #e8e8e8 !important; border-color: rgba(255,255,255,.18) !important; }
.quran-mic-filter-btn.active  { background: #ef4444 !important; color: #fff !important; border-color: #dc2626 !important; }
.quran-mic-filter-btn:hover   { background: rgba(239,68,68,.15) !important; border-color: rgba(239,68,68,.4) !important; color: #fff !important; }

/* ── Arabic page number inside the mushaf page (bottom center) ───────────────── */
.mushaf-page-num-inside {
  flex-shrink: 0;
  text-align: center;
  font-size: 20px;
  font-family: 'Amiri', serif;
  color: var(--txt-m);
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,.08);
  opacity: .75;
}

/* ── Special pages (Al-Fatiha / Al-Baqarah opening) ─────────────────────────── */
/* Inner decorative border — mimics the ornamental frame of Mushaf pages 1-2   */
.mushaf-page-special {
  box-shadow: 0 4px 28px rgba(0,0,0,.6),
              inset 0 0 0 5px var(--card),
              inset 0 0 0 7px rgba(139,92,246,.25),
              inset 0 0 0 9px var(--card),
              inset 0 0 0 11px rgba(139,92,246,.12);
}
/* Center each line's words horizontally on short pages */
.mushaf-page-special .mushaf-line {
  justify-content: center;
  gap: 0.35em;
}

/* ── Bottom page navigation (below mushaf page) ──────────────────────────────── */
.mushaf-page-nav-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding: 4px 0;
}

/* ── SESSION — word status colours ──────────────────────────────────────────── */

/* The engine's provisional doubt, not a verdict. It is deliberately NOT the
   same red as .qword-wrong: this state is retractable, and a mark that goes red
   and then clears teaches a reciter to distrust every mark. A dotted underline
   reads as "checking" where a fill reads as "wrong". */
.qword-uncertain {
  text-decoration: underline dotted rgba(251,191,36,.75);
  text-underline-offset: 4px;
  transition: text-decoration-color .25s;
}

.qword-skipped {
  background: rgba(239,68,68,.1) !important;
  color: #fca5a5 !important;
  opacity: 0.7;
  border-radius: 3px;
  transition: background .2s, color .2s;
}

/* ── SESSION — hidden mode word states ──────────────────────────────────────── */
.mushaf-word.practice-hint,
.qword.practice-hint {
  opacity: 0.2 !important;
  filter: blur(1px);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

@keyframes practice-reveal-flash {
  0%   { background: rgba(16,185,129,.45); }
  100% { background: transparent; }
}
.mushaf-word.practice-reveal,
.qword.practice-reveal {
  animation: practice-reveal-flash 0.5s ease forwards;
  border-radius: 3px;
}

/* ── SESSION — live overlay ──────────────────────────────────────────────────── */

.session-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  background: rgba(7,7,17,.96);
  border-top: 1px solid var(--border-light);
  backdrop-filter: blur(12px);
  padding: 10px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.session-ayah-pos {
  font-size: 12px;
  color: var(--txt-m);
  margin-left: auto;
}

.sess-c  { color: #10b981; font-weight: 700; }
.sess-w  { color: #ef4444; font-weight: 700; }
.sess-s  { color: #6b7280; font-weight: 700; }
.sess-acc { color: var(--purple-l); font-weight: 700; }

.session-transcript {
  font-size: 13px;
  color: var(--txt-m);
  font-family: 'Amiri', serif;
  direction: rtl;
  text-align: right;
  min-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-mistakes {
  font-size: 12px;
  color: var(--txt-m);
  direction: rtl;
  text-align: right;
  font-family: 'Amiri', serif;
  line-height: 1.6;
}

.session-ctrl-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--card);
  color: var(--txt-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.session-ctrl-btn:hover  { border-color: var(--purple-d); color: var(--purple-l); }
.session-ctrl-btn.active { background: var(--purple-glow); border-color: var(--purple-d); color: var(--purple-l); }
.session-ctrl-btn.stop   { border-color: rgba(239,68,68,.4); color: #fca5a5; }
.session-ctrl-btn.stop:hover { background: rgba(239,68,68,.12); }

@keyframes session-mic-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.15); }
}
.session-mic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--txt-m);
  flex-shrink: 0;
}
.session-mic-dot.listening {
  background: #ef4444;
  animation: session-mic-pulse 1.2s ease infinite;
}

/* Position confidence. A bar, not a percentage: the value updates several times
   a second and a jittering number reads as instability even when the engine is
   perfectly steady. The width transition does the smoothing. */
.session-conf {
  width: 34px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-light);
  overflow: hidden;
  flex-shrink: 0;
}
.session-conf > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  transition: width .35s ease;
}

/* Shown only while two passages are still viable. */
.session-ambiguous {
  font-size: 12px;
  font-weight: 600;
  color: #fbbf24;
}

@media (prefers-reduced-motion: reduce) {
  .session-mic-dot.listening { animation: none; }
  .session-conf > i { transition: none; }
}

/* ── SESSION — complete overlay ──────────────────────────────────────────────── */
.session-complete {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(7,7,17,.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.session-complete-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.session-complete-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--txt);
  margin-bottom: 6px;
}
.session-complete-card .sc-sub {
  font-size: 13px;
  color: var(--txt-m);
  margin-bottom: 22px;
}
.session-complete-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.session-complete-stat {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
}
.session-complete-stat .val { font-size: 22px; font-weight: 700; }
.session-complete-stat .lbl { font-size: 10px; color: var(--txt-m); margin-top: 2px; text-transform: uppercase; letter-spacing: .05em; }

/* ── SESSION — current-ayah mushaf highlight (no outline — avoids lines between words) ── */
.mushaf-word-ayah-sess {
  border-radius: 2px;
}

/* ── SESSION — per-ayah inline feedback ─────────────────────────────────────── */
.session-ayah-feedback {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 12px;
  color: var(--txt-m);
  direction: rtl;
}
.session-ayah-badge {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.session-ayah-badge.correct  { background: rgba(16,185,129,.15); color: #10b981; }
.session-ayah-badge.wrong    { background: rgba(239,68,68,.15);  color: #fca5a5; }
.session-ayah-badge.skipped  { background: rgba(107,114,128,.15); color: #9ca3af; }

/* ── SESSION — active button state ──────────────────────────────────────────── */
#session-track-btn.practice-active,
#session-hidden-btn.practice-active {
  background: rgba(16,185,129,.15) !important;
  border-color: rgba(16,185,129,.4) !important;
  color: #10b981 !important;
}

@media (max-width: 600px) {
  .session-overlay { padding: 8px 12px 10px; }
  .session-complete-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Contact page ────────────────────────────────────────────────────────────── */
.contact-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 720px) { .contact-cards-grid { grid-template-columns: 1fr; } }
.contact-option-card { text-align: center; }
.contact-option-icon { font-size: 28px; margin-bottom: 10px; }
.contact-option-title { font-size: 14px; font-weight: 700; color: var(--txt); margin-bottom: 6px; }
.contact-option-desc  { font-size: 12px; color: var(--txt-2); line-height: 1.6; }
.contact-form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 560px) { .contact-form-grid { grid-template-columns: 1fr; } }
.contact-form-field { display: flex; flex-direction: column; gap: 6px; }
.contact-form-label { font-size: 11px; font-weight: 700; color: var(--txt-m); text-transform: uppercase; letter-spacing: .05em; }
.contact-form-input {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--txt); font-size: 13px; font-family: inherit;
  transition: border-color .15s;
}
.contact-form-input:focus { outline: none; border-color: var(--purple-l); }
.contact-subject-chip {
  padding: 4px 12px; border-radius: 99px; font-size: 11px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border); color: var(--txt-2);
  cursor: pointer; transition: all .15s;
}
.contact-subject-chip:hover, .contact-subject-chip.active {
  background: var(--purple-glow); border-color: var(--purple-d); color: var(--purple-l);
}

/* ── Blog ────────────────────────────────────────────────────────────────────── */
.blog-post-card { cursor: pointer; transition: border-color .15s; }
.blog-post-card:hover { border-color: var(--border-light); }

/* ── Player steppers (full player view) ─────────────────────────────────────── */
.player-stepper {
  display: flex; align-items: center; gap: 0;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.player-step-btn {
  width: 32px; height: 32px; font-size: 16px; font-weight: 700;
  background: none; border: none; color: var(--txt-m); cursor: pointer;
  transition: background .1s, color .1s; flex-shrink: 0;
}
.player-step-btn:hover { background: var(--border); color: var(--txt); }
.player-step-val {
  font-size: 13px; color: var(--txt); padding: 0 10px;
  min-width: 68px; text-align: center; white-space: nowrap;
}
.player-range-track {
  height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; position: relative;
}
.player-range-fill {
  height: 100%; background: linear-gradient(90deg, var(--purple-d), var(--purple-l));
  border-radius: 99px; position: absolute; top: 0;
}
.player-preset-btn {
  padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border); color: var(--txt-m);
  cursor: pointer; transition: all .15s;
}
.player-preset-btn:hover { background: var(--border); color: var(--txt); }

/* ── Mini steppers (bottom player bar) ──────────────────────────────────────── */
.qp-mini-stepper {
  display: flex; align-items: center; gap: 0;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.qp-mini-stepper button {
  width: 22px; height: 22px; font-size: 13px; font-weight: 700;
  background: none; border: none; color: var(--txt-m); cursor: pointer;
  transition: background .1s;
}
.qp-mini-stepper button:hover { background: var(--border); color: var(--txt); }
.qp-mini-stepper span {
  font-size: 11px; font-weight: 600; color: var(--txt);
  min-width: 36px; text-align: center; padding: 0 2px;
}

/* ── Design System — Gold accent ─────────────────────────────────────────────── */
:root {
  --gold:          #D4AF37;
  --gold-dim:      rgba(212,175,55,.14);
  --green-primary: #1B4332;
}
.light-mode {
  --gold: #B8942A;
}

/* ── Quiz Overlay ────────────────────────────────────────────────────────────── */
#quiz-overlay {
  background: var(--bg);
}
.quiz-card {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--border-light);
  padding: 36px 32px;
  max-width: 540px;
  width: 100%;
  animation: fadeUp .35s ease;
}
.quiz-progress-track {
  height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 28px;
}
.quiz-progress-fill {
  height: 4px; background: linear-gradient(90deg,#D4AF37,#F59E0B);
  border-radius: 2px; transition: width .4s ease;
}
.quiz-logo {
  text-align: center; margin-bottom: 20px;
}
.quiz-title {
  font-size: 24px; font-weight: 800; color: var(--txt); margin-bottom: 10px; line-height: 1.3;
}
.quiz-sub {
  font-size: 14px; color: var(--txt-m); line-height: 1.6; margin-bottom: 28px;
}
.quiz-q {
  font-size: 20px; font-weight: 700; color: var(--txt); margin-bottom: 16px; line-height: 1.3;
}
.quiz-opt {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--bg); color: var(--txt); text-align: left; cursor: pointer;
  margin-bottom: 10px; transition: border-color .2s, background .2s;
}
.quiz-opt:hover { border-color: var(--border-light); background: var(--card-hover); }
.quiz-opt.selected { border-color: #D4AF37; background: rgba(212,175,55,.08); }
.quiz-opt-icon { font-size: 24px; flex-shrink: 0; }
.quiz-opt-label { font-size: 15px; font-weight: 600; }
.quiz-opt-sub { font-size: 12px; color: var(--txt-m); margin-top: 2px; }
.quiz-opt-check { margin-left: auto; font-size: 14px; color: #D4AF37; font-weight: 800; flex-shrink: 0; }
.quiz-nav { display: flex; gap: 10px; margin-top: 20px; }
.quiz-back {
  padding: 12px 20px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--txt-m); font-size: 14px; cursor: pointer;
  transition: background .2s;
}
.quiz-back:hover { background: var(--card-hover); }
.quiz-cta {
  flex: 1; padding: 14px 24px; border-radius: 12px;
  background: linear-gradient(135deg,#D4AF37,#F59E0B);
  color: #1A1A1A; font-weight: 800; font-size: 16px; border: none; cursor: pointer;
  transition: opacity .2s, transform .1s;
}
.quiz-cta:hover { opacity: .92; transform: translateY(-1px); }
.quiz-cta:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.quiz-foot { text-align: center; font-size: 13px; color: var(--txt-m); margin-top: 16px; }
.quiz-result-icon { font-size: 48px; text-align: center; margin-bottom: 12px; }
.quiz-plan-card {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: 14px; padding: 18px 20px; margin-bottom: 24px;
}
.quiz-plan-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.quiz-plan-row:last-child { border-bottom: none; }
.quiz-plan-key { font-size: 13px; color: var(--txt-m); }
.quiz-plan-val { font-size: 13px; font-weight: 700; color: var(--txt); text-align: right; }

/* ── Upgrade / Paywall Page ──────────────────────────────────────────────────── */
.upgrade-page { max-width: 700px; margin: 0 auto; }
.upgrade-plans-row {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 14px;
  margin-bottom: 28px;
}
@media (max-width: 600px) { .upgrade-plans-row { grid-template-columns: 1fr; } }
.upgrade-plan-card {
  background: var(--card); border: 2px solid var(--border); border-radius: 16px;
  padding: 20px; text-align: center; cursor: pointer; position: relative;
  transition: border-color .2s, transform .15s;
}
.upgrade-plan-card:hover { transform: translateY(-2px); }
.upgrade-plan-card.selected { border-color: #D4AF37; background: rgba(212,175,55,.06); }
.upgrade-plan-badge {
  display: inline-block; font-size: 11px; font-weight: 800;
  padding: 3px 10px; border-radius: 20px;
  background: linear-gradient(135deg,#D4AF37,#F59E0B); color: #1A1A1A;
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em;
}
.upgrade-plan-name { font-size: 13px; color: var(--txt-m); margin-bottom: 6px; font-weight: 600; }
.upgrade-plan-price { font-size: 32px; font-weight: 900; color: var(--txt); line-height: 1; }
.upgrade-plan-sub { font-size: 12px; color: var(--txt-m); margin-top: 4px; }
.upgrade-plan-note { font-size: 11px; color: #D4AF37; margin-top: 6px; font-weight: 600; }
.upgrade-social-proof {
  text-align: center; margin: 28px 0;
  padding: 28px; background: var(--card); border-radius: 16px; border: 1px solid var(--border);
}
.upgrade-stars { font-size: 15px; margin-bottom: 20px; }
.upgrade-testimonials { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 12px; }
.upgrade-testimonial {
  background: var(--bg); border-radius: 12px; padding: 14px;
  text-align: left; border: 1px solid var(--border);
}
.upgrade-testimonial-text { font-size: 12px; color: var(--txt); line-height: 1.5; margin-bottom: 8px; }
.upgrade-testimonial-name { font-size: 11px; color: var(--txt-m); font-weight: 600; }
.upgrade-promo-row { text-align: center; margin-top: 12px; }
.upgrade-banner {
  background: linear-gradient(135deg,rgba(26,67,50,.9),rgba(26,67,50,.6));
  border-bottom: 1px solid rgba(212,175,55,.3);
  padding: 10px 24px; font-size: 13px; color: rgba(255,255,255,.85);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

/* ── Quiz Welcome Card ───────────────────────────────────────────────────────── */
.quiz-welcome-card {
  background: linear-gradient(135deg,rgba(212,175,55,.1),rgba(212,175,55,.05));
  border: 1px solid rgba(212,175,55,.3); border-radius: 14px;
  padding: 16px 20px; margin-bottom: 16px;
}

/* ── XP Toast ────────────────────────────────────────────────────────────────── */
.xp-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg,#D4AF37,#F59E0B);
  color: #1A1A1A; font-weight: 800; font-size: 15px;
  padding: 10px 20px; border-radius: 24px; z-index: 9998;
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
  white-space: nowrap;
}
.xp-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Badge Toast ─────────────────────────────────────────────────────────────── */
.badge-toast {
  position: fixed; bottom: 80px; right: 20px;
  background: var(--card); border: 1px solid var(--border-light); border-radius: 14px;
  padding: 14px 18px; z-index: 9998; display: flex; align-items: center; gap: 12px;
  opacity: 0; transform: translateX(40px); transition: opacity .3s, transform .3s;
  pointer-events: none; max-width: 280px; box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.badge-toast-show { opacity: 1; transform: translateX(0); }
.badge-toast-icon { font-size: 28px; flex-shrink: 0; }
.badge-toast-title { font-size: 13px; font-weight: 800; color: var(--txt); }
.badge-toast-sub { font-size: 12px; color: var(--txt-m); margin-top: 2px; }

/* ── Share Card ──────────────────────────────────────────────────────────────── */
.share-card-visual {
  background: #1B4332; border-radius: 16px; overflow: hidden;
  position: relative; min-height: 200px; padding: 32px;
}
.share-card-pattern { position: absolute; inset: 0; pointer-events: none; }
.share-card-inner { position: relative; z-index: 1; }

/* ── Leaderboard weekly row value ───────────────────────────────────────────── */
.lb-streak-val { font-size: 16px; font-weight: 800; }
.lb-streak-lab { font-size: 10px; color: var(--txt-m); }

/* ── Mobile / App Layout ─────────────────────────────────────────────────────── */

/* Touch feel */
* { -webkit-tap-highlight-color: transparent; }
button, .nav-item, .juz-cell, .rating-btn { touch-action: manipulation; }
.mushaf-word { cursor: pointer; user-select: none; }

@media (max-width: 768px) {
  /* Sidebar collapses to icon-only strip */
  :root { --sidebar-w: 64px; }

  #sidebar { overflow: hidden; transition: width .25s ease; }

  .sidebar-logo { justify-content: center; padding: 16px 0 12px; }
  .logo-text, .logo-sub { display: none; }
  .logo-icon-img { margin: 0; }

  .sidebar-nav .nav-item { justify-content: center; padding: 12px 0; }
  .sidebar-nav .nav-item span:last-child { display: none; }
  .sidebar-nav .nav-dot { display: none; }

  .sidebar-user { justify-content: center; padding: 12px 0; }
  .user-name, .user-sub { display: none; }
  .user-avatar { margin: 0; }

  /* Show hamburger in sidebar logo area */
  .sidebar-hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
    color: var(--txt-m); font-size: 18px; background: none; border: none;
    margin: 0 auto 8px;
  }

  /* Open state */
  #sidebar.mobile-open { width: 256px; z-index: 200; box-shadow: 4px 0 24px rgba(0,0,0,.4); }
  #sidebar.mobile-open .logo-text,
  #sidebar.mobile-open .logo-sub     { display: block; }
  #sidebar.mobile-open .sidebar-logo { justify-content: flex-start; padding: 24px 20px 16px; }
  #sidebar.mobile-open .nav-item     { justify-content: flex-start; padding: 12px 16px; }
  #sidebar.mobile-open .nav-item span:last-child { display: block; }
  #sidebar.mobile-open .sidebar-user { justify-content: flex-start; padding: 12px 16px; }
  #sidebar.mobile-open .user-name,
  #sidebar.mobile-open .user-sub     { display: block; }
  #sidebar.mobile-open .sidebar-hamburger { display: none; }

  /* Backdrop overlay when sidebar open */
  #sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 150;
    background: rgba(0,0,0,.5);
  }
  #sidebar-backdrop.visible { display: block; }

  /* Page content */
  .page { padding: 1.25rem 1rem; }
  .page-ai { padding: 1rem; }

  /* Grids collapse to single column */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  /* Juz grid: 6 columns on mobile (still fits 30 in 5 rows) */
  .juz-grid { grid-template-columns: repeat(6, 1fr); gap: 4px; }

  /* Mushaf page: auto height on mobile */
  .mushaf-page { max-width: 100%; height: auto !important; min-height: unset; padding: 4% 3%; }

  /* Settings panel full-width safe */
  .settings-panel { width: min(320px, 92vw) !important; }

  /* Chat */
  .chat-bubble { max-width: 88%; }

  /* Page header flex wrap */
  .page-header { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 480px) {
  .juz-grid { grid-template-columns: repeat(5, 1fr); gap: 3px; }
  .page { padding: 1rem 0.75rem; }
}

