/* الباقيات — one calm reading column; search on top, du'as grouped by chapter */
:root {
  --bg: #EEF2EE; --surface: #FFFFFF; --ink: #14302A; --muted: #4A5F57; --line: #D6DFD9;
  --accent: #14302A; --on-accent: #F2F5F1; --tint: #E1EBE5; --tint-ink: #1F4A3C; --focus: #2F6B57; --heart: #B4472F;
  --f-dua: 'Amiri', 'Traditional Arabic', 'Noto Naskh Arabic', serif;
  --f-ui: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121413; --surface: #1B1E1C; --ink: #E6EAE7; --muted: #A4ADA8; --line: #2C312E;
  --accent: #CFE3D8; --on-accent: #121413; --tint: #223029; --tint-ink: #BFD9CB; --focus: #8CC5A9; --heart: #E58A72; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #121413; --surface: #1B1E1C; --ink: #E6EAE7; --muted: #A4ADA8; --line: #2C312E;
  --accent: #CFE3D8; --on-accent: #121413; --tint: #223029; --tint-ink: #BFD9CB; --focus: #8CC5A9; --heart: #E58A72; color-scheme: dark }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 16px; line-height: 1.6;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
a { color: var(--ink); }
[hidden] { display: none !important; }
.wrap { max-width: 680px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* header */
.site-head { background: var(--bg); }
.site-head > .wrap { padding-block: 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.site-head.sticky { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--f-dua); font-weight: 700; font-size: 26px; line-height: 1.2; }
.brand svg { color: var(--focus); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.to-search { font-size: 14px; font-weight: 600; text-decoration: none; padding: 10px 12px; border-radius: 12px; }
.to-search:hover { background: var(--tint); }
.mode { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.mode:hover { border-color: var(--focus); }
.mode .sun { display: none; }
:root[data-theme="dark"] .mode .sun { display: block; }
:root[data-theme="dark"] .mode .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mode .sun { display: block; }
  :root:not([data-theme="light"]) .mode .moon { display: none; }
}
h1 { margin: 0; font-size: clamp(24px, 6vw, 30px); font-weight: 700; line-height: 1.35; text-wrap: balance; }

/* search */
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding-inline: 14px; height: 54px; margin: 0; }
.search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.search svg { flex: none; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 17px; -webkit-appearance: none; appearance: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: var(--muted); }
.clear { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 38px; padding-inline: 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.chip:hover { border-color: var(--focus); }

.hints { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; font-size: 14px; color: var(--muted); }
.hints span { margin-inline-end: 4px; }
.hint { min-height: 36px; padding-inline: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 5px; }
.hint:hover { background: var(--tint); }
.intro { margin: 0; font-size: 14px; }
.intro a { color: var(--muted); text-underline-offset: 4px; }

/* content */
.page { display: flex; flex-direction: column; gap: 24px; padding-block: 8px 40px; }
#results { display: flex; flex-direction: column; gap: 28px; }
.status { margin: 0; font-size: 14px; color: var(--muted); }
.section-label { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0.01em; }
.group { display: flex; flex-direction: column; gap: 10px; }
.group h2 { margin: 0; font-size: 18px; font-weight: 700; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; text-wrap: balance; }
.group h2 a { text-decoration: none; }
.group h2 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.group h2 span { font-size: 13px; font-weight: 500; color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 10px; }
.dua { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 18px 12px; display: flex; flex-direction: column; gap: 10px; }
.dua p { margin: 0; font-family: var(--f-dua); font-size: 21px; line-height: 2.05; min-width: 0; overflow-wrap: anywhere; }
.dua footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.pill { font-size: 13px; font-weight: 600; background: var(--tint); color: var(--tint-ink); border-radius: 999px; padding: 3px 12px; }
.copy { min-height: 40px; padding-inline: 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.copy:hover { background: var(--tint); }
.index { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.index a { min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 500; text-decoration: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.index a:hover { border-color: var(--focus); }
.index small { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 18px; padding: 24px 18px; display: flex; flex-direction: column; gap: 12px; }
.empty p { margin: 0; }

/* chapter page */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.page > h1 { margin-bottom: -16px; }
.related { display: flex; flex-direction: column; gap: 10px; }
.related h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: 15px; min-width: 0; }
.pager a.next { text-align: left; }
.pager a:hover { border-color: var(--focus); }
.pager small { font-weight: 500; font-size: 12px; color: var(--muted); }
.prose { max-width: 680px; }
.prose h2 { margin: 8px 0 -12px; font-size: 18px; }
.prose p { margin: 0; max-width: 62ch; }

/* footer */
.site-foot { border-top: 1px solid var(--line); }
.site-foot .wrap { padding-block: 24px 32px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.site-foot p { margin: 0; }
.site-foot a { color: var(--muted); }
.verse { font-family: var(--f-dua); font-size: 19px; line-height: 1.9; color: var(--ink); }
.verse span { font-family: var(--f-ui); font-size: 12px; color: var(--muted); margin-inline-start: 6px; }

/* card actions: favorite + copy */
.acts { display: inline-flex; align-items: center; gap: 2px; }
.fav { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.fav:hover { background: var(--tint); color: var(--ink); }
.fav[aria-pressed="true"] { color: var(--focus); }
.fav[aria-pressed="true"] svg path { fill: currentColor; }

/* bottom tab bar */
body { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
.tabbar { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-right, 0px)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] svg { background: var(--tint); border-radius: 999px; padding: 3px 14px; width: 52px; height: 28px; box-sizing: content-box; margin-block: -3px; }
.tabbar a:hover { color: var(--ink); }
@media (min-width: 720px) { .tabbar { padding-inline: calc((100% - 560px) / 2); } }

/* daily adhkar: session list */
.sessions { display: flex; flex-direction: column; gap: 10px; }
.session { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 18px; min-height: 76px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; text-decoration: none; color: var(--ink); }
.session:hover { border-color: var(--focus); }
.session.is-now { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus) inset; }
.session-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.session-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.now-tag { font-size: 12px; font-weight: 600; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 1px 10px; }
.session-sub { font-size: 14px; color: var(--muted); }
.session-prog { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.session-count { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.session.is-done .session-count { color: var(--tint-ink); }
.mini-bar { display: block; width: 64px; height: 4px; border-radius: 999px; background: var(--tint); overflow: hidden; }
.mini-bar span, .bar span { display: block; height: 100%; background: var(--focus); border-radius: inherit; transition: width .3s ease; }

/* daily adhkar: runner */
.runner { display: flex; flex-direction: column; gap: 14px; }
.run-top { display: flex; align-items: center; gap: 12px; }
.run-title { flex: 1; min-width: 0; text-align: center; }
.run-title h1 { font-size: 20px; }
.icon-btn { flex: none; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover:not(:disabled) { border-color: var(--focus); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.bar { display: block; height: 4px; border-radius: 999px; background: var(--tint); overflow: hidden; }
.zikr { width: 100%; min-height: 300px; padding: 28px 20px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; text-align: center;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: transform .08s ease, border-color .2s ease; }
.zikr:active { transform: scale(.99); }
.zikr-text { font-family: var(--f-dua); font-size: 23px; line-height: 2.1; overflow-wrap: anywhere; min-width: 0; }
.zikr.long .zikr-text { font-size: 19px; line-height: 2; text-align: justify; text-align-last: center; }
.zikr.is-done { border-color: var(--focus); background: var(--tint); }
.zikr-hint { text-align: center; margin-block: -6px -2px; }
.run-controls { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; justify-content: center; gap: 28px;
  padding-block: 10px; background: var(--bg); }
.counter { width: 96px; height: 96px; border-radius: 999px; border: none; background: var(--accent); color: var(--on-accent); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--f-ui);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform .08s ease; }
.counter:active { transform: scale(.95); }
.counter span { font-size: 34px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.counter small { font-size: 13px; opacity: .85; font-variant-numeric: tabular-nums; }
.counter.is-done { background: var(--focus); }

/* daily adhkar: finished */
.done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding-block: 48px 24px; }
.done-mark { width: 72px; height: 72px; border-radius: 999px; background: var(--tint); color: var(--focus); display: grid; place-items: center; }
.done-mark svg { width: 34px; height: 34px; }
.verse-big { margin: 0; font-family: var(--f-dua); font-size: 26px; color: var(--muted); }
.done-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; margin-top: 12px; }
.btn-primary, .btn-ghost { min-height: 50px; border-radius: 14px; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.btn-primary { border: 0; background: var(--accent); color: var(--on-accent); }
.btn-ghost { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.fav-groups { display: flex; flex-direction: column; gap: 28px; }

@media (prefers-reduced-motion: reduce) { .zikr, .counter, .mini-bar span, .bar span { transition: none; } }
@media (prefers-reduced-motion: no-preference) {
  #results .dua { animation: rise .25s ease both; }
  @keyframes rise { from { transform: translateY(4px); } to { transform: none; } }
}

/* dedication */
.ihda { max-width: 560px; align-items: center; text-align: center; gap: 16px; padding-top: 32px; }
.ihda h1 { margin-bottom: 4px; }
.ihda p { margin: 0; max-width: 46ch; line-height: 1.9; }
.ihda-mark { width: 64px; height: 64px; border-radius: 999px; background: var(--tint); color: var(--focus); display: grid; place-items: center; }
.ihda-mark svg { width: 30px; height: 30px; }
.ihda-lead { font-family: var(--f-dua); font-size: 24px; }
.ihda strong { font-family: var(--f-dua); font-size: 1.25em; }
.ihda-rule { display: block; width: 48px; height: 1px; background: var(--line); margin-block: 8px; }
.ihda-dua { margin: 8px 0 0; padding: 22px 20px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; width: 100%; }
.ihda-dua p { font-family: var(--f-dua); font-size: 22px; line-height: 2; max-width: none; }
.ihda-dua footer { margin-top: 6px; font-size: 13px; color: var(--muted); }
.done .status a { color: var(--muted); text-underline-offset: 4px; }
