[hidden] { display: none !important; }
:root {
  --bg: #f6f3ea;
  --paper: #fffdf7;
  --ink: #1d2320;
  --muted: #7b817d;
  --line: #e6e0cf;
  --brand: #F26A0F;
  --brand-2: #FF9A3D;
  --gold: #C9761A;
  --ok: #1d2320;
  --bad: #d23b3b;
  --bad-bg: #fde8e8;
  --miss: #8a4fd0;
  --miss-bg: #f1e8fb;
  --fix: #c77d12;
  --fix-bg: #fdf1dc;
  --cur-bg: #FFEBDD;
  --hidden: #e4decb;
  --peek: #8b5a2b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111615; --paper: #182120; --ink: #eef1ec; --muted: #93a09a; --line: #26322f;
    --brand: #FF8A33; --brand-2: #FFA866; --gold: #FFB45A; --ok: #eef1ec;
    --bad: #ff6b6b; --bad-bg: #3a1d1f; --miss: #c39bff; --miss-bg: #2c2140;
    --fix: #f2b04b; --fix-bg: #3a2c14; --cur-bg: #3D2414; --hidden: #2a3532; --peek: #d59b62;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: Tajawal, system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
button { font: inherit; cursor: pointer; }
.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }

/* الاختيار */
#setup { padding: 24px 16px; max-width: 520px; margin: 0 auto; gap: 18px; }
.brand { text-align: center; margin-top: 4vh; }
.brand .logo {
  width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 22px;
  background: linear-gradient(145deg, var(--brand), var(--brand-2)); color: #fff;
  display: block;
  box-shadow: 0 10px 30px -12px var(--brand);
}
.brand h1 { margin: 0; font-size: 30px; }
.brand p { margin: 6px 0 0; color: var(--muted); }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 20px;
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 14px; color: var(--muted); }
select, input {
  font: inherit; font-size: 17px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%;
}
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.seg { display: flex; background: var(--bg); border-radius: 14px; padding: 4px; gap: 4px; }
.seg-btn {
  flex: 1; border: 0; background: transparent; color: var(--muted); padding: 10px 6px;
  border-radius: 11px; font-weight: 700; display: flex; flex-direction: column; gap: 2px;
}
.seg-btn small { font-weight: 400; font-size: 12px; }
.seg-btn.active { background: var(--paper); color: var(--brand); box-shadow: 0 1px 4px rgb(0 0 0 / .08); }
.primary {
  border: 0; border-radius: 14px; padding: 15px; font-size: 18px; font-weight: 700;
  background: var(--brand); color: #fff;
}
.primary:active { transform: scale(.98); }
.ghost { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 14px; padding: 15px; }
.hint-install { text-align: center; color: var(--muted); font-size: 13px; }

/* التسميع */
.topbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2;
}
.topbar .title { flex: 1; text-align: center; display: flex; flex-direction: column; }
.topbar .title span { font-size: 12px; color: var(--muted); }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 0; background: var(--bg); color: var(--ink); font-size: 18px; }
.bar { height: 3px; background: var(--line); }
.bar div { height: 100%; width: 0; background: var(--brand); transition: width .3s; }

.mushaf {
  flex: 1; overflow-y: auto; padding: 22px 18px 200px;
  font-family: 'Amiri Quran', serif; font-size: clamp(24px, 6.4vw, 34px);
  line-height: 2.35; text-align: justify; text-align-last: center;
  max-width: 760px; width: 100%; margin: 0 auto;
}
.basmala { text-align: center; color: var(--brand); margin-bottom: 6px; }
.w { border-radius: 8px; padding: 0 2px; transition: background .2s, color .2s; cursor: pointer; }
.w.optional { color: var(--brand); }
.aya-num {
  font-size: .7em; color: var(--gold); margin: 0 4px; white-space: nowrap;
}
.w.cur { background: linear-gradient(var(--cur-bg), var(--cur-bg)) center / 100% 1.1em no-repeat; }
.w.correct { color: var(--ok); }
.w.wrong { color: var(--bad); background: linear-gradient(var(--bad-bg), var(--bad-bg)) center / 100% 1.1em no-repeat; text-decoration: underline dotted; text-underline-offset: 8px; }
.w.missed { color: var(--miss); background: linear-gradient(var(--miss-bg), var(--miss-bg)) center / 100% 1.1em no-repeat; text-decoration: underline dashed; text-underline-offset: 8px; }
.w.corrected { color: var(--fix); background: linear-gradient(var(--fix-bg), var(--fix-bg)) center / 100% 1.1em no-repeat; }
.w.peek { color: var(--peek); }
.w.next { box-shadow: inset 0 -3px 0 var(--brand); }

/* وضع الحفظ: الكلمات اللي ما انقرأت مخفية */
.mushaf.hidden .w:not(.correct):not(.wrong):not(.missed):not(.corrected):not(.peek):not(.skipped) {
  color: transparent; text-shadow: none;
  background: linear-gradient(var(--hidden), var(--hidden)) center / 100% .95em no-repeat;
}
.mushaf.hidden .w.cur { color: var(--muted); background: linear-gradient(var(--cur-bg), var(--cur-bg)) center / 100% .95em no-repeat; }

.controls {
  position: fixed; inset: auto 0 0 0; background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 20px 16px calc(14px + env(safe-area-inset-bottom)); text-align: center;
}
.status { color: var(--muted); font-size: 14px; min-height: 20px; margin-bottom: 10px; }
.buttons { display: flex; align-items: center; justify-content: center; gap: 22px; }
.side-btn {
  width: 72px; height: 44px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-weight: 500;
}
.mic {
  width: 78px; height: 78px; border-radius: 50%; border: 0; background: var(--brand);
  display: grid; place-items: center; box-shadow: 0 10px 28px -10px var(--brand); position: relative;
}
.mic span {
  width: 22px; height: 34px; border-radius: 11px; background: #fff; position: relative;
}
.mic span::after {
  content: ''; position: absolute; left: 50%; bottom: -12px; width: 30px; height: 16px;
  transform: translateX(-50%); border: 3px solid #fff; border-top: 0; border-radius: 0 0 18px 18px;
}
.mic.on { background: var(--bad); box-shadow: 0 10px 28px -10px var(--bad); }
.mic.on span { width: 26px; height: 26px; border-radius: 6px; }
.mic.on span::after { display: none; }
.mic.on::before {
  content: ''; position: absolute; inset: -8px; border-radius: 50%;
  border: 3px solid var(--bad); opacity: .5; animation: pulse 1.4s infinite;
}
@keyframes pulse { from { transform: scale(.9); opacity: .6 } to { transform: scale(1.25); opacity: 0 } }
.heard { margin-top: 8px; font-size: 13px; color: var(--muted); min-height: 18px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* النتيجة */
.modal { position: fixed; inset: 0; background: rgb(0 0 0 / .45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.modal[hidden] { display: none; }
.sheet {
  background: var(--paper); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow-y: auto;
}
.sheet h2 { margin: 0 0 8px; text-align: center; }
.score { text-align: center; margin: 10px 0 16px; }
.score span { display: block; font-size: 52px; font-weight: 700; color: var(--brand); }
.score small { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.s { background: var(--bg); border-radius: 14px; padding: 10px 4px; text-align: center; font-size: 13px; color: var(--muted); }
.s b { display: block; font-size: 22px; color: var(--ink); }
.s.bad b { color: var(--bad); } .s.miss b { color: var(--miss); } .s.fix b { color: var(--fix); }
.mistakes { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.mistakes li { display: flex; justify-content: space-between; align-items: center; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.mistakes .q { font-family: 'Amiri Quran', serif; font-size: 22px; }
.mistakes .meta { font-size: 12px; color: var(--muted); text-align: left; }

/* ===== الرئيسية: تبويبات ===== */
#home { padding: 0; }
.home-body { flex: 1; padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 560px; width: 100%; margin: 0 auto; }
.tab-page { display: none; flex-direction: column; gap: 16px; }
.tab-page.active { display: flex; }
.tabs {
  position: fixed; inset: auto 0 0 0; display: flex; justify-content: space-around;
  background: var(--paper); border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); z-index: 5;
}
.tab {
  flex: 1; max-width: 140px; border: 0; background: none; color: var(--muted); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; padding: 4px;
}
.tab span { font-size: 20px; filter: grayscale(1); opacity: .7; }
.tab.active { color: var(--brand); font-weight: 700; }
.tab.active span { filter: none; opacity: 1; }
.tab i {
  position: absolute; top: 0; left: 50%; margin-left: 6px; background: var(--bad); color: #fff;
  font-style: normal; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  display: grid; place-items: center;
}
.tab i[hidden] { display: none; }
.card h3 { margin: 0; font-size: 15px; }
.page-title { margin: 8px 0 0; font-size: 26px; }
.page-sub { margin: -8px 0 0; color: var(--muted); font-size: 14px; }
.sec { margin: 8px 0 0; font-size: 15px; color: var(--muted); }

.hero {
  display: flex; align-items: center; gap: 14px; text-align: right; border: 0; color: #fff;
  padding: 18px; border-radius: 20px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 14px 30px -16px var(--brand);
}
.hero:active { transform: scale(.985); }
.hero-text { display: flex; flex-direction: column; gap: 4px; }
.hero-text b { font-size: 19px; }
.hero-text small { opacity: .85; font-size: 13px; line-height: 1.5; }
.hero-mic {
  flex: none; width: 54px; height: 54px; border-radius: 50%; background: rgb(255 255 255 / .18); position: relative;
}
.hero-mic::before {
  content: ''; position: absolute; left: 50%; top: 13px; width: 14px; height: 20px; margin-left: -7px;
  border-radius: 7px; background: #fff;
}
.hero-mic::after {
  content: ''; position: absolute; left: 50%; top: 24px; width: 22px; height: 12px; margin-left: -11px;
  border: 2.5px solid #fff; border-top: 0; border-radius: 0 0 12px 12px;
}

.streak {
  display: flex; align-items: center; gap: 10px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px 14px; font-size: 14px;
}
.streak[hidden] { display: none; }
.streak .flame { font-size: 24px; }
.streak b { font-size: 20px; }
.streak .today { margin-inline-start: auto; color: var(--muted); font-size: 13px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px;
  text-align: center; font-size: 12px; color: var(--muted);
}
.mini b { display: block; font-size: 22px; color: var(--ink); }
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: right; width: 100%;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--ink);
}
.item div { display: flex; flex-direction: column; gap: 3px; }
.item small { color: var(--muted); font-size: 12px; }
.pill { flex: none; font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--cur-bg); color: var(--brand); font-weight: 700; }
.pill.hot { background: var(--bad-bg); color: var(--bad); }
.pill.good { background: var(--cur-bg); color: var(--brand); }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; font-size: 14px; background: var(--paper); border: 1px dashed var(--line); border-radius: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: flex; flex-direction: column; align-items: center; background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 6px 12px; color: var(--ink);
}
.chip .q { font-family: 'Amiri Quran', serif; font-size: 22px; line-height: 1.8; }
.chip small { color: var(--muted); font-size: 11px; }
.link-btn { background: none; border: 0; color: var(--bad); font-size: 13px; margin-top: 8px; }
.review-note { text-align: center; color: var(--brand); font-size: 13px; margin: -6px 0 14px; }
.review-note:empty { display: none; }
.w.skipped { opacity: .4; }

/* ===== البحث عن المكان ===== */
.searching {
  position: fixed; inset: 110px 0 200px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; text-align: center; color: var(--muted); pointer-events: none;
}
.searching[hidden] { display: none; }
.searching p { margin: 18px 0 0; font-size: 18px; color: var(--ink); font-weight: 700; }
.radar { position: relative; width: 120px; height: 120px; }
.radar span {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--brand); opacity: 0;
  animation: radar 2.4s infinite;
}
.radar span:nth-child(2) { animation-delay: .8s; }
.radar span:nth-child(3) { animation-delay: 1.6s; }
@keyframes radar { from { transform: scale(.2); opacity: .9 } to { transform: scale(1); opacity: 0 } }

/* ===== مفتاح التجويد ===== */
.switch { flex-direction: row; align-items: center; gap: 12px; color: var(--ink); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; padding: 0; margin: 0; }
.switch > span {
  flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; transition: background .2s;
}
.switch > span::after {
  content: ''; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s;
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(-18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch div { display: flex; flex-direction: column; gap: 2px; }
.switch b { font-size: 15px; }
.switch small { color: var(--muted); font-weight: 400; font-size: 12px; line-height: 1.5; }

/* ===== عناوين السور وحالات الكلمات الإضافية ===== */
.surah-head {
  display: flex; flex-direction: column; align-items: center; gap: 0; margin: 10px 0 6px; padding: 6px 12px;
  border: 1.5px solid var(--gold); border-radius: 14px; color: var(--brand);
  background: linear-gradient(90deg, transparent, var(--cur-bg), transparent);
  line-height: 1.6; text-align: center;
}
.surah-head span { font-size: .8em; }
.surah-head small { font-family: Tajawal, sans-serif; font-size: 12px; color: var(--muted); }
.w.tj { text-decoration: underline wavy #2f7de1; text-decoration-thickness: 1.5px; text-underline-offset: 10px; }
.w.playing { background: linear-gradient(rgb(176 138 62 / .22), rgb(176 138 62 / .22)) center / 100% 1.1em no-repeat; }

/* ===== المصحف بالصفحات ===== */
.mushaf-bar { display: flex; gap: 8px; }
.mushaf-bar select { flex: 1; }
.mushaf-bar input { width: 86px; text-align: center; }
.page-view {
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 14px 14px 10px;
  box-shadow: inset 0 0 0 5px var(--bg), inset 0 0 0 6px var(--gold);
  min-height: 60dvh; touch-action: pan-y;
}
.page-head {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--muted);
  padding: 4px 8px 8px; border-bottom: 1px solid var(--line);
}
.page-body {
  font-family: 'Amiri Quran', serif; font-size: clamp(21px, 5.6vw, 30px); line-height: 2.25;
  text-align: justify; text-align-last: center; padding: 8px 4px;
}
.page-num { text-align: center; color: var(--gold); font-size: 14px; padding-top: 6px; }
.page-nav { display: flex; align-items: center; gap: 8px; }
.page-nav .small { flex: 1; padding: 12px 8px; font-size: 15px; }
.nav-btn {
  width: 46px; height: 46px; flex: none; border-radius: 14px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 26px; line-height: 1;
}

/* ===== مشغّل التلاوة ===== */
.player-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 8;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 18px;
  background: var(--paper); border: 1px solid var(--line); box-shadow: 0 12px 30px -12px rgb(0 0 0 / .35);
  max-width: 560px; margin: 0 auto;
}
.player-bar[hidden] { display: none; }
#recite.active ~ .player-bar { bottom: calc(190px + env(safe-area-inset-bottom)); }
.p-btn { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 16px; }
#pStop { background: var(--bg); color: var(--ink); }
.p-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.p-info b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-opts { display: flex; gap: 6px; }
.p-opts select { padding: 6px 8px; font-size: 13px; border-radius: 10px; }

/* ===== نافذة ملاحظات التجويد ===== */
.small-sheet { text-align: center; }
.q.big { font-family: 'Amiri Quran', serif; font-size: 40px; line-height: 2; color: #2f7de1; }
.notes { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; text-align: right; }
.notes li { background: var(--bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.notes span { color: var(--muted); font-size: 14px; }
.small-sheet .ghost { width: 100%; }
.page-nav .small { white-space: nowrap; }
body:has(.player-bar:not([hidden])) .home-body { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
body:has(.player-bar:not([hidden])) .mushaf { padding-bottom: 320px; }

/* ===== المتشابهات ===== */
.sim-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.sim-ayah small { color: var(--muted); font-size: 12px; }
.sim-ayah p { margin: 2px 0 0; font-family: 'Amiri Quran', serif; font-size: 21px; line-height: 2.1; }
.sim-ayah + .sim-ayah { border-top: 1px dashed var(--line); padding-top: 6px; }
.sim-ayah mark { background: linear-gradient(rgb(176 138 62 / .28), rgb(176 138 62 / .28)) center / 100% 1.05em no-repeat; color: inherit; border-radius: 6px; padding: 0 2px; }
.sim-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sim-foot .small { padding: 10px 14px; font-size: 14px; }
#simSurah { margin-top: -4px; }
.remind { gap: 10px; }
.row-label { flex-direction: row; align-items: center; justify-content: space-between; }
.row-label select { width: auto; min-width: 150px; }
.sim-ayah p { overflow-wrap: anywhere; }

/* ===== الحساب والحلقات ===== */
.card.center { text-align: center; align-items: stretch; }
.card.center p { margin: 0; color: var(--muted); line-height: 1.7; }
.card small, .account small { color: var(--muted); font-size: 13px; line-height: 1.6; }
.msg { color: var(--brand); font-size: 13px; min-height: 18px; }
.error { color: var(--bad); font-size: 14px; min-height: 20px; margin: 0; }
.account { gap: 10px; }
.acc-row { display: flex; align-items: center; gap: 12px; }
.acc-row div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.avatar {
  flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-size: 20px; font-weight: 700;
}
.row .small, .card .small { padding: 11px 14px; font-size: 15px; flex: none; }
.row input { min-width: 0; }
.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 2px; direction: ltr; unicode-bidi: isolate; color: var(--brand); font-weight: 700; }
.item.static { cursor: default; }
.item.assign.done { opacity: .75; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dash-head h3 { margin: 0; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
table.dash { width: 100%; border-collapse: collapse; font-size: 13px; }
table.dash th, table.dash td { padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.dash th { color: var(--muted); font-weight: 500; font-size: 12px; }
table.dash td:first-child, table.dash th:first-child { text-align: right; }
table.dash tbody tr { cursor: pointer; }
table.dash tbody tr:hover { background: var(--bg); }
table.dash td.good { color: var(--brand); font-weight: 700; }
table.dash td.bad { color: var(--bad); }
.assign-form { gap: 10px; }
.student h4 { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
#teacherDash, #studentDetail { display: flex; flex-direction: column; gap: 12px; }
#authForm { display: flex; flex-direction: column; gap: 12px; }
[data-only][hidden] { display: none !important; }
.brand h1 .latin { display: block; font-size: 15px; font-weight: 500; letter-spacing: 3px; color: var(--muted); direction: ltr; }

/* ===== شريط تنبيه الأخطاء ===== */
.alert-banner {
  position: fixed; top: calc(88px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 20;
  max-width: 560px; margin: 0 auto; padding: 12px 16px; border-radius: 14px;
  font-weight: 700; font-size: 16px; text-align: center; color: #fff;
  box-shadow: 0 12px 28px -12px rgb(0 0 0 / .45);
  transform: translateY(-140%); opacity: 0; transition: transform .25s ease, opacity .25s ease; pointer-events: none;
}
.alert-banner.show { transform: none; opacity: 1; }
.alert-banner.wrong { background: #d23b3b; }
.alert-banner.missed { background: #7d44c4; }
.alert-banner.ayah { background: #b3261e; font-size: 17px; animation: shake .45s ease 1; }
.alert-banner.letter { background: #2f6fd1; }
@keyframes shake { 0%, 100% { translate: 0 } 25% { translate: -6px 0 } 75% { translate: 6px 0 } }
@media (prefers-reduced-motion: reduce) { .alert-banner { transition: none; } .alert-banner.ayah { animation: none; } }

/* ===== شاشة مصحف المدينة ===== */
.tab-page[data-page="mushaf"] { gap: 8px; margin: -20px -16px 0; }
.mp-head {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.mp-icon {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 12px; background: transparent;
  color: var(--ink); font-size: 22px; line-height: 1;
}
.mp-icon.bm::before { content: '🔖'; filter: grayscale(1); opacity: .45; }
.mp-icon.bm.on::before { filter: none; opacity: 1; }
.mp-title {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 4px 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.mp-title b { font-family: 'Amiri Quran', serif; font-size: 17px; font-weight: 400; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-title small { font-size: 11px; color: var(--muted); }

.qpc-page {
  --qsize: 24px; --qline: calc(var(--qsize) * 1.95);
  padding: 6px 8px 150px; font-size: var(--qsize); color: var(--ink); touch-action: pan-y;
  min-height: calc(var(--qline) * 15); transition: opacity .15s;
}
.qpc-page.loading { opacity: .35; }
.qpc-line { height: var(--qline); display: flex; align-items: center; justify-content: space-between; white-space: nowrap; }
.qpc-page.centered .qpc-line { justify-content: center; gap: .18em; }
.qpc-page.measuring .qpc-line.ayat { justify-content: flex-start; }
.qpc-line span { line-height: 1; border-radius: 6px; }
.qpc-line .end { color: var(--gold); }
.qpc-line.basmala { justify-content: center; gap: .35em; font-family: 'Amiri Quran', serif; font-size: .9em; color: var(--brand); }
.qpc-line.header { justify-content: center; padding: 3px 0; }
.sh-frame {
  width: 100%; height: 86%; display: grid; place-items: center; border-radius: 10px;
  border: 1.5px solid var(--gold); color: var(--brand); font-family: 'Amiri Quran', serif; font-size: .82em;
  background: linear-gradient(90deg, transparent, var(--cur-bg), transparent);
}
.qpc-page .w { padding: 0; transition: background .2s, color .2s; cursor: pointer; }
.qpc-page .w.cur { background: var(--cur-bg); }
.qpc-page .w.wrong { color: var(--bad); background: var(--bad-bg); }
.qpc-page .w.missed { color: var(--miss); background: var(--miss-bg); }
.qpc-page .w.corrected { color: var(--fix); background: var(--fix-bg); }
.qpc-page .w.tj { box-shadow: inset 0 -3px 0 #2f7de1; }
.qpc-page .w.hist { box-shadow: inset 0 -3px 0 var(--bad); }
.qpc-page .w.playing { background: rgb(176 138 62 / .22); }
/* الاختبار: الكلمات مخفية لحد ما تنقرأ */
.qpc-page.hidden .w:not(.correct):not(.wrong):not(.missed):not(.corrected):not(.peek) { color: transparent; background: var(--hidden); }
.qpc-page.hidden .w.cur { background: var(--cur-bg); }
.qpc-page.hidden .w.peek { color: var(--peek); }

.mp-nav { position: fixed; bottom: calc(150px + env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 6px; pointer-events: none; z-index: 3; }
.mp-nav .nav-btn { pointer-events: auto; opacity: .55; width: 34px; height: 54px; font-size: 24px; }
body.recording .mp-nav { display: none; }

.mp-status {
  position: fixed; left: 16px; right: 110px; bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 6;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
  font-size: 14px; box-shadow: 0 10px 24px -14px rgb(0 0 0 / .4);
}
body:not(.recording) .mp-status { display: none; }

.mp-chips { position: fixed; left: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); display: flex; gap: 8px; z-index: 6; }
.chip-btn {
  height: 44px; min-width: 52px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 15px; box-shadow: 0 6px 16px -10px rgb(0 0 0 / .4);
}
.chip-btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.mp-fab { position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 7; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.fab {
  width: 64px; height: 64px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand-2), var(--brand)); box-shadow: 0 12px 28px -10px var(--brand);
}
.fab-mic { width: 18px; height: 28px; border-radius: 9px; background: #fff; position: relative; }
.fab-mic::after { content: ''; position: absolute; left: 50%; bottom: -10px; width: 26px; height: 14px; transform: translateX(-50%); border: 3px solid #fff; border-top: 0; border-radius: 0 0 16px 16px; }
.mp-fab.open .fab-mic, body.recording .fab-mic { width: 22px; height: 22px; border-radius: 5px; }
.mp-fab.open .fab-mic::after, body.recording .fab-mic::after { display: none; }
.mp-fab.open .fab { background: var(--ink); }
body.recording .fab { background: var(--bad); box-shadow: 0 12px 28px -10px var(--bad); animation: pulse-fab 1.4s infinite; }
@keyframes pulse-fab { 50% { box-shadow: 0 0 0 10px rgb(210 59 59 / .15); } }
.mp-menu { display: flex; flex-direction: column; gap: 10px; background: var(--paper); padding: 10px; border-radius: 22px; box-shadow: 0 18px 40px -18px rgb(0 0 0 / .5); }
.mp-menu button { display: flex; align-items: center; gap: 12px; border: 0; background: none; color: var(--ink); font-size: 16px; font-weight: 700; padding: 0; }
.mp-menu i { font-style: normal; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-size: 22px; }
.mp-filter { margin: 8px 0; }
.settings { display: flex; flex-direction: column; gap: 14px; }
.settings h2 { margin: 0; }
/* صفحة المصحف دايماً بلون الورق (خط التجويد لونه ثابت أسود) */
.qpc-page {
  --ink: #1b1f1d; --ok: #1b1f1d; --gold: #a57b2c; --brand: #F26A0F; --cur-bg: #d9efe6; --hidden: #e7e0cc; --peek: #8b5a2b;
  --bad: #c62828; --bad-bg: #fde3e3; --miss: #7b3fc4; --miss-bg: #efe4fb; --fix: #b86e0c; --fix-bg: #fcefd8;
  background: #fffdf5; color: var(--ink); border-radius: 0 0 18px 18px;
}
@media (prefers-color-scheme: dark) {
  .tab-page[data-page="mushaf"] { background: #fffdf5; }
  .qpc-page { box-shadow: 0 0 0 100vmax #fffdf5; clip-path: inset(0 -100vmax); }
}
@media (pointer: coarse) { .mp-nav { display: none; } }
.qpc-page { padding-bottom: 170px; }

/* ===== شاشة المصحف: كاملة الشاشة، هادية وواضحة (فاتحة دايماً) ===== */
body.mushaf-mode .tabs { display: none; }
body.mushaf-mode .home-body { padding-bottom: 0; }
body.mushaf-mode { background: #ffffff; }
.tab-page[data-page="mushaf"] { background: #ffffff; min-height: 100dvh; color: #1a1a1a; }
.mp-head {
  background: #f6f6f4; border-bottom: 1px solid #e8e8e4; color: #1a1a1a;
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px;
}
.mp-icon { color: #2b2b2b; font-size: 21px; }
.mp-title { background: #ffffff; border-color: #e3e3de; text-align: right; }
.mp-title b { color: #1a1a1a; }
.mp-title small { color: #6f6f6a; }
.burger span, .burger span::before, .burger span::after {
  display: block; width: 22px; height: 2.5px; border-radius: 2px; background: #2b2b2b; position: relative; margin: auto;
}
.burger span::before, .burger span::after { content: ''; position: absolute; left: 0; }
.burger span::before { top: -7px; } .burger span::after { top: 7px; }

/* الصفحة: حبر أسود صافي على أبيض، وخط أكبر بأسطر أقرب (زي الطبعة الورقية) */
.qpc-page {
  --ink: #000000; --ok: #000000; --gold: #8a6a1f;
  --qline: calc(var(--qsize) * 1.72);
  background: #ffffff; color: #000000;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision; font-synthesis: none; font-kerning: normal;
  padding: 4px 6px 120px;
}
.qpc-line .end { color: #000000; }
.qpc-line.basmala { color: #000000; font-size: .95em; }
.sh-frame { color: #D95A06; border-color: #b9973f; background: linear-gradient(90deg, #ffffff, #f3efe1, #ffffff); font-size: .88em; }
@media (prefers-color-scheme: dark) {
  .tab-page[data-page="mushaf"], .qpc-page { background: #ffffff; }
  .qpc-page { box-shadow: none; clip-path: none; }
}

/* أزرار أخف وأهدى بأسفل الشاشة */
body.mushaf-mode .mp-chips { bottom: calc(18px + env(safe-area-inset-bottom)); }
body.mushaf-mode .mp-fab { bottom: calc(14px + env(safe-area-inset-bottom)); }
body.mushaf-mode .mp-status { bottom: calc(86px + env(safe-area-inset-bottom)); }
body.mushaf-mode .mp-nav { bottom: calc(86px + env(safe-area-inset-bottom)); }
.chip-btn { background: #ffffff; color: #2b2b2b; border-color: #e3e3de; box-shadow: 0 4px 14px -8px rgb(0 0 0 / .25); }
.chip-btn.on { background: #F26A0F; color: #fff; border-color: #F26A0F; }
.mp-menu { background: #ffffff; color: #1a1a1a; }
.mp-menu button { color: #1a1a1a; }
.mp-menu i { background: #f3f3f0; }
.mp-status { background: #ffffff; color: #1a1a1a; border-color: #e3e3de; }

/* قائمة التنقّل الجانبية */
.modal.side { align-items: stretch; justify-content: flex-start; }
.nav-sheet {
  width: min(300px, 82vw); max-width: none; height: 100dvh; max-height: none; border-radius: 0;
  display: flex; flex-direction: column; gap: 4px; padding-top: calc(24px + env(safe-area-inset-top));
}
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.nav-brand img { width: 40px; height: 40px; border-radius: 12px; }
.nav-brand b { font-size: 20px; }
.nav-brand small { color: var(--muted); letter-spacing: 2px; }
.nav-sheet button {
  display: flex; align-items: center; gap: 12px; padding: 14px 10px; border: 0; border-radius: 12px;
  background: none; color: var(--ink); font-size: 16px; text-align: right;
}
.nav-sheet button:active { background: var(--bg); }
.nav-sheet button span { width: 28px; text-align: center; font-size: 20px; }

/* ===== شاشة المصحف v3: أيقونات، وإخفاء هادي، وحركة ناعمة ===== */
.mp-icon svg, .chip-btn.icon svg, .fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mp-icon svg .fill, .chip-btn svg .fill, .fab svg .fill { fill: currentColor; stroke: none; }
.mp-icon { display: grid; place-items: center; border-radius: 12px; transition: background .15s, transform .1s; }
.mp-icon:active { background: #ebebe7; transform: scale(.94); }
.mp-icon.bm::before { content: none; }
.mp-icon.bm svg { stroke: #9a9a94; }
.mp-icon.bm.on svg { fill: var(--gold, #a57b2c); stroke: var(--gold, #a57b2c); }
.mp-title { order: 0; }

/* الإخفاء: الكلمات شفافة، وبتضل خطوط الأسطر الخفيفة ورؤوس الآيات */
.qpc-page .w { transition: opacity .35s ease, transform .35s ease, background .2s, color .2s; }
.qpc-page.hidden .qpc-line.ayat { box-shadow: inset 0 -1px 0 #ececea; }
.qpc-page.hidden .w { opacity: 0; transform: translateY(3px); }
.qpc-page.hidden .w:not(.correct):not(.wrong):not(.missed):not(.corrected):not(.peek) { background: none; color: inherit; }
.qpc-page.hidden .w.correct, .qpc-page.hidden .w.wrong, .qpc-page.hidden .w.missed,
.qpc-page.hidden .w.corrected, .qpc-page.hidden .w.peek { opacity: 1; transform: none; }
.qpc-page.hidden .w.cur { opacity: .35; transform: none; background: none; }
.qpc-page.hidden .w.peek { color: #8b5a2b; }
.qpc-page.no-markers .end { opacity: 0; }
.qpc-page .end { transition: opacity .3s; }
@media (prefers-reduced-motion: reduce) { .qpc-page .w { transition: none; } }

/* الأسفل: مؤقّت التسجيل، والأزرار، والزر العائم */
.mp-chips, .mp-fab { display: none; }
.mp-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; pointer-events: none;
  padding: 0 16px calc(14px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: end; gap: 8px 12px;
}
.mp-bottom > * { pointer-events: auto; }
.mp-bottom .mp-chips { display: flex; position: static; grid-column: 1; grid-row: 2; justify-self: start; direction: ltr; gap: 10px; }
.mp-bottom .fab { grid-column: 2; grid-row: 1 / 3; }
.rec-pill {
  grid-column: 1; grid-row: 1; justify-self: start; display: none; align-items: center; gap: 10px; direction: ltr;
  background: #efefec; color: #2b2b2b; border-radius: 16px; padding: 8px 14px; font-size: 15px; font-variant-numeric: tabular-nums;
}
.rec-pill i { width: 12px; height: 12px; border-radius: 50%; background: #e05252; animation: rec 1.2s ease-in-out infinite; }
@keyframes rec { 50% { opacity: .35; } }
body.recording .rec-pill { display: flex; }
.chip-btn { display: grid; place-items: center; transition: transform .1s, background .15s, color .15s; }
.chip-btn.icon { width: 48px; min-width: 48px; padding: 0; border-radius: 50%; }
.chip-btn:active { transform: scale(.94); }
.hide-group { display: flex; gap: 6px; padding: 0; border-radius: 26px; transition: background .25s, box-shadow .25s, padding .25s; }
.hide-group .hint { width: 0; min-width: 0; opacity: 0; border-width: 0; overflow: hidden; transition: width .25s, opacity .2s; }
.hide-group.open { background: #ffffff; padding: 3px; box-shadow: 0 0 0 2px #FFD3B0, 0 8px 20px -10px rgb(242 106 15 / .4); }
.hide-group.open .hint { width: 44px; min-width: 44px; height: 44px; opacity: 1; border-width: 1px; }
.hide-group.open #mpHide { background: #ffffff; color: #F26A0F; border-color: transparent; box-shadow: none; }
.fab { width: 72px; height: 72px; color: #fff; transition: transform .15s, box-shadow .25s, background .25s; }
.fab:active { transform: scale(.93); }
.fab svg { width: 30px; height: 30px; stroke-width: 2.1; }
.fab .ic-stop { display: none; }
body.recording .fab .ic-mic { display: none; }
body.recording .fab .ic-stop { display: block; }
body.recording .fab { background: linear-gradient(145deg, #FFB061, #F26A0F); color: #ffffff; box-shadow: 0 0 0 8px rgb(255 138 43 / .22), 0 12px 30px -8px rgb(242 106 15 / .8); animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 14px rgb(255 138 43 / .1), 0 12px 30px -8px rgb(242 106 15 / .8); } }
.fab .ic-mic, .fab .ic-stop { display: grid; place-items: center; }
body.recording .mp-status { display: none; }

/* رسالة قصيرة (زي «الآيات المخفية: مفعّل») */
.mp-toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); z-index: 9;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: #1f1f1f; color: #fff; border-radius: 12px; padding: 10px 16px; font-size: 15px; white-space: nowrap;
  transition: opacity .2s, transform .2s;
}
.mp-toast.show { opacity: 1; transform: translate(-50%, 0); }
.mp-bottom { direction: ltr; }
.mp-bottom .chip-btn { direction: rtl; }
.mp-bottom .mp-chips { gap: 8px; }
.mp-bottom .chip-btn { height: 46px; }
.mp-bottom .chip-btn.icon { width: 46px; min-width: 46px; }
.hide-group.open .hint { width: 42px; min-width: 42px; height: 42px; }
.mp-bottom .fab { width: 68px; height: 68px; }
.mp-bottom { padding-left: 14px; padding-right: 14px; column-gap: 10px; }
.mp-bottom .fab { width: 64px; height: 64px; }

/* ===== الهوية: رتّلوا ===== */
.brand h1 { font-family: 'Reem Kufi', Tajawal, sans-serif; font-weight: 700; letter-spacing: .5px; }
.brand .logo { background: none; box-shadow: 0 14px 34px -14px #F26A0F; border-radius: 24px; }
.nav-brand b { font-family: 'Reem Kufi', Tajawal, sans-serif; }
.hero { background: linear-gradient(135deg, #FF8A2B, #E85A06); box-shadow: 0 14px 30px -14px #F26A0F; }
.fab { background: linear-gradient(145deg, #FF9A3D, #F26A0F); color: #ffffff; box-shadow: 0 12px 30px -8px rgb(242 106 15 / .75); }

/* اسم التطبيق بالإنجليزي بخط حديث */
.brand h1 .latin, .nav-brand small { font-family: 'Outfit', Tajawal, sans-serif; letter-spacing: 1.5px; text-transform: none; }
.fab .ic-stop { display: none; }
body.recording .fab .ic-mic { display: none; }
body.recording .fab .ic-stop { display: grid; }

/* ===== اللوحة: شريط علوي وتبويبات (زي ترتيل بطابعنا) ===== */
:root { --page: #F6F5F2; --card: #FFFFFF; --soft: #FFF3EA; --orange: #F26A0F; }
@media (prefers-color-scheme: dark) { :root { --page: #121417; --card: #1B1E22; --soft: #2A1E15; } }
body:not(.mushaf-mode) { background: var(--page); }
body.mushaf-mode .dash-top, body.mushaf-mode .top-tabs { display: none; }
.dash-top {
  position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 4px; background: var(--page);
}
.dash-top .mp-icon { color: var(--ink); border: 1.5px solid var(--line); border-radius: 50%; width: 40px; height: 40px; }
.dash-top #dashBack { order: 9; }
.dash-logo { width: 34px; height: 34px; border-radius: 10px; margin-inline-start: 6px; }
.dash-spacer { flex: 1; }
.top-tabs {
  position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 5; display: flex; gap: 22px; overflow-x: auto;
  padding: 6px 16px 0; background: var(--page); border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.top-tabs::-webkit-scrollbar { display: none; }
.top-tabs .tab {
  flex: none; max-width: none; padding: 10px 0 12px; font-size: 17px; color: var(--muted); border: 0; background: none;
  border-bottom: 3px solid transparent; border-radius: 0; position: relative; font-weight: 500;
}
.top-tabs .tab.active { color: var(--ink); border-bottom-color: var(--orange); font-weight: 700; }
.top-tabs .tab i { position: static; margin-inline-start: 6px; display: inline-grid; vertical-align: 2px; }
.home-body { padding-top: 14px; }
.tab-page { animation: page-in .28s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tab-page[data-page="mushaf"] { animation: none; }
.card { background: var(--card); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 6px; }
.sec-head h3 { margin: 0; font-size: 19px; }
.sec-head small { color: var(--muted); font-size: 13px; }
.link-btn.soft { color: var(--muted); font-size: 14px; margin: 0; }
svg { stroke-linecap: round; stroke-linejoin: round; }

/* التحية والسلسلة */
.hello { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hello small { color: var(--muted); font-size: 13px; }
.hello h2 { margin: 2px 0 0; font-size: 24px; }
.streak-chip {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; background: var(--soft); color: var(--orange);
  font-size: 18px; font-weight: 700;
}
.streak-chip .flame { width: 18px; height: 22px; background: var(--orange); clip-path: path('M9 0C10 6 18 8 18 15A9 9 0 0 1 0 15C0 11 2 9 4 7 4 10 6 11 7 12 6.5 7 7.5 3 9 0Z'); }

/* أسبوعك */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 4px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.day small { color: var(--muted); font-size: 11px; }
.day .dot {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700;
  background: var(--page); color: var(--ink); border: 1.5px solid var(--line); transition: transform .2s;
}
.day.done .dot { background: linear-gradient(145deg, #FF9A3D, #F26A0F); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -8px var(--orange); }
.day .dot svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 3; }
.day.today .dot { border: 2px solid var(--orange); color: var(--orange); }
.day.today.done .dot { border: 0; color: #fff; }
.day.future .dot { opacity: .6; }
.day em { font-style: normal; font-size: 10px; color: var(--orange); min-height: 13px; }

/* ورد اليوم */
.wird { gap: 4px; }
.wird-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.wird-head h3 { margin: 0; font-size: 19px; }
.wird-head small { color: var(--muted); font-size: 13px; }
.ring {
  --p: 0; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--orange) calc(var(--p) * 1%), var(--line) 0); position: relative;
}
.ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--card); }
.ring span { position: relative; font-size: 13px; font-weight: 700; color: var(--orange); }
.ring.big { width: 78px; height: 78px; }
.wird-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.wird-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wird-row small { color: var(--muted); font-size: 13px; }
.w-ic, .st-ic, .act-ic { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--orange); }
.w-ic svg, .st-ic svg, .act-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.w-go { flex: none; border: 0; border-radius: 99px; padding: 9px 18px; font-weight: 700; color: #fff; background: linear-gradient(145deg, #FF9A3D, #F26A0F); box-shadow: 0 6px 14px -8px var(--orange); }
.w-go:active { transform: scale(.95); }

/* آية أو حديث */
.quote { position: relative; padding: 18px 18px 14px; border-radius: 20px; background: linear-gradient(135deg, #FF8A2B, #E85A06); color: #fff; overflow: hidden; }
.quote::after { content: ''; position: absolute; inset: auto -40px -60px auto; width: 160px; height: 160px; border-radius: 50%; background: rgb(255 255 255 / .1); }
.quote p { margin: 0 0 6px; font-family: 'Amiri Quran', serif; font-size: 20px; line-height: 1.9; }
.quote small { opacity: .85; font-size: 12px; }

/* التقدّم */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 14px 12px 16px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); overflow: hidden;
}
.stat > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat small { color: var(--muted); font-size: 12px; }
.stat b { font-size: 18px; }
.st-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--line); }
.st-bar > i { display: block; height: 100%; background: var(--orange); border-radius: 0 4px 4px 0; transition: width .6s ease; }

/* النشاط */
.act {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: right; padding: 12px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
}
.act > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.act small { color: var(--muted); font-size: 12px; }
.act .chev { color: var(--muted); font-size: 22px; }
.act:active, .preset:active, .row-item.link:active { transform: scale(.985); }

/* الإنجازات */
.badge-grid { display: grid; grid-auto-flow: column; grid-auto-columns: 128px; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.badge-grid::-webkit-scrollbar { display: none; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 14px 8px 12px;
  border-radius: 18px; background: var(--card); border: 1px solid var(--line);
}
.badge b { font-size: 13px; } .badge small { font-size: 11px; color: var(--muted); line-height: 1.4; }
.badge:not(.on) b { color: var(--muted); }
.medal { width: 64px; height: 64px; }
.medal.on { filter: drop-shadow(0 6px 10px rgb(242 106 15 / .35)); }

/* تسميع حر */
.free summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
.free summary::after { content: '‹'; color: var(--muted); transition: transform .2s; }
.free[open] summary::after { transform: rotate(-90deg); }
.free[open] { gap: 12px; }

/* الخطة */
.plan-now { gap: 10px; }
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pc-top h3 { margin: 2px 0; font-size: 22px; }
.pc-top small { color: var(--muted); font-size: 13px; }
.pc-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--soft); color: var(--ink); font-size: 14px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preset-grid .pace { grid-column: 1 / -1; }
.preset {
  position: relative; display: flex; flex-direction: column; gap: 4px; text-align: right; padding: 14px 12px 18px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); overflow: hidden;
}
.preset b { font-size: 16px; } .preset small { color: var(--muted); font-size: 12px; }
.preset em { font-style: normal; font-size: 12px; color: var(--orange); font-weight: 700; }
.pace { display: flex; gap: 6px; flex-wrap: wrap; }
.pace-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px; padding: 8px 14px; font-size: 14px; transition: all .15s; }
.pace-btn.on { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }

/* الإعدادات: مجموعات زي ترتيل */
.group { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.group h4 { margin: 0; padding: 14px 16px 10px; font-size: 15px; border-bottom: 1px solid var(--line); }
.row-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); width: 100%; text-align: right; font-size: 15px; }
.row-item:last-child { border-bottom: 0; }
.row-item.switch { flex-direction: row-reverse; justify-content: space-between; }
.row-item.switch > div { flex: 1; }
.row-item.select { flex-direction: row; justify-content: space-between; color: var(--ink); font-weight: 500; }
.row-item.select select { width: auto; max-width: 60%; padding: 8px 10px; }
.row-item.link::after { content: '‹'; margin-inline-start: auto; color: var(--muted); font-size: 20px; }
.row-item.danger { color: var(--bad); }
.ri-ic { width: 26px; text-align: center; font-size: 18px; }
.about { color: var(--muted); font-size: 12px; text-align: center; line-height: 1.8; }
#feedbackForm { display: flex; flex-direction: column; gap: 12px; }
#feedbackForm h2 { margin: 0; }
textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; resize: vertical; }

/* تشجيع بعد الجلسة */
.cheer { text-align: center; margin: -4px 0 14px; padding: 12px; border-radius: 14px; background: var(--soft); }
.cheer:empty { display: none; }
.cheer b { display: block; color: var(--orange); margin-bottom: 4px; }
.cheer p { margin: 0; font-family: 'Amiri Quran', serif; font-size: 18px; line-height: 1.9; }
.cheer small { color: var(--muted); font-size: 12px; }

/* وسام جديد */
.badge-pop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; pointer-events: none; }
.bp-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 28px; border-radius: 24px;
  background: var(--card); box-shadow: 0 30px 60px -20px rgb(0 0 0 / .45); transform: scale(.7) translateY(20px); opacity: 0;
  transition: transform .35s cubic-bezier(.2, 1.4, .4, 1), opacity .25s;
}
.badge-pop.show .bp-card { transform: none; opacity: 1; }
.bp-icon .medal { width: 96px; height: 96px; animation: medal-spin .9s ease .15s both; }
@keyframes medal-spin { from { transform: rotateY(90deg) scale(.6); } to { transform: none; } }
.bp-card small { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .tab-page, .bp-icon .medal { animation: none; } .bp-card { transition: none; } }

/* القائمة المطوّلة للمايك، وزر الأخطاء */
.mp-bottom .mp-menu {
  position: absolute; right: 14px; bottom: calc(92px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border-radius: 26px; background: #ffffff; box-shadow: 0 20px 44px -16px rgb(0 0 0 / .4); direction: rtl;
  animation: menu-in .2s ease both;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.mp-menu button { justify-content: space-between; min-width: 150px; font-size: 16px; }
.mp-menu i { width: 50px; height: 50px; background: #F4F4F1; color: #1a1a1a; }
.mp-menu i svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; }
#mpFabBtn { touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
#mpFabBtn.menu-open { background: #1f1f1f; }
#mpMistakes.has { border-color: #F26A0F; color: #F26A0F; font-weight: 700; }
.qpc-page .w.flash { animation: flash 1.2s ease 2; }
@keyframes flash { 50% { background: rgb(242 106 15 / .28); } }

/* البسملة بالإخفاء: بتختفي زي باقي الكلمات وبتظهر لما تنقرأ */
.qpc-page.hidden .qpc-line.basmala .w:not(.correct):not(.corrected):not(.peek) { opacity: 0; }

/* المستطيل العلوي صار زر */
.mp-title { cursor: pointer; transition: background .15s, transform .1s; }
.mp-title:active { transform: scale(.98); background: #f3f3f0; }
.mp-title b::after { content: ' ⌄'; color: #9a9a94; font-family: Tajawal, sans-serif; font-size: 13px; }

/* قائمة الأخطاء: بطاقات واضحة */
.mk-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -4px 0 6px; font-size: 12px; color: var(--muted); }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.lg.wrong { background: #e5484d; } .lg.missed { background: #8e4ec6; } .lg.tajweed { background: #2f7de1; } .lg.old { background: #F26A0F; }
#mkList { gap: 10px; }
#mkList .mk-sec { background: none; padding: 6px 2px 0; font-size: 13px; font-weight: 700; color: var(--muted); display: block; }
#mkList .mk-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid #F26A0F; border-radius: 16px;
}
.mk-card.wrong { border-inline-start-color: #e5484d !important; } .mk-card.missed { border-inline-start-color: #8e4ec6 !important; }
.mk-card.tajweed { border-inline-start-color: #2f7de1 !important; }
.mk-word { font-family: 'Amiri Quran', serif; font-size: 26px; line-height: 1.8; min-width: 70px; text-align: center; }
.mk-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mk-tag { font-weight: 700; font-size: 14px; }
.mk-card.wrong .mk-tag { color: #e5484d; } .mk-card.missed .mk-tag { color: #8e4ec6; } .mk-card.tajweed .mk-tag { color: #2f7de1; } .mk-card.old .mk-tag { color: #F26A0F; }
.mk-info small { color: var(--muted); font-size: 12px; }
.mk-act { display: flex; flex-direction: column; gap: 6px; }
.mk-act button { border: 1px solid var(--line); background: var(--page); color: var(--ink); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.mk-act button:active { transform: scale(.95); }

/* إطار اسم السورة: مزخرف ومتوسّط، والحركات جواه */
.qpc-line.header { justify-content: center; padding: 0; }
.sh-frame {
  width: auto; height: min(100%, 52px); aspect-ratio: 440 / 56; max-width: 96%;
  display: grid; place-items: center; border: 0; border-radius: 0;
  background: url(brand/surah-frame.svg) center / 100% 100% no-repeat;
  color: #7A5512; font-family: 'Amiri Quran', serif; font-size: .74em; line-height: 1; padding-bottom: .12em;
}
.sh-frame span { display: block; line-height: 1.9; transform: translateY(-.06em); }
.sh-frame { font-size: .9em; }
.sh-frame span { line-height: 2.1; }

/* عنوان السورة: خط الثلث، وإطار أعرض وأقل ارتفاعاً حتى يبين الاسم كامل */
.qpc-line.header .sh-frame { width: 94%; height: 82%; aspect-ratio: auto; max-width: none; padding: 0; }
.sh-name {
  font-family: 'surahNames', 'Amiri Quran', serif; direction: ltr; unicode-bidi: isolate;
  font-size: 1.32em; line-height: 1; color: #6B4A10; transform: translateY(.04em); letter-spacing: 0;
}
.sh-name { font-size: 2.05em; line-height: 0; display: flex; align-items: center; height: 100%; transform: translateY(.02em); }
.qpc-line.header .sh-frame { overflow: visible; display: flex; justify-content: center; align-items: center; }
.sh-name { font-size: 1.5em; line-height: 1; height: auto; display: block; transform: none; }

/* الكلمة بتظهر أول ما تنسمع (وبتتثبّت بعدها)، فالقارئ بيحس الاستجابة فورية */
.qpc-page.hidden .w.cur { opacity: 1; transform: none; color: inherit; background: none; }
.qpc-page .w.cur { background: rgb(242 106 15 / .10); }

/* ---------------- شريط التتبّع ---------------- */
.qpc-page { position: relative; }
.qpc-page .qpc-line { position: relative; z-index: 1; }
#mpTrack { position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: 0; transition: opacity .35s ease; }
#mpTrack.on { opacity: 1; }
#mpTrack .band {
  position: absolute; left: 2px; right: 2px; border-radius: 14px;
  background: linear-gradient(90deg, rgb(255 154 61 / .05), rgb(242 106 15 / .11), rgb(255 154 61 / .05));
  transition: top .4s cubic-bezier(.3, .8, .25, 1), height .4s;
}
#mpTrack .pill {
  position: absolute; border-radius: 12px;
  background: linear-gradient(180deg, rgb(255 154 61 / .26), rgb(242 106 15 / .30));
  box-shadow: 0 8px 22px -4px rgb(232 90 6 / .45), 0 0 0 1.5px rgb(242 106 15 / .55);
  transition: left .28s cubic-bezier(.3, .8, .25, 1), top .4s cubic-bezier(.3, .8, .25, 1), width .28s, height .28s;
}
.qpc-page .w.cur, .qpc-page.hidden .w.cur { background: none; }
@media (prefers-reduced-motion: reduce) { #mpTrack .band, #mpTrack .pill { transition: none; } }

/* تصنيف الخطأ: لحن جلي / خفي / وقف وابتداء */
.lahn { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-inline-start: 6px; vertical-align: middle; white-space: nowrap; }
.lahn.jali { background: rgb(229 72 77 / .12); color: #c7353a; }
.lahn.khafi { background: rgb(47 125 225 / .12); color: #2565b8; }
.lahn.waqf { background: rgb(138 92 246 / .13); color: #6b46d6; }
.mk-card.waqf .mk-tag { color: #6b46d6; }

/* ---------------- علامات هادية على الكلمات ----------------
   اللحن الجلي (حرف، حركة، شدّة) = الكلمة كلها حمراء زي الكلمة الغلط.
   اللحن الخفي (المد) = ظل أزرق ناعم. الوقف والابتداء = ظل ملوّن ناعم تحت الكلمة حسب نوعه. */
.qpc-page .w.tj { box-shadow: none; text-decoration: none; }
.qpc-page .w.tj.jali { color: var(--bad); }
.qpc-page .w.tj.khafi, .qpc-page .w.wq-green, .qpc-page .w.wq-yellow, .qpc-page .w.wq-red {
  --glow: 47 125 225; border-radius: 10px; text-decoration: none;
  background: linear-gradient(to top, rgb(var(--glow) / .42), rgb(var(--glow) / .12) 60%, rgb(var(--glow) / 0));
  box-shadow: 0 5px 12px -6px rgb(var(--glow) / .75);
  transition: background .5s ease, box-shadow .5s ease;
}
.qpc-page .w.wq-green { --glow: 48 164 108; }
.qpc-page .w.wq-yellow { --glow: 226 170 10; }
.qpc-page .w.wq-red { --glow: 229 72 77; }

/* ---------------- الميزات والخطط ---------------- */
em.pro, em.beta { font-style: normal; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 99px; margin-inline-start: 6px; vertical-align: middle; letter-spacing: .02em; }
em.pro { color: #fff; background: linear-gradient(135deg, #FF9A3D, #E85A06); }
em.beta { color: #8a5a00; background: rgb(226 170 10 / .18); }
.row-item.locked { opacity: .55; }
.plan-note { margin: 6px 4px 0; font-size: 12.5px; color: var(--muted); }
/* المقام: تنويه صغير جنب مؤقّت التسجيل */
.mp-maqam { margin-inline-start: 8px; padding-inline-start: 8px; border-inline-start: 1px solid currentColor; opacity: .85; font-weight: 600; }
.mp-maqam.pop { animation: mqpop .6s ease; }
@keyframes mqpop { 0% { opacity: 0; transform: translateY(4px); } 100% { opacity: .85; transform: none; } }

/* تسجيل الدخول بجوجل */
.google-box { display: grid; gap: 12px; justify-items: center; margin-bottom: 4px; }
.google-box .or { width: 100%; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.google-box .or::before, .google-box .or::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .25; }
