/* Sakīnah — design system
   Calm · dignity · spirituality · scientific credibility
   All colour is tokenised; light / dark / high-contrast variants below. */

/* ---------- Fonts (self-hosted, SIL OFL 1.1 — see assets/fonts/OFL-LICENSE.txt) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/inter-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/inter-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/inter-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/source-serif-4-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/source-serif-4-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Amiri"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/amiri-arabic-400-normal.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Amiri"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(../fonts/amiri-arabic-700-normal.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Naskh Arabic"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/noto-naskh-arabic-arabic-400-normal.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Naskh Arabic"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/noto-naskh-arabic-arabic-600-normal.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Nastaliq Urdu"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/noto-nastaliq-urdu-arabic-400-normal.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Nastaliq Urdu"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/noto-nastaliq-urdu-arabic-600-normal.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

/* ---------- Tokens ---------- */
:root {
  --bg: #F6F3EC;
  --bg-tint: #EFEADF;
  --surface: #FFFFFF;
  --surface-2: #F2EEE5;
  --ink: #1D2729;
  --ink-2: #3F4C4E;
  --muted: #5B6668;
  --primary: #255E58;
  --primary-hover: #1C4B46;
  --primary-ink: #FFFFFF;
  --primary-soft: #DDEBE7;
  --accent: #74531C;
  --accent-soft: #F3E8D3;
  --line: #D9D1C1;
  --line-strong: #B9AF9C;
  --danger: #9B2F25;
  --danger-soft: #F8E3DF;
  --warn-soft: #FBF0D9;
  --focus: #1B5B9E;
  --orb-a: #9CCBC2;
  --orb-b: #2C6C65;
  --shadow: 0 1px 2px rgba(29,39,41,.06), 0 6px 24px rgba(29,39,41,.06);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --font-head: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-quran: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;
  --font-ar-ui: "Noto Naskh Arabic", "Amiri", "Segoe UI", Tahoma, sans-serif;
  --font-ur: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Noto Naskh Arabic", serif;
  --text-scale: 1;
  --tap: 48px;
  --gutter: 16px;
  --maxw: 1080px;
  --header-h: 60px;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1517; --bg-tint: #121C1F; --surface: #152023; --surface-2: #1A272A;
    --ink: #EAE6DC; --ink-2: #C9CFCC; --muted: #A3ADAB;
    --primary: #84C6BB; --primary-hover: #9ED6CC; --primary-ink: #0B1214; --primary-soft: #1D3633;
    --accent: #D8B97F; --accent-soft: #2C271C; --line: #2B3B3F; --line-strong: #44565A;
    --danger: #F2958A; --danger-soft: #3A1E1B; --warn-soft: #33291A; --focus: #8BB8F0;
    --orb-a: #2E5E58; --orb-b: #8FD0C4;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1517; --bg-tint: #121C1F; --surface: #152023; --surface-2: #1A272A;
  --ink: #EAE6DC; --ink-2: #C9CFCC; --muted: #A3ADAB;
  --primary: #84C6BB; --primary-hover: #9ED6CC; --primary-ink: #0B1214; --primary-soft: #1D3633;
  --accent: #D8B97F; --accent-soft: #2C271C; --line: #2B3B3F; --line-strong: #44565A;
  --danger: #F2958A; --danger-soft: #3A1E1B; --warn-soft: #33291A; --focus: #8BB8F0;
  --orb-a: #2E5E58; --orb-b: #8FD0C4;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25);
  color-scheme: dark;
}
:root[data-contrast="high"] {
  --bg: #FFFFFF; --bg-tint: #FFFFFF; --surface: #FFFFFF; --surface-2: #F2F2F2;
  --ink: #000000; --ink-2: #000000; --muted: #222222;
  --primary: #00423C; --primary-hover: #002B27; --primary-ink: #FFFFFF; --primary-soft: #E2F0ED;
  --accent: #5A3E00; --line: #000000; --line-strong: #000000; --focus: #0040A0;
  --danger: #7A0000;
}
:root[data-theme="dark"][data-contrast="high"] {
  --bg: #000000; --bg-tint: #000000; --surface: #000000; --surface-2: #111111;
  --ink: #FFFFFF; --ink-2: #FFFFFF; --muted: #E6E6E6;
  --primary: #9FF0E2; --primary-hover: #C4FFF5; --primary-ink: #000000; --primary-soft: #0D2A26;
  --accent: #FFD98A; --line: #FFFFFF; --line-strong: #FFFFFF; --focus: #FFD400; --danger: #FFB0A8;
}
:root[data-size="large"] { --text-scale: 1.125; }
:root[data-size="xlarge"] { --text-scale: 1.25; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; font-size: calc(100% * var(--text-scale)); scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  min-height: 100vh; min-height: 100dvh;
}
html[lang="ar"] body { font-family: var(--font-ar-ui), var(--font-body); line-height: 1.8; }
html[lang="ur"] body { font-family: var(--font-ur), var(--font-body); line-height: 2.15; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { font-family: var(--font-ar-ui); }
html[lang="ur"] h1, html[lang="ur"] h2, html[lang="ur"] h3 { font-family: var(--font-ur); line-height: 2; }
img, svg { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.25; margin: 0 0 .5em; color: var(--ink); overflow-wrap: anywhere; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.3rem, 3.2vw, 1.7rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 1000; background: var(--primary); color: var(--primary-ink); padding: 10px 16px; border-radius: 10px; text-decoration: none; }
.skip-link:focus { top: 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

/* Arabic / Urdu content blocks (always correct direction regardless of UI language) */
.ar-text { font-family: var(--font-quran); direction: rtl; text-align: right; font-size: clamp(1.45rem, 5vw, 1.85rem); line-height: 2.25; color: var(--ink); overflow-wrap: break-word; word-spacing: .04em; }
.ar-text.lg { font-size: clamp(1.7rem, 6vw, 2.3rem); line-height: 2.3; }
.ur-text { font-family: var(--font-ur); direction: rtl; text-align: right; line-height: 2.3; font-size: 1.05rem; }
.translit { font-style: italic; color: var(--ink-2); }
.ltr { direction: ltr; unicode-bidi: isolate; }
bdi { unicode-bidi: isolate; }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 4px; }
.boot-orb { width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 12px; background: radial-gradient(circle at 35% 35%, var(--orb-a), var(--orb-b)); opacity: .8; }
.boot-title { font-family: var(--font-head); font-size: 1.6rem; margin: 0; }
.boot-sub { color: var(--muted); margin: 0; }
.noscript { max-width: 640px; margin: 40px auto; padding: 0 16px; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 720px; }
main { padding: 20px 0 calc(var(--tabbar-h) + 40px); min-height: 70vh; }
main:focus { outline: none; }
@media (min-width: 1100px) { main { padding-bottom: 64px; } }
.section { margin: 28px 0; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid.sm { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.lead { font-size: 1.12rem; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.2) blur(8px); -webkit-backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--line); }
@supports not (background: color-mix(in srgb, red 50%, blue)) { .site-header { background: var(--bg); } }
.header-inner { display: flex; align-items: center; gap: 10px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 600; font-size: 1.2rem; margin-inline-end: auto; min-height: var(--tap); }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand small { display: block; font-family: var(--font-body); font-weight: 400; font-size: .72rem; color: var(--muted); letter-spacing: .02em; line-height: 1.2; }
html[lang="ur"] .brand small, html[lang="ar"] .brand small { font-family: inherit; }
.top-nav { display: none; }
.top-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; flex-wrap: wrap; }
.top-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 9px; white-space: nowrap; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-size: .93rem; }
.top-nav a:hover { background: var(--surface-2); color: var(--ink); }
.top-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
@media (min-width: 1240px) { .top-nav { display: block; } .brand small { display: none; } }
.top-nav ul { flex-wrap: nowrap; }
.help-link { white-space: nowrap; }
.header-inner > .icon-btn, .header-inner > .lang-select { flex: none; }
.top-nav { min-width: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: var(--tap); min-height: var(--tap); padding: 0 10px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--ink-2); text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.help-link { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); font-size: .88rem; font-weight: 600; }
.help-link:hover { color: var(--danger); background: var(--danger-soft); }
.lang-select { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 4px 8px; max-width: 108px; }

@media (max-width: 599px) { .site-header .lang-select, .site-header .hdr-settings { display: none; } .header-inner { gap: 4px; } .help-link { padding: 0 8px; } }
@media (max-width: 359px) { .brand small { display: none; } .brand { font-size: 1.05rem; } }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(88vw, 340px); background: var(--surface); z-index: 100; box-shadow: var(--shadow); display: flex; flex-direction: column; padding: 12px; overflow-y: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.drawer ul { list-style: none; margin: 0; padding: 0; }
.drawer a { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.drawer a:hover { background: var(--surface-2); }
.drawer a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.drawer a svg { width: 22px; height: 22px; flex: none; color: var(--muted); }

/* Bottom tab bar (mobile) */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); max-width: 640px; }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tabbar-h); text-decoration: none; color: var(--muted); font-size: .72rem; padding: 4px 2px; text-align: center; line-height: 1.2; }
html[lang="ur"] .tabbar a { font-size: .66rem; line-height: 1.6; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--primary); font-weight: 600; }
@media (min-width: 1100px) { .tabbar { display: none; } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 calc(var(--tabbar-h) + 28px); color: var(--muted); font-size: .9rem; background: var(--bg-tint); }
@media (min-width: 1100px) { .site-footer { padding-bottom: 32px; } }
.site-footer nav ul { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer a { color: var(--ink-2); display: inline-block; padding: 6px 0; }

/* ---------- Components ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1rem; line-height: 1.2; text-align: center; transition: background-color .2s, border-color .2s, color .2s; }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.btn.lg { min-height: 56px; padding: 14px 28px; font-size: 1.08rem; }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: .92rem; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin-bottom: .35em; }
.card.flat { box-shadow: none; }
.card.tint { background: var(--surface-2); box-shadow: none; }
.card-link { display: block; text-decoration: none; color: inherit; transition: border-color .2s, transform .2s; }
.card-link:hover { border-color: var(--primary); color: inherit; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); line-height: 1.6; white-space: normal; }
html[lang="ur"] .badge { line-height: 2; font-size: .74rem; }
.badge.e1, .badge.e2 { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.badge.e3 { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.badge.e4 { background: var(--surface-2); color: var(--ink-2); border-style: dashed; }
.badge.e5 { background: var(--warn-soft); color: var(--ink-2); border-style: dotted; }
.badge.review { background: transparent; border-style: dashed; color: var(--muted); }
.badge.ok { color: var(--primary); }

.notice { border-radius: var(--radius-sm); padding: 14px 16px; border: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 12px; align-items: flex-start; }
.notice svg { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.notice.info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.notice.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.notice p:last-child { margin-bottom: 0; }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.chip-group legend { font-weight: 600; margin-bottom: 10px; padding: 0; font-family: var(--font-head); font-size: 1.15rem; }
html[lang="ur"] .chip-group legend, html[lang="ar"] .chip-group legend { font-family: inherit; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: .97rem; transition: background-color .15s, border-color .15s; }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.chip input:checked + span::before { content: "✓"; font-weight: 700; }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }
.chip:hover span { border-color: var(--primary); }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label, .field .label { font-weight: 600; }
.field .hint { color: var(--muted); font-size: .9rem; }
.input, select.input, textarea.input { width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.6; }
.range-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
input[type="range"] { width: 100%; min-height: 40px; accent-color: var(--primary); }
.range-value { min-width: 2.6em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-2); border-radius: 8px; padding: 4px 8px; }
.range-ends { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); padding: 6px 0; }
.switch input { width: 28px; height: 28px; accent-color: var(--primary); flex: none; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs [role="tab"] { min-height: var(--tap); padding: 8px 14px; border: 0; background: transparent; border-bottom: 3px solid transparent; color: var(--ink-2); font-weight: 600; }
.tabs [role="tab"][aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }

.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain > li + li { border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 6px 14px; font-size: .92rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
details.disclosure { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
details.disclosure > summary { cursor: pointer; padding: 12px 14px; min-height: var(--tap); font-weight: 600; list-style-position: inside; }
details.disclosure > div { padding: 0 14px 14px; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.error-box { text-align: center; padding: 28px 16px; border: 1px solid var(--danger); border-radius: var(--radius); background: var(--danger-soft); }

/* ---------- Hero / Home ---------- */
.hero { position: relative; padding: 18px 0 8px; text-align: center; }
.hero::before { content: ""; position: absolute; inset: -20px 0 auto 0; height: 260px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%238A6528' stroke-width='0.8' opacity='0.18'%3E%3Cpath d='M48 14l9.9 24.1L82 48l-24.1 9.9L48 82l-9.9-24.1L14 48l24.1-9.9z'/%3E%3Crect x='26' y='26' width='44' height='44' transform='rotate(45 48 48)'/%3E%3Crect x='26' y='26' width='44' height='44'/%3E%3C/g%3E%3C/svg%3E"); -webkit-mask-image: radial-gradient(ellipse at center top, #000 0%, transparent 70%); mask-image: radial-gradient(ellipse at center top, #000 0%, transparent 70%); pointer-events: none; z-index: -1; }
.hero h1 { font-size: clamp(2.2rem, 8vw, 3.4rem); margin-bottom: .15em; }
.hero .tagline { font-size: clamp(1.05rem, 3.5vw, 1.3rem); color: var(--accent); letter-spacing: .03em; margin-bottom: .4em; }
.hero .hero-ar { font-family: var(--font-quran); font-size: 1.5rem; color: var(--muted); margin: 0; direction: rtl; }
.home-flow { max-width: 760px; margin: 0 auto; }
.step-block { margin: 22px 0; }
.home-cta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 22px 0 6px; }
.quick { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .quick { grid-template-columns: 1fr 1fr; } }
.one-min { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); background: var(--primary); color: var(--primary-ink); text-decoration: none; border: 0; width: 100%; text-align: start; min-height: 72px; }
.one-min:hover { background: var(--primary-hover); color: var(--primary-ink); }
.one-min svg { width: 34px; height: 34px; flex: none; }
.one-min strong { display: block; font-size: 1.1rem; }
.one-min span span { opacity: .9; font-size: .9rem; }
.philosophy { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); counter-reset: ph; list-style: none; padding: 0; margin: 0; }
.philosophy li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; counter-increment: ph; }
.philosophy li strong { display: block; font-family: var(--font-head); font-size: 1.1rem; color: var(--primary); }
html[lang="ur"] .philosophy li strong, html[lang="ar"] .philosophy li strong { font-family: inherit; }
.philosophy li strong::before { content: counter(ph) ". "; color: var(--accent); }

/* ---------- Content items ---------- */
.item-card .ar-text { font-size: clamp(1.3rem, 4.6vw, 1.6rem); margin: 6px 0 8px; }
.item-card .translation { color: var(--ink); }
.item-card .ref { color: var(--muted); font-size: .88rem; }
.provenance { margin-top: 16px; }
.fav-btn[aria-pressed="true"] { color: var(--accent); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.counter { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.counter-btn { width: 132px; height: 132px; border-radius: 50%; border: 2px solid var(--primary); background: var(--surface); color: var(--primary); font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.counter-btn:active { background: var(--primary-soft); }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: thin; }
.filters .chip span { white-space: nowrap; min-height: 42px; }

/* ---------- Player (session overlay) ---------- */
.player { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: flex; flex-direction: column; overflow-y: auto; }
.player-top { display: flex; align-items: center; gap: 10px; padding: 10px var(--gutter); padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 2; }
.player-top h2 { font-size: 1.05rem; margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.player-stages { display: flex; gap: 4px; padding: 10px var(--gutter) 0; list-style: none; margin: 0; flex-wrap: wrap; justify-content: center; }
.player-stages li { flex: 1 1 0; min-width: 24px; max-width: 110px; height: 6px; border-radius: 4px; background: var(--line); }
.player-stages li.done { background: var(--primary); opacity: .55; }
.player-stages li.current { background: var(--primary); }
.player-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px var(--gutter) 8px; text-align: center; gap: 12px; width: 100%; max-width: 760px; margin: 0 auto; }
.step-kicker { font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin: 0; }
html[lang="ur"] .step-kicker, html[lang="ar"] .step-kicker { letter-spacing: 0; text-transform: none; font-size: .95rem; }
.step-title { font-family: var(--font-head); font-size: clamp(1.4rem, 5vw, 2rem); margin: 0; }
html[lang="ur"] .step-title, html[lang="ar"] .step-title { font-family: inherit; }
.caption { font-size: clamp(1.08rem, 3.8vw, 1.3rem); color: var(--ink); max-width: 36ch; min-height: 3.2em; margin: 0 auto; }
html[lang="ur"] .caption { line-height: 2.2; }
.caption.off { display: none; }
.player-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.player-stats b { color: var(--ink); font-weight: 600; }
.player-controls { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 10px var(--gutter); padding-bottom: max(10px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.player-controls .btn { flex: 1 1 auto; min-width: 104px; max-width: 220px; }
.unwell { color: var(--danger); }
.transcript { text-align: start; max-width: 640px; width: 100%; max-height: 30vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface); font-size: .95rem; }
.transcript ol { margin: 0; padding-inline-start: 1.2em; }
.transcript li.now { font-weight: 600; color: var(--primary); }
.step-panel { width: 100%; text-align: start; }
.step-panel .ar-text { text-align: center; }

/* Breath orb */
.breath-stage { position: relative; width: min(70vw, 300px); aspect-ratio: 1; display: grid; place-items: center; margin: 4px auto; }
.breath-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px dashed var(--line-strong); opacity: .7; }
.breath-orb { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 38% 32%, var(--orb-a), var(--orb-b) 78%); transform: scale(.55); will-change: transform; box-shadow: 0 0 0 10px color-mix(in srgb, var(--orb-b) 10%, transparent); }
.breath-label { position: relative; z-index: 1; display: grid; gap: 0; text-align: center; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.35); }
:root[data-theme="dark"] .breath-label { color: #06100F; text-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .breath-label { color: #06100F; text-shadow: none; } }
.breath-phase { font-size: clamp(1.2rem, 5vw, 1.6rem); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
html[lang="ur"] .breath-phase, html[lang="ar"] .breath-phase { letter-spacing: 0; text-transform: none; }
.breath-count { font-size: clamp(2rem, 9vw, 3rem); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.reduced .breath-orb, .breath-stage.reduced .breath-orb { transform: scale(.82) !important; transition: none !important; }
.breath-stage.reduced .breath-ring { border-style: solid; }
.breath-stage.natural .breath-orb { transform: scale(.78); }
.phase-steps { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.phase-steps li { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.phase-steps li.on { border-color: var(--primary); color: var(--primary); font-weight: 700; background: var(--primary-soft); }

.end-screen { max-width: 560px; margin: 0 auto; text-align: center; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 300; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); color: var(--ink); border-radius: var(--radius-lg); max-width: 540px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal h2 { font-size: 1.35rem; }
.modal .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Practice stats */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .num { font-family: var(--font-head); font-size: 1.9rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .lbl { color: var(--muted); font-size: .9rem; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 150px; padding: 8px 0 0; }
.week .bar-wrap { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.week .bar { width: 70%; max-width: 34px; background: var(--primary); border-radius: 6px 6px 2px 2px; min-height: 3px; opacity: .85; }
.week .bar.zero { background: var(--line); }
.week .d { font-size: .75rem; color: var(--muted); }
.week .v { font-size: .72rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; }

/* Learn / article */
.article h2 { margin-top: 1.4em; }
.article section { margin-bottom: 18px; }
.evidence-box { border-inline-start: 4px solid var(--primary); background: var(--surface); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 12px 0; }
.interp-box { border-inline-start: 4px solid var(--accent); background: var(--surface); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 12px 0; }
.islam-box { border-inline-start: 4px solid var(--ink-2); background: var(--surface); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 12px 0; }
.limits-box { border-inline-start: 4px dashed var(--danger); background: var(--surface); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 12px 0; }
[dir="rtl"] .evidence-box, [dir="rtl"] .interp-box, [dir="rtl"] .islam-box, [dir="rtl"] .limits-box { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.box-label { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; display: block; }
html[lang="ur"] .box-label, html[lang="ar"] .box-label { letter-spacing: 0; text-transform: none; }
.refs { font-size: .88rem; color: var(--ink-2); padding-inline-start: 1.2em; }
.refs li { margin-bottom: 6px; overflow-wrap: anywhere; }
.page-head { margin: 8px 0 18px; }
.page-head .lead { margin-bottom: 0; }
.crumbs { font-size: .9rem; margin-bottom: 6px; }
.crumbs a { display: inline-block; padding: 8px 0; }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; z-index: 400; font-size: .95rem; max-width: calc(100vw - 32px); text-align: center; box-shadow: var(--shadow); }

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduced"]) .card-link:hover { transform: translateY(-1px); }
  :root:not([data-motion="reduced"]) .fade-in { animation: fade .35s ease-out both; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

@media print { .site-header, .tabbar, .site-footer, .player-controls { display: none; } }
@media (forced-colors: active) { .breath-orb { forced-color-adjust: none; } .chip input:checked + span { border: 3px solid CanvasText; } }

/* Programmatic focus targets (page/step titles) don't need a visible ring */
[tabindex="-1"]:focus:not(:focus-visible), h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, h3[tabindex="-1"]:focus, p[tabindex="-1"]:focus, div[tabindex="-1"]:focus { outline: none; }
/* Latin text (transliteration, English fallback) inside RTL UIs keeps a Latin font */
html[lang="ur"] :lang(en), html[lang="ar"] :lang(en), .translit { font-family: var(--font-body); line-height: 1.7; }
