/* معاينة التطبيقات في صفحة /apps: إطارات الأجهزة والتطبيق الذي يعمل داخلها (device-app.js).
   كل القواعد محصورة تحت .mapp و.mdev فلا تتداخل مع أنماط الموقع */
@font-face { font-family: 'KFGQPC Hafs'; src: url('/fonts/uthmanic-hafs-v22.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'AlQalam IndoPak'; src: url('/fonts/alqalam-quran-majeed.ttf') format('truetype'); font-display: swap; }
.mapp { --font: var(--font-ar); --q-madani: 'KFGQPC Hafs', 'Amiri', serif; --q-indo: 'AlQalam IndoPak', 'Amiri', serif; --urdu: 'Noto Nastaliq Urdu', serif; }
/* ===== إطارات الأجهزة ===== */
.mdev .frame { position: relative; background: #1b1d20; box-shadow: inset 0 0 0 2px #3b3f45, inset 0 0 0 5px #111214, 0 40px 80px -30px rgba(2, 40, 44, .55); }
.mdev .screen { position: relative; width: 100%; height: 100%; overflow: hidden; background: #000; isolation: isolate; }
.mdev--iphone .frame { width: 417px; height: 876px; padding: 12px; border-radius: 66px; }
.mdev--iphone .screen { border-radius: 54px; }
.mdev--iphone .frame::before, .mdev--iphone .frame::after { content: ""; position: absolute; width: 4px; border-radius: 2px; background: #2c2f34; }
.mdev--iphone .frame::before { left: -4px; top: 170px; height: 64px; box-shadow: 0 84px 0 #2c2f34; }
.mdev--iphone .frame::after { right: -4px; top: 230px; height: 100px; }
.mdev .island { position: absolute; top: 11px; left: 50%; translate: -50% 0; width: 124px; height: 36px; border-radius: 20px; background: #000; z-index: 30; }
.mdev .homebar { position: absolute; bottom: 8px; left: 50%; translate: -50% 0; width: 136px; height: 5px; border-radius: 3px; background: currentColor; opacity: .85; z-index: 30; pointer-events: none; }
.mdev--android .frame { width: 432px; height: 936px; padding: 10px; border-radius: 46px; background: #23262b; }
.mdev--android .screen { border-radius: 36px; }
.mdev--android .frame::after { content: ""; position: absolute; right: -4px; top: 200px; width: 4px; height: 120px; border-radius: 2px; background: #33373d; box-shadow: 0 150px 0 -40px #33373d; }
.mdev .punch { position: absolute; top: 12px; left: 50%; translate: -50% 0; width: 14px; height: 14px; border-radius: 50%; background: #000; box-shadow: 0 0 0 2px #15171a; z-index: 30; }
.mdev .gesture { position: absolute; bottom: 7px; left: 50%; translate: -50% 0; width: 110px; height: 4px; border-radius: 2px; background: currentColor; opacity: .6; z-index: 30; pointer-events: none; }
.mdev--ipad .frame { width: 1220px; height: 860px; padding: 20px; border-radius: 46px; }
.mdev--ipad .screen { border-radius: 26px; }
.mdev--ipad .frame::before { content: ""; position: absolute; top: 8px; left: 50%; width: 6px; height: 6px; border-radius: 50%; background: #2f3338; }
.mdev--web .frame { width: 1280px; height: 820px; padding: 0; border-radius: 14px; background: #dfe7e8; box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 40px 80px -30px rgba(2, 40, 44, .45); overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.mdev--web .screen { border-radius: 0; }
.mdev .chrome { direction: ltr; background: #e6eced; border-bottom: 1px solid #cfd9da; font-family: -apple-system, 'Segoe UI', sans-serif; color: #3b4b4d; }
.mdev .chrome__tabs { display: flex; align-items: end; gap: 8px; padding: 10px 14px 0; }
.mdev .lights { display: flex; gap: 8px; padding: 0 8px 12px 0; }
.mdev .lights i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.mdev .lights i:nth-child(2) { background: #febc2e; }
.mdev .lights i:nth-child(3) { background: #28c840; }
.mdev .tab { display: flex; align-items: center; gap: 8px; padding: 8px 14px; min-width: 220px; border-radius: 10px 10px 0 0; background: #fff; font-size: 12px; }
.mdev .tab__ico { width: 14px; height: 14px; border-radius: 4px; background: var(--brand); }
.mdev .chrome__bar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: #fff; }
.mdev .chrome__nav { display: flex; gap: 10px; color: #8a9799; font-size: 15px; }
.mdev .url { flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: #eef2f3; font-size: 13px; color: #3b4b4d; }
.mdev .url svg { width: 12px; height: 12px; fill: none; stroke: #6c7b7d; stroke-width: 2; }
/* ===== التطبيق ===== */
.mapp {
  --a-bg: #f5f9f9; --a-card: #ffffff; --a-ink: #10292c; --a-sub: #60777a; --a-line: #dfeced; --a-brand: #017c86; --a-deep: #024d54; --a-soft: #e3f3f4; --a-gilt: #b08a35; --a-sel: #fbf5e6; --a-hero: #024d54; --a-hero-ink: #eaf7f7;
  height: 100%; display: flex; flex-direction: column; background: var(--a-bg); color: var(--a-ink); font-family: var(--font); position: relative; direction: rtl; font-size: 15px; line-height: 1.6; transition: background .3s, color .3s;
}
.mapp.is-dark { --a-bg: #071c1e; --a-card: #0d2629; --a-ink: #e6f3f4; --a-sub: #93b1b4; --a-line: #183b3f; --a-brand: #4ccbd4; --a-deep: #a5e4e8; --a-soft: #10353a; --a-gilt: #d8b464; --a-sel: #2a2614; --a-hero: #0b3236; --a-hero-ink: #e6f3f4; }
.mapp button { font: inherit; color: inherit; cursor: pointer; }
.mapp svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mapp .sbar { direction: ltr; display: flex; justify-content: space-between; align-items: center; padding: 0 30px; height: 54px; flex: none; font-family: -apple-system, 'SF Pro Text', 'Segoe UI', sans-serif; font-weight: 600; font-size: 16px; background: var(--a-hero); color: var(--a-hero-ink); }
.mapp .sbar__ico { display: flex; gap: 6px; align-items: center; }
.mapp .sbar__ico svg { width: 18px; height: 18px; stroke-width: 2; }
.mapp .sbar__batt { width: 26px; height: 12px; border: 1.5px solid currentColor; border-radius: 4px; padding: 1.5px; opacity: .9; }
.mapp .sbar__batt::before { content: ""; display: block; width: 80%; height: 100%; border-radius: 1.5px; background: currentColor; }
.mapp--android .sbar { height: 38px; padding: 0 22px; font-family: Roboto, 'Segoe UI', sans-serif; font-size: 14px; font-weight: 400; }
.mapp--ipad .sbar { height: 26px; padding: 0 22px; font-size: 13px; background: var(--a-card); color: var(--a-ink); }
.mapp--web .sbar { display: none; }
/* رأس التطبيق على الجوال */
.mapp .hero { background: var(--a-hero); color: var(--a-hero-ink); padding: 4px 18px 16px; flex: none; display: grid; gap: 10px; }
.mapp .hero__top { display: flex; justify-content: space-between; align-items: center; }
.mapp .hero__brand { font-size: .78rem; opacity: .8; }
.mapp .hero__btns { display: flex; gap: 6px; }
.mapp .ibtn { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; border: 0; background: rgba(255,255,255,.1); }
.mapp .hero__title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.mapp .hero__title h2 { margin: 0; font-size: 1.6rem; font-weight: 600; line-height: 1.3; }
.mapp .hero__title span { font-size: .78rem; opacity: .8; }
.mapp .seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; border-radius: 12px; background: rgba(255,255,255,.1); }
.mapp .seg button { border: 0; background: none; border-radius: 9px; padding: 6px 4px; font-size: .8rem; font-weight: 600; opacity: .8; transition: background .2s, color .2s; }
.mapp .seg button.on { background: var(--a-hero-ink); color: var(--a-hero); opacity: 1; }
.mapp .seg--light { background: var(--a-soft); }
.mapp .seg--light button.on { background: var(--a-deep); color: var(--a-bg); }
.mapp .scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 20px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--a-line) transparent; }
.mapp .bism { text-align: center; font-family: var(--q-madani); font-size: 26px; color: var(--a-brand); padding: 6px 0 14px; line-height: 2; }
.mapp .bism.indo { font-family: var(--q-indo); }
.mapp .vlist { display: grid; gap: 10px; }
.mapp .v { background: var(--a-card); border: 1px solid var(--a-line); border-radius: 18px; padding: 10px 14px 12px; transition: background .25s, border-color .25s; cursor: pointer; }
.mapp .v.is-sel { background: var(--a-sel); border-color: var(--a-gilt); }
.mapp .v__head { display: flex; align-items: center; gap: 8px; }
.mapp .v__num { width: 30px; height: 30px; display: grid; place-items: center; font-size: .78rem; font-weight: 600; color: var(--a-deep);
  background: no-repeat center / 100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath d='M15 1.5l3.9 3.1 4.9-.4.8 4.9 4 2.9-2 4.5 1 4.9-4.6 1.8-2.4 4.3-4.7-1.4-4.7 1.4-2.4-4.3-4.6-1.8 1-4.9-2-4.5 4-2.9.8-4.9 4.9.4z' fill='none' stroke='%23b08a35' stroke-width='1.2'/%3E%3C/svg%3E"); }
.mapp .v__ref { font-size: .74rem; color: var(--a-sub); }
.mapp .v__acts { margin-inline-start: auto; display: flex; gap: 2px; }
.mapp .v__acts button { width: 32px; height: 32px; border: 0; background: none; border-radius: 10px; display: grid; place-items: center; color: var(--a-sub); }
.mapp .v__acts button:hover { background: var(--a-soft); color: var(--a-brand); }
.mapp .v__acts button.on { color: var(--a-gilt); }
.mapp .v__acts button.on svg { fill: currentColor; }
.mapp .v__body { display: grid; gap: 4px; }
.mapp .q { font-family: var(--q-madani); font-size: var(--qs, 30px); line-height: 2.1; text-align: center; color: var(--a-ink); padding: 4px 0 2px; }
.mapp .q.indo { font-family: var(--q-indo); line-height: 2.3; }
/* رقم الآية في الرسم الهندي: دائرة خط القلم ورقم بداخلها */
.mapp .q .m { position: relative; display: inline-block; color: var(--a-gilt); }
.mapp .q .m b { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 400; font-size: .42em; color: var(--a-ink); padding-top: .15em; }
.mapp .q .end { font-family: var(--q-madani); color: var(--a-gilt); }
.mapp .q .w { white-space: nowrap; }
.mapp .cmp { display: grid; gap: 6px; }
.mapp .cmp__item { border-radius: 12px; background: var(--a-bg); padding: 2px 10px 4px; }
.mapp .cmp__tag { display: block; text-align: center; font-size: .66rem; color: var(--a-sub); padding-top: 4px; }
.mapp .cmp .q { font-size: calc(var(--qs, 30px) * .82); padding: 0; }
.mapp .u { border-top: 1px dashed var(--a-line); padding-top: 6px; font-family: var(--urdu); font-size: 17px; line-height: 2.35; text-align: center; color: var(--a-ink); }
.mapp .u__lab { display: block; font-family: var(--font); font-size: .64rem; line-height: 1.6; color: var(--a-gilt); }
.mapp .empty { text-align: center; color: var(--a-sub); padding: 40px 20px; border: 1px dashed var(--a-line); border-radius: 18px; font-size: .9rem; }
.mapp .empty svg { width: 34px; height: 34px; display: block; margin: 0 auto 8px; color: var(--a-gilt); }
/* شريط التبويب السفلي */
.mapp .tabs { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--a-card); border-top: 1px solid var(--a-line); padding: 6px 8px 30px; }
.mapp--android .tabs { padding-bottom: 20px; }
.mapp .tabs button { border: 0; background: none; display: grid; justify-items: center; gap: 2px; font-size: .7rem; color: var(--a-sub); padding: 4px 0; }
.mapp .tabs button svg { width: 24px; height: 24px; }
.mapp .tabs button.on { color: var(--a-brand); font-weight: 600; }
.mapp--android .tabs button.on svg { background: var(--a-soft); border-radius: 14px; padding: 2px 14px; width: 56px; box-sizing: content-box; height: 22px; }
/* الورقة المنبثقة */
.mapp .veil { position: absolute; inset: 0; background: rgba(0, 20, 22, .4); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 10; }
.mapp .sheet { position: absolute; inset: auto 0 0; z-index: 11; background: var(--a-card); border-radius: 26px 26px 0 0; padding: 8px 18px 34px; transform: translateY(105%); transition: transform .35s cubic-bezier(.16,1,.3,1); max-height: 78%; display: flex; flex-direction: column; gap: 12px; }
.mapp.sheet-open .veil { opacity: 1; pointer-events: auto; }
.mapp.sheet-open .sheet { transform: none; }
.mapp .sheet__grab { width: 40px; height: 5px; border-radius: 3px; background: var(--a-line); margin: 0 auto 4px; }
.mapp .sheet h3 { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--a-deep); }
.mapp .sheet__body { overflow-y: auto; display: grid; gap: 10px; }
/* الفهرس والإعدادات (مشتركة بين الجوال والشاشة الواسعة) */
.mapp .search { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--a-bg); border: 1px solid var(--a-line); color: var(--a-sub); }
.mapp .search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: inherit; font-size: .88rem; color: var(--a-ink); }
.mapp .slist { display: grid; gap: 6px; }
.mapp .srow { display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid var(--a-line); background: var(--a-card); border-radius: 14px; padding: 10px 12px; text-align: start; }
.mapp .srow.on { border-color: var(--a-brand); background: var(--a-soft); }
.mapp .srow__n { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--a-soft); color: var(--a-deep); font-size: .8rem; font-weight: 600; }
.mapp .srow.on .srow__n { background: var(--a-brand); color: var(--a-card); }
.mapp .srow__t { display: grid; line-height: 1.4; }
.mapp .srow__t b { font-weight: 600; }
.mapp .srow__t small { color: var(--a-sub); font-size: .72rem; }
.mapp .srow__ur { margin-inline-start: auto; font-family: var(--urdu); font-size: .8rem; color: var(--a-sub); line-height: 2; }
.mapp .hits { display: grid; gap: 6px; }
.mapp .hit { border: 1px solid var(--a-line); background: var(--a-card); border-radius: 12px; padding: 6px 10px; text-align: start; font-size: .8rem; color: var(--a-sub); }
.mapp .hit b { color: var(--a-brand); font-weight: 600; }
.mapp .set { display: grid; gap: 12px; }
.mapp .set__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .88rem; }
.mapp .set__row input[type=range] { width: 130px; accent-color: var(--a-brand); }
.mapp .switch { width: 46px; height: 28px; border-radius: 14px; border: 0; background: var(--a-line); position: relative; transition: background .2s; padding: 0; }
.mapp .switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: right .2s; }
.mapp .switch.on { background: var(--a-brand); }
.mapp .switch.on::after { right: 21px; }
.mapp .sample { font-family: var(--q-madani); text-align: center; font-size: var(--qs, 30px); line-height: 2; padding: 4px; border-radius: 12px; background: var(--a-bg); }
.mapp .toast { position: absolute; left: 50%; bottom: 100px; translate: -50% 10px; z-index: 20; background: var(--a-deep); color: var(--a-bg); font-size: .82rem; padding: 6px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .25s, translate .25s; white-space: nowrap; }
.mapp .toast.show { opacity: 1; translate: -50% 0; }
/* ===== الشاشة الواسعة: آيباد والموقع ===== */
.mapp .wide { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.mapp .side { background: var(--a-card); border-inline-end: 1px solid var(--a-line); padding: 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.mapp .side__brand { display: flex; align-items: center; gap: 10px; }
.mapp .side__mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--a-hero); color: var(--a-gilt); font-family: var(--q-madani); font-size: 22px; }
.mapp .side__brand b { display: block; font-weight: 600; color: var(--a-deep); line-height: 1.3; }
.mapp .side__brand small { color: var(--a-sub); font-size: .72rem; }
.mapp .side h4 { margin: 4px 0 0; font-size: .74rem; font-weight: 600; color: var(--a-sub); }
.mapp .main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.mapp .mhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 28px; border-bottom: 1px solid var(--a-line); background: var(--a-bg); }
.mapp .mhead h2 { margin: 0; font-size: 1.5rem; font-weight: 600; color: var(--a-deep); line-height: 1.3; }
.mapp .mhead small { color: var(--a-sub); font-size: .8rem; }
.mapp .mhead .seg { width: 340px; }
.mapp .mhead__acts { display: flex; align-items: center; gap: 10px; }
.mapp .mhead .ibtn { background: var(--a-soft); color: var(--a-deep); }
.mapp--wide .scroll { padding: 20px 28px 28px; }
.mapp--wide .vlist { max-width: 980px; margin: 0 auto; gap: 12px; }
.mapp--wide .v { padding: 12px 20px 14px; }
.mapp--wide .v__body { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; gap: 22px; }
.mapp--wide .u { border-top: 0; border-inline-start: 1px dashed var(--a-line); padding: 0 20px 0 0; text-align: right; }
.mapp--wide .v__body.notr { grid-template-columns: 1fr; }
.mapp--wide .cmp { grid-template-columns: 1fr 1fr; }
.mapp--wide .v__body:has(.cmp) { grid-template-columns: 1fr; }
.mapp--wide .v__body:has(.cmp) .u { border-inline-start: 0; border-top: 1px dashed var(--a-line); padding: 6px 0 0; text-align: center; }
.mapp--wide .toast { bottom: 30px; }
.mapp .webnav { display: none; }
.mapp--web .webnav { display: flex; align-items: center; justify-content: space-between; padding: 0 28px; height: 58px; background: var(--a-hero); color: var(--a-hero-ink); flex: none; }
.mapp .webnav nav { display: flex; gap: 22px; font-size: .88rem; opacity: .85; }
.mapp .webnav nav span:first-child { opacity: 1; font-weight: 600; border-bottom: 2px solid var(--a-gilt); }
.mapp .webnav b { font-weight: 600; }
.mapp--web .side__brand { display: none; }
/* واجهة التطبيق بالأردية: خط النستعليق بمسافات أسطر تناسبه، واسم السورة العربي بالخط العربي */
.mapp--ur { --font: var(--urdu); line-height: 2; }
.mapp--ur .srow__ur { font-family: var(--font-ar); }
.mapp--ur .seg button { font-size: .72rem; line-height: 2.1; padding-block: 2px 4px; }
.mapp--ur .tabs button { font-size: .62rem; line-height: 2.2; }
.mapp--ur .hero__brand, .mapp--ur .v__ref, .mapp--ur .cmp__tag, .mapp--ur .u__lab { line-height: 2.2; }
