/* ميقات — كحلي وذهبي، بوضعين فاتح وداكن */

:root {
  --navy: #0f2650;
  --navy-2: #0a1a38;
  --navy-3: #16336a;
  --gold: #c8a04a;
  --gold-2: #e6cd8c;
  --gold-ink: #94701f;        /* ذهبي للنص على الخلفية الفاتحة (تباين كافٍ) */
  --ivory: #f7f2e6;

  --bg: #f1f3f8;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --text: #0f1f3d;
  --text-2: #5b6782;
  --text-3: #8a94aa;
  --line: #e2e6ef;
  --accent: var(--gold-ink);
  --accent-bg: rgba(200, 160, 74, .13);
  --ok: #2f8a63;
  --danger: #b4443a;
  --shadow: 0 1px 2px rgba(15, 38, 80, .05), 0 6px 20px rgba(15, 38, 80, .06);
  --page-paper: #fffdf6;
  --page-ink: #1b1a14;

  --font-ui: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-quran: "Amiri Quran", "Amiri", "Traditional Arabic", serif;
  --font-naskh: "Amiri", "Traditional Arabic", serif;

  --nav-h: 66px;
  --mini-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --gutter: 16px;
  --max: 640px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #071229;
  --surface: #0d1c3a;
  --surface-2: #122549;
  --text: #f1ecdf;
  --text-2: #a3aec6;
  --text-3: #6f7c99;
  --line: #1c3058;
  --accent: #d9b766;
  --accent-bg: rgba(217, 183, 102, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --page-paper: #0e1d3b;
  --page-ink: #efe6cf;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: background-color .25s ease;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num-t { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============ الهيكل ============ */
.app {
  max-width: var(--max);
  margin: 0 auto;
  padding: calc(var(--safe-t) + 10px) var(--gutter) calc(var(--nav-h) + var(--safe-b) + 24px);
  min-height: 100dvh;
}
body.has-player .app { padding-bottom: calc(var(--nav-h) + var(--mini-h) + var(--safe-b) + 30px); }

.topbar { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 10px; }
.topbar .title { flex: 1; font-size: 20px; font-weight: 700; margin: 0; }
.topbar .title.center { text-align: center; font-size: 17px; }
.icon-btn {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 50%;
  color: var(--text); background: var(--surface); box-shadow: var(--shadow);
}
.icon-btn.plain { background: none; box-shadow: none; }
.icon-btn:active { transform: scale(.95); }

.greet { flex: 1; min-width: 0; }
.greet small { display: block; color: var(--text-2); font-size: 13px; }
.greet a { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 17px; }
.greet a svg { color: var(--accent); }

.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.section-head h2 { font-size: 17px; font-weight: 700; margin: 0; }
.section-head a, .link { color: var(--accent); font-size: 14px; font-weight: 600; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card + .card { margin-top: 12px; }

/* ============ البطاقة الكحلية (Hero) ============ */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: 26px; padding: 20px 20px 16px;
  background: radial-gradient(120% 90% at 85% 0%, var(--navy-3) 0%, var(--navy) 45%, var(--navy-2) 100%);
  color: var(--ivory);
  box-shadow: 0 14px 34px rgba(10, 26, 56, .28);
}
.hero::before { /* زخرفة هندسية */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23e6cd8c' stroke-width='1'%3E%3Cpath d='M28 6l6.4 15.6L50 28l-15.6 6.4L28 50l-6.4-15.6L6 28l15.6-6.4z'/%3E%3Crect x='16' y='16' width='24' height='24' transform='rotate(45 28 28)'/%3E%3Crect x='16' y='16' width='24' height='24'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(200deg, #000 10%, transparent 75%);
          mask-image: linear-gradient(200deg, #000 10%, transparent 75%);
}
.hero::after { content: ""; position: absolute; inset: 6px; border-radius: 21px; border: 1px solid rgba(230, 205, 140, .22); pointer-events: none; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero-label { font-size: 14px; color: rgba(247, 242, 230, .72); }
.hero-name { font-size: 34px; font-weight: 700; line-height: 1.2; margin: 2px 0 0; }
.hero-count { font-size: 40px; font-weight: 600; color: var(--gold-2); font-variant-numeric: tabular-nums; line-height: 1.15; letter-spacing: .01em; margin-top: 8px; }
.hero-sub { font-size: 14px; color: rgba(247, 242, 230, .78); margin-top: 2px; }
.hero-sub b { color: var(--ivory); font-weight: 600; }
.hero-date { text-align: end; font-size: 13px; color: rgba(247, 242, 230, .75); line-height: 1.5; }
.hero-date strong { display: block; color: var(--gold-2); font-size: 15px; font-weight: 600; }
.hero-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(230, 205, 140, .18); }
.hero-strip div { text-align: center; padding: 6px 0; border-radius: 12px; }
.hero-strip span { display: block; font-size: 12px; color: rgba(247, 242, 230, .7); }
.hero-strip b { display: block; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-strip .on { background: rgba(230, 205, 140, .16); }
.hero-strip .on span, .hero-strip .on b { color: var(--gold-2); }

/* ============ قائمة الصلوات ============ */
.prayers { list-style: none; margin: 0; padding: 6px; }
.prayers li {
  display: grid; grid-template-columns: 40px 1fr auto 40px; align-items: center; gap: 10px;
  padding: 10px 10px; border-radius: 14px; position: relative;
}
.prayers li + li { margin-top: 2px; }
.prayers .p-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.prayers .p-name { font-weight: 600; font-size: 17px; }
.prayers .p-name small { display: block; font-weight: 400; font-size: 12px; color: var(--text-3); }
.prayers .p-time { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.prayers .p-time small { font-size: 12px; color: var(--text-2); font-weight: 400; margin-inline-start: 3px; }
.prayers li.past .p-name, .prayers li.past .p-time { color: var(--text-2); }
.prayers li.now { background: var(--accent-bg); }
.prayers li.now::before { content: ""; position: absolute; inset-inline-start: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--gold); }
.prayers li.now .p-ico { background: var(--gold); color: var(--navy-2); }
.prayers li.minor .p-name, .prayers li.minor .p-time { font-size: 15px; color: var(--text-2); font-weight: 500; }
.check {
  width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; justify-self: end;
  transition: background .15s, border-color .15s;
}
.check[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.check:disabled { opacity: .35; cursor: default; }

/* ============ الوصول السريع ============ */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 14px 4px 12px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; font-weight: 500; text-align: center; }
.quick .q-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(160deg, var(--navy-3), var(--navy-2)); color: var(--gold-2); }
:root[data-theme="dark"] .quick .q-ico { background: linear-gradient(160deg, #1b3a73, #0f2650); }

/* ============ تمرير أفقي (عمل اليوم والليلة) ============ */
.hscroll { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 10px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.deed { flex: 0 0 min(78%, 300px); scroll-snap-align: start; padding: 16px 16px 14px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); border-top: 3px solid var(--gold); display: flex; flex-direction: column; }
.deed h3 { margin: 0 0 4px; font-size: 16px; }
.deed p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.75; flex: 1; }
.deed .link { margin-top: 10px; }

/* ============ آية اليوم ============ */
.verse-card { padding: 22px 20px 16px; text-align: center; }
.verse-card .v-text { font-family: var(--font-quran); font-size: 23px; line-height: 2.1; margin: 4px 0 8px; }
.verse-card .v-ref { font-size: 13px; color: var(--gold-2); }
.verse-card .hero-label { margin-bottom: 4px; }
.verse-actions { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.verse-actions button, .verse-actions a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: rgba(230, 205, 140, .12); color: var(--ivory); font-size: 13px; }

/* ============ صفوف القوائم ============ */
.list { list-style: none; margin: 0; padding: 4px 0; }
.card > .list { padding: 4px 6px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; padding: 12px 10px; border-radius: 14px; }
.row:active { background: var(--surface-2); }
.list > li + li > .row { border-top: 1px solid var(--line); border-radius: 0; }
.row .r-main { flex: 1; min-width: 0; }
.row .r-title { display: block; font-weight: 600; font-size: 16px; }
.row .r-meta { display: block; font-size: 13px; color: var(--text-2); }
.row .r-end { color: var(--text-2); font-size: 13px; flex: none; display: flex; align-items: center; gap: 6px; }
.row .r-end svg { color: var(--text-3); }

/* رقم داخل نجمة ثمانية */
.star-num { position: relative; width: 40px; height: 40px; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.star-num::before { content: ""; position: absolute; inset: 4px; border: 1.5px solid var(--gold); border-radius: 4px; transform: rotate(45deg); opacity: .7; }
.star-num::after { content: ""; position: absolute; inset: 4px; border: 1.5px solid var(--gold); border-radius: 4px; opacity: .7; }

.avatar { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 17px; font-weight: 700; color: var(--gold-2); background: linear-gradient(160deg, var(--navy-3), var(--navy-2)); box-shadow: inset 0 0 0 1.5px rgba(230, 205, 140, .45); }
.avatar.lg { width: 76px; height: 76px; font-size: 28px; }

/* ============ عناصر التحكم ============ */
.seg { display: flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1; min-height: 38px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.seg button[aria-selected="true"] { background: var(--navy); color: var(--gold-2); }
:root[data-theme="dark"] .seg button[aria-selected="true"] { background: var(--gold); color: var(--navy-2); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--gold-2); }
:root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--navy-2); }

.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 14px; padding: 0 14px; box-shadow: var(--shadow); margin-bottom: 14px; }
.search svg { color: var(--text-3); flex: none; }
.search input { flex: 1; min-height: 48px; border: 0; background: none; outline: none; min-width: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 14px; font-weight: 600; background: var(--navy); color: var(--gold-2); }
:root[data-theme="dark"] .btn { background: var(--gold); color: var(--navy-2); }
.btn.gold { background: linear-gradient(180deg, #d6b25e, #b8903c); color: var(--navy-2); }
.btn.ghost { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }

.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: inherit; transition: width .3s; }

.note { font-size: 14px; color: var(--text-2); line-height: 1.8; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px dashed var(--line); }
.empty { text-align: center; color: var(--text-2); padding: 36px 12px; }

/* ============ التنقل السفلي ============ */
.tabbar { position: fixed; inset: auto 0 0 0; z-index: 30; padding-bottom: var(--safe-b); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tabbar ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); max-width: var(--max); height: var(--nav-h); }
.tabbar a { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-3); font-size: 12px; font-weight: 500; }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.tabbar a[aria-current="page"] svg { stroke-width: 2.1; }
body.reading .tabbar, body.welcome .tabbar { display: none; }

/* ============ المشغّل المصغّر ============ */
.mini { position: fixed; z-index: 31; inset-inline: 10px; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); max-width: calc(var(--max) - 20px); margin: 0 auto; height: var(--mini-h); border-radius: 18px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 8px; background: linear-gradient(160deg, var(--navy-3), var(--navy-2)); color: var(--ivory); box-shadow: 0 10px 30px rgba(10, 26, 56, .35); overflow: hidden; }
body.reading .mini { bottom: calc(var(--safe-b) + 10px); }
.mini .avatar { width: 42px; height: 42px; font-size: 15px; }
.mini .m-info { flex: 1; min-width: 0; text-align: start; }
.mini .m-info b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .m-info span { display: block; font-size: 12px; color: rgba(247, 242, 230, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini button.ctl { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ivory); }
.mini button.ctl.main { background: var(--gold); color: var(--navy-2); }
.mini .m-bar { position: absolute; inset: auto 0 0 0; height: 3px; background: rgba(255, 255, 255, .12); }
.mini .m-bar i { display: block; height: 100%; background: var(--gold-2); }

/* المشغّل الكامل */
.player-full { text-align: center; padding-top: 6px; }
.player-full .avatar.lg { margin: 6px auto 12px; width: 120px; height: 120px; font-size: 40px; }
.player-full h3 { font-size: 24px; margin: 0; }
.player-full .p-reciter { color: var(--text-2); margin: 2px 0 14px; }
.seekbar { position: relative; height: 22px; margin: 4px 0 0; cursor: pointer; touch-action: none; }
.seekbar::before { content: ""; position: absolute; inset: 9px 0; border-radius: 4px; background: var(--line); }
.seekbar i { position: absolute; top: 9px; bottom: 9px; inset-inline-start: 0; border-radius: 4px; background: linear-gradient(270deg, var(--gold), var(--gold-2)); }
.seekbar i::after { content: ""; position: absolute; inset-inline-end: -7px; top: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.times-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 12px 0 16px; }
.controls button { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; }
.controls .big { width: 66px; height: 66px; background: var(--navy); color: var(--gold-2); }
:root[data-theme="dark"] .controls .big { background: var(--gold); color: var(--navy-2); }
.controls .on { color: var(--accent); background: var(--accent-bg); }
.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opts button { min-height: 52px; border-radius: 14px; background: var(--surface-2); font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.opts button b { font-size: 14px; color: var(--accent); }

/* ============ المصحف ============ */
.reader { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.reader-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 6px; padding: calc(var(--safe-t) + 6px) 10px 6px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.reader-top .info { flex: 1; text-align: center; line-height: 1.3; }
.reader-top .info strong { display: block; font-size: 16px; }
.reader-top .info span { font-size: 12px; color: var(--text-2); }
.mushaf {
  position: relative; margin: 8px auto 0; width: min(100% - 16px, 680px);
  background: var(--page-paper); color: var(--page-ink); border-radius: 10px; padding: 26px 22px 16px;
  box-shadow: var(--shadow), inset 0 0 0 1px var(--gold), inset 0 0 0 5px var(--page-paper), inset 0 0 0 6px rgba(200, 160, 74, .55);
}
.mushaf.loading { min-height: 60vh; display: grid; place-items: center; text-align: center; color: var(--text-2); }
.page-text { font-family: var(--font-quran); font-size: var(--qsize, 26px); line-height: 2.2; text-align: justify; text-align-last: center; direction: rtl; }
.page-text .ayah { cursor: pointer; border-radius: 6px; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background .2s; }
.page-text .ayah.sel { background: rgba(200, 160, 74, .24); }
.page-text .ayah.marked { text-decoration: underline 1.5px; text-decoration-color: var(--gold); text-underline-offset: 12px; }
.ayah-num { font-family: var(--font-ui); font-size: .48em; font-weight: 600; display: inline-grid; place-items: center; min-width: 2em; height: 2em; margin: 0 .2em; vertical-align: .3em; line-height: 1; color: var(--gold-ink); position: relative; }
:root[data-theme="dark"] .ayah-num { color: var(--gold-2); }
.ayah-num::before { content: ""; position: absolute; inset: 0; border: 1.3px solid var(--gold); border-radius: 50%; }
.surah-banner { display: block; margin: 8px 0 6px; padding: 8px 0; text-align: center; font-family: var(--font-naskh); font-weight: 700; font-size: 22px; color: var(--ivory); background: linear-gradient(90deg, var(--navy-2), var(--navy-3), var(--navy-2)); border-radius: 8px; box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 0 3px var(--navy-2), inset 0 0 0 4px rgba(200, 160, 74, .6); }
.basmala { display: block; text-align: center; font-family: var(--font-quran); margin: 4px 0; }
.page-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-family: var(--font-ui); font-size: 12px; color: var(--text-2); }
.page-foot b { color: var(--accent); }
.page-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: min(100%, 680px); margin: 0 auto; padding: 12px 10px calc(var(--safe-b) + 14px); }
body.has-player .page-nav { padding-bottom: calc(var(--safe-b) + var(--mini-h) + 24px); }

.khatma { padding: 18px; }
.khatma h3 { margin: 0 0 2px; font-size: 17px; }
.khatma .progress { margin: 14px 0 8px; }
.khatma-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.result { padding: 12px 10px; border-radius: 12px; }
.result + .result { border-top: 1px solid var(--line); border-radius: 0; }
.result .q { font-family: var(--font-naskh); font-size: 19px; line-height: 1.9; }
.result mark { background: var(--accent-bg); color: inherit; border-radius: 4px; padding: 0 2px; }

/* ============ لوحة سفلية ============ */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(5, 12, 28, .5); z-index: 50; animation: fade .2s ease; }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 51; max-width: var(--max); margin: 0 auto; background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 18px calc(var(--safe-b) + 20px); max-height: 88dvh; overflow: auto; animation: rise .25s ease; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); }
.sheet .grip { width: 42px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.sheet-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 4px; }
.sheet-actions button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; background: var(--surface-2); font-size: 13px; }
.sheet-actions svg { color: var(--accent); }
.tafsir { font-family: var(--font-naskh); font-size: 19px; line-height: 2; margin-top: 10px; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ============ الأذكار ============ */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cat { position: relative; padding: 16px 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.cat .c-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent); }
.cat b { font-size: 15px; }
.cat small { color: var(--text-3); font-size: 12px; }
.cat .done-mark { position: absolute; top: 12px; inset-inline-end: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; }
.cat.wide { grid-column: span 2; flex-direction: row; align-items: center; min-height: 0; background: linear-gradient(160deg, var(--navy-3), var(--navy-2)); color: var(--ivory); }
.cat.wide .c-ico { background: rgba(230, 205, 140, .15); color: var(--gold-2); }
.cat.wide small { color: rgba(247, 242, 230, .7); }

.dhikr-head { position: sticky; top: 0; z-index: 5; margin: 0 calc(-1 * var(--gutter)); padding: calc(var(--safe-t) + 8px) var(--gutter) 10px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.dhikr { display: block; width: 100%; text-align: start; margin-bottom: 12px; padding: 18px 18px 14px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); transition: opacity .3s, transform .12s; }
.dhikr:active { transform: scale(.99); }
.dhikr .d-label { display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-bg); padding: 2px 10px; border-radius: 999px; margin-bottom: 8px; }
.dhikr .d-text { font-family: var(--font-naskh); font-size: 21px; line-height: 2; }
.dhikr .d-text.quran { font-family: var(--font-quran); }
.dhikr .d-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.dhikr .d-src { font-size: 13px; color: var(--text-2); }
.counter { flex: none; min-width: 56px; height: 56px; padding: 0 10px; border-radius: 28px; display: grid; place-items: center; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--navy); color: var(--gold-2); }
:root[data-theme="dark"] .counter { background: var(--gold); color: var(--navy-2); }
.dhikr.done { opacity: .5; }
.dhikr.done .counter { background: var(--ok); color: #fff; }
.done-banner { text-align: center; padding: 26px 16px; }
.done-banner h2 { margin: 0 0 6px; }

/* ============ السبحة ============ */
.tasbih { text-align: center; user-select: none; -webkit-user-select: none; }
.tasbih .t-phrase { font-family: var(--font-naskh); font-size: 26px; line-height: 1.7; min-height: 1.8em; margin: 8px 0; }
.ring-btn { position: relative; width: min(76vw, 300px); aspect-ratio: 1; margin: 10px auto 18px; border-radius: 50%; touch-action: manipulation; display: block; background: radial-gradient(circle at 50% 40%, var(--navy-3), var(--navy-2)); box-shadow: 0 18px 40px rgba(10, 26, 56, .3), inset 0 0 0 2px rgba(230, 205, 140, .3); color: var(--ivory); }
.ring-btn:active { transform: scale(.985); }
.ring-btn svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-btn .bead { fill: rgba(230, 205, 140, .22); transition: fill .15s; }
.ring-btn .bead.on { fill: var(--gold-2); }
.ring-count { position: absolute; inset: 0; display: grid; place-content: center; }
.ring-count strong { font-size: 62px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; color: var(--gold-2); }
.ring-count span { font-size: 14px; color: rgba(247, 242, 230, .7); margin-top: 8px; }
.stats { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.stats div { padding: 10px 18px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; color: var(--text-2); }
.stats b { display: block; font-size: 18px; color: var(--text); }

/* ============ القبلة ============ */
.compass { position: relative; width: min(84vw, 330px); aspect-ratio: 1; margin: 14px auto; }
.compass svg { width: 100%; height: 100%; overflow: visible; }
.compass .face { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.compass .dial { transition: transform .25s linear; transform-origin: 50% 50%; }
.compass .tick { stroke: var(--text-3); }
.compass .tick.major { stroke: var(--text); stroke-width: 2; }
.compass .cardinal { fill: var(--text); font-size: 13px; font-weight: 600; font-family: var(--font-ui); text-anchor: middle; dominant-baseline: middle; }
.compass .cardinal.n { fill: var(--danger); }
.compass .qline { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.compass .kaaba { fill: #111; stroke: var(--gold); stroke-width: 2; }
.compass .needle { fill: var(--navy); }
:root[data-theme="dark"] .compass .needle { fill: var(--ivory); }
.compass.aligned .face { stroke: var(--ok); stroke-width: 4; }
.q-read { text-align: center; }
.q-read strong { font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; }
.q-read p { margin: 2px 0 12px; color: var(--text-2); }

/* ============ يومي / المتابعة ============ */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.week .d { font-size: 12px; color: var(--text-2); }
.week .today .d { color: var(--accent); font-weight: 700; }
.week svg { width: 40px; height: 40px; margin: 6px auto 0; }
.week circle { fill: none; stroke-width: 4; }
.week .bg { stroke: var(--line); }
.week .fg { stroke: var(--gold); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.stars-row { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.stars-row svg { color: var(--line); }
.stars-row svg.on { color: var(--gold); }
.goals { list-style: none; margin: 0; padding: 4px 6px; }
.goals li + li { border-top: 1px solid var(--line); }
.goals label { display: flex; align-items: center; gap: 12px; padding: 13px 8px; cursor: pointer; }
.goals input { position: absolute; opacity: 0; pointer-events: none; }
.goals .box { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; flex: none; }
.goals input:checked + .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.goals input:focus-visible + .box { outline: 2px solid var(--gold); outline-offset: 2px; }
.goals .g-main { flex: 1; }
.goals .g-main small { display: block; font-size: 12px; color: var(--text-3); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); font-size: 18px; font-weight: 700; }
.stepper b { min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; }

/* ============ جداول ============ */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
table.times { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.times th { position: sticky; top: 0; background: var(--navy); color: var(--gold-2); font-weight: 600; padding: 10px 3px; white-space: nowrap; }
table.times td { padding: 8px 3px; text-align: center; border-top: 1px solid var(--line); white-space: nowrap; }
table.times td:first-child { text-align: start; padding-inline-start: 10px; line-height: 1.35; }
table.times td:first-child small { font-size: 10.5px; }
table.times tr.today td { background: var(--accent-bg); font-weight: 700; }
table.times tr.fri td:first-child { color: var(--accent); }

/* ============ التقويم ============ */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head h2 { margin: 0; font-size: 19px; text-align: center; }
.cal-head h2 small { display: block; font-size: 13px; color: var(--text-2); font-weight: 400; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 10px; }
.cal .wd { text-align: center; font-size: 12px; color: var(--text-3); padding-bottom: 4px; }
.cal .day { aspect-ratio: 1; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 600; position: relative; }
.cal .day small { font-size: 10px; color: var(--text-3); font-weight: 400; }
.cal .day.today { background: var(--navy); color: var(--gold-2); }
.cal .day.today small { color: rgba(230, 205, 140, .8); }
:root[data-theme="dark"] .cal .day.today { background: var(--gold); color: var(--navy-2); }
:root[data-theme="dark"] .cal .day.today small { color: var(--navy-2); }
.cal .day.ev::after { content: ""; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.cal .day.white { box-shadow: inset 0 0 0 1px var(--line); }

/* ============ النماذج ============ */
.form-group { margin-bottom: 18px; }
.form-group > h2 { font-size: 14px; font-weight: 600; color: var(--text-2); margin: 0 6px 8px; }
.form-group > .card { padding: 2px 16px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; min-height: 56px; }
.field + .field, .card > .field + details, .card > details + .field { border-top: 1px solid var(--line); }
.field > span:first-child { flex: 1; min-width: 0; }
.field small { display: block; color: var(--text-2); font-size: 12px; }
.field select, .field input[type="time"], .field input[type="number"], .field input[type="text"] { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 10px; max-width: 55%; }
.field input[type="number"] { width: 86px; text-align: center; }
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 50px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 30px; background: var(--line); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + i { background: var(--gold); }
.switch input:checked + i::after { transform: translateX(-20px); }
.switch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }
.input { width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 14px; }
.calc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.calc-row + .calc-row { border-top: 1px solid var(--line); }
.calc-row label { flex: 1; }
.calc-row input { width: 46%; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px; text-align: end; }
.calc-result { text-align: center; padding: 20px; }
.calc-result strong { display: block; font-size: 32px; color: var(--gold-2); font-variant-numeric: tabular-nums; }

/* ============ أسماء الله الحسنى ============ */
.names { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.names div { aspect-ratio: 1.15; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6px; }
.names b { font-family: var(--font-naskh); font-size: 22px; line-height: 1.4; }
.names small { font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ============ الأذان والترحيب والتنبيه ============ */
.adhan-overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-content: center; text-align: center; padding: 30px; background: radial-gradient(circle at 50% 30%, var(--navy-3), var(--navy-2) 70%); color: var(--ivory); animation: fade .4s ease; }
.adhan-overlay .label { color: rgba(247, 242, 230, .7); }
.adhan-overlay h2 { font-size: 48px; margin: 4px 0 4px; color: var(--gold-2); }
.adhan-overlay p { font-family: var(--font-naskh); font-size: 22px; margin: 0 0 28px; }

.welcome { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 30px 22px calc(var(--safe-b) + 30px); max-width: 520px; margin: 0 auto; text-align: center; }
.welcome .logo { width: 104px; height: 104px; margin: 0 auto 18px; border-radius: 28px; box-shadow: 0 16px 40px rgba(10, 26, 56, .3); }
.welcome h1 { font-size: 38px; margin: 0; }
.welcome .lead { color: var(--text-2); font-size: 17px; margin: 6px 0 28px; }
.welcome .btn { margin-bottom: 10px; }

.toast { position: fixed; inset-inline: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 80; max-width: 460px; margin: 0 auto; padding: 12px 18px; border-radius: 14px; background: var(--navy-2); color: var(--ivory); font-size: 15px; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: rise .25s ease; border: 1px solid rgba(230, 205, 140, .25); }
body.has-player .toast { bottom: calc(var(--nav-h) + var(--mini-h) + var(--safe-b) + 22px); }

@media (min-width: 720px) {
  :root { --gutter: 24px; }
  .quick { grid-template-columns: repeat(8, 1fr); }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .names { grid-template-columns: repeat(5, 1fr); }
}
