:root {
  --bg: #f6f3ec; --card: #fffdf8; --ink: #1d2a26; --muted: #6b7a74; --line: #e6e0d2;
  --brand: #0f5f4f; --brand-2: #17826b; --gold: #c9a24d; --soft: #e7f1ec; --done: #dfeee6;
  --fs: 22px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(15,95,79,.06);
}
:root[data-theme="dark"] {
  --bg: #0e1513; --card: #16201d; --ink: #e8efe9; --muted: #8fa29a; --line: #24312d;
  --brand: #3fb996; --brand-2: #57caa7; --gold: #e0bd6b; --soft: #1a2b26; --done: #183129;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); min-height: 100vh;
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; }

.bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--brand); color: #fff;
}
:root[data-theme="dark"] .bar { background: #12332b; }
.bar h1 { flex: 1; margin: 0; font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: rgba(255,255,255,.14); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 20px; cursor: pointer; }
.progress { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 9; height: 4px; background: var(--line); }
.progress span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 10; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; font-size: 11px; color: var(--muted); text-decoration: none; }
.tabs a i { font-style: normal; font-size: 20px; line-height: 1; }
.tabs a.on { color: var(--brand); font-weight: 700; }

.hero { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 20px; padding: 20px; margin-bottom: 16px; position: relative; overflow: hidden; }
.hero::after { content: "☪"; position: absolute; left: 14px; top: -6px; font-size: 90px; opacity: .1; }
.hero small { opacity: .85; }
.hero h2 { margin: 4px 0 12px; font-size: 22px; }
.hero .btn { background: #fff; color: var(--brand); }
:root[data-theme="dark"] .hero { color: #06201a; }
:root[data-theme="dark"] .hero .btn { background: #06201a; color: #fff; }

.btn { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; cursor: pointer; background: var(--brand); color: #fff; text-decoration: none; display: inline-block; }
.btn.ghost { background: var(--soft); color: var(--brand); }

.search { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 16px; margin-bottom: 16px; }
.search:focus { outline: 2px solid var(--brand); border-color: transparent; }

.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.quick a { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; transition: transform .1s; }
.quick a:active { transform: scale(.97); }
.quick a span { font-size: 24px; }

h3.sec { font-size: 15px; color: var(--muted); margin: 18px 4px 10px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.list a, .list details summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); cursor: pointer; }
.list > :last-child, .list > :last-child summary { border-bottom: 0; }
.list a:active { background: var(--soft); }
.list .n { margin-inline-start: auto; font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 99px; padding: 2px 9px; }
.list .ok { color: var(--brand); }
.list details summary { list-style: none; font-weight: 700; }
.list details summary::-webkit-details-marker { display: none; }
.list details summary::after { content: "‹"; margin-inline-start: 6px; transition: transform .2s; color: var(--muted); }
.list details[open] summary::after { transform: rotate(-90deg); }
.list details .list { border: 0; border-radius: 0; box-shadow: none; background: var(--bg); }
.list details .list a { padding-inline-start: 36px; font-size: 15px; }

.zk { background: var(--card); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 14px; box-shadow: var(--shadow); overflow: hidden; transition: background .3s, opacity .3s; }
.zk .txt { padding: 18px 18px 12px; font-size: var(--fs); line-height: 2; cursor: pointer; user-select: none; white-space: pre-line; }
.zk .foot { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); }
.zk .foot button.act { background: none; border: 0; width: 38px; height: 38px; border-radius: 10px; font-size: 18px; color: var(--muted); cursor: pointer; }
.zk .foot button.act.on { color: #d9534f; }
.zk .count { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 0; }
.zk .count small { color: var(--muted); font-size: 13px; }
.ring { --p: 0; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--line) 0); transition: transform .12s; }
.ring b { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 18px; }
.zk.done { background: var(--done); opacity: .75; }
.zk.done .ring b { background: var(--gold); }
.zk.pulse .ring { transform: scale(1.12); }

.finish { text-align: center; padding: 28px 16px; background: var(--card); border-radius: 18px; border: 1px solid var(--line); animation: pop .4s ease; }
.finish div { font-size: 48px; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

.tools { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

.tasbih { text-align: center; }
.tasbih .chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.tasbih h2 { font-size: 24px; min-height: 40px; margin: 6px 0 20px; }
.bead {
  width: min(70vw, 260px); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer; margin: 0 auto;
  display: grid; place-items: center; font-size: 64px; font-weight: 700; color: #fff; touch-action: manipulation;
  background: radial-gradient(circle at 35% 30%, var(--brand-2), var(--brand)); box-shadow: 0 0 0 10px var(--soft), 0 14px 30px rgba(15,95,79,.3);
  transition: transform .08s;
}
.bead:active { transform: scale(.95); }
.bead small { display: block; font-size: 15px; font-weight: 400; opacity: .8; }
.stats { display: flex; justify-content: center; gap: 12px; margin: 24px 0 14px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; min-width: 96px; }
.stats b { display: block; font-size: 20px; }
.stats small { color: var(--muted); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.seg { display: flex; background: var(--soft); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--card); color: var(--brand); font-weight: 700; box-shadow: var(--shadow); }
.preview { font-size: var(--fs); line-height: 2; padding: 14px 16px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.hl { background: rgba(201,162,77,.35); border-radius: 4px; }

.toast { position: fixed; bottom: calc(90px + env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.dev { text-align: center; padding: 26px 16px 20px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 20px; margin-bottom: 14px; }
:root[data-theme="dark"] .dev { color: #06201a; }
.dev .avatar { width: 86px; height: 86px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 800; background: var(--gold); color: #0f3d33; box-shadow: 0 0 0 5px rgba(255,255,255,.25); font-family: system-ui, sans-serif; }
.dev h2 { margin: 0; font-size: 24px; }
.dev p { margin: 2px 0 6px; opacity: .85; font-family: system-ui, sans-serif; }
.dev small { opacity: .9; }
.nonprofit { background: var(--card); border: 1px solid var(--gold); border-radius: 16px; padding: 14px 16px; line-height: 1.9; font-size: 15px; }
.nonprofit b { display: block; color: var(--gold); font-size: 17px; }
.si { width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; font-family: system-ui, sans-serif; }
.sub { display: block; color: var(--muted); font-size: 12px; direction: ltr; text-align: right; font-family: system-ui, sans-serif; }
.credit { text-align: center; margin: 22px 0 4px; font-size: 13px; }
.credit a { color: var(--muted); text-decoration: none; }

.update { position: fixed; z-index: 20; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); max-width: 696px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 8px; background: var(--card); border: 1px solid var(--gold); border-radius: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.18); animation: pop .35s ease; }
.update div { flex: 1; font-size: 14px; line-height: 1.6; }
.update small { display: block; color: var(--muted); font-size: 12px; }
.update .x { border: 0; background: none; color: var(--muted); font-size: 16px; width: 32px; height: 32px; cursor: pointer; }

.note { font-size: 14px; line-height: 1.9; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; }
.note b { color: var(--brand); }
.note a, .body a { color: var(--brand); }
.body { padding: 14px 16px; line-height: 2; font-size: 16px; }
ul.body { margin: 0; padding: 14px 34px 14px 16px; }
ul.body li { margin-bottom: 8px; }
.body.ref { font-size: 13px; color: var(--muted); }
.body.ref a { display: block; margin-top: 10px; font-weight: 700; }
.badges { margin-inline-start: auto; display: flex; gap: 6px; }
.badges b { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.badges b.grade { background: var(--brand); color: #fff; }

.hero.cont { display: block; text-decoration: none; }
.hero.cont h2 { margin-bottom: 0; }
.list .sn { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--soft); color: var(--brand); display: grid; place-items: center; font-size: 13px; font-weight: 700; }

.surah-head { text-align: center; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 12px; }
.surah-head h2 { margin: 0; font-size: 26px; color: var(--brand); }
.surah-head small { color: var(--muted); }
.basmala { font-size: 20px; margin: 12px 0 0; line-height: 2; }
.mushaf { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.ayah { border-bottom: 1px solid var(--line); cursor: pointer; }
.ayah:last-child { border-bottom: 0; }
.ayah .aya { margin: 0; padding: 16px; font-size: var(--fs); line-height: 2.2; text-align: justify; }
.ayah .mark { display: inline-grid; place-items: center; width: 30px; height: 30px; font-size: 12px; color: var(--brand); border: 1px solid var(--gold); border-radius: 50%; vertical-align: middle; font-family: system-ui, sans-serif; }
.ayah.open { background: var(--soft); }
.ayah .taf { display: none; padding: 0 16px 16px; font-size: 15px; line-height: 2; color: var(--ink); border-top: 1px dashed var(--line); }
.ayah.open .taf { display: block; padding-top: 12px; }
.ayah .taf b { display: block; color: var(--brand); font-size: 13px; margin-bottom: 4px; }
.mushaf.show-all .ayah .taf { display: block; padding-top: 12px; }
.navs { display: flex; justify-content: space-between; gap: 10px; margin: 16px 0 6px; }

@font-face { font-family: "QuranFont"; src: url("quran-font.woff2") format("woff2"); font-display: swap; }
.ayah .aya, .basmala { font-family: "QuranFont", "Noto Naskh Arabic", "Geeza Pro", serif; }
.segchips { margin-bottom: 14px; }
.segchips .chip { text-decoration: none; color: inherit; }
.segchips .chip.on { color: #fff; }
.list .mini { flex: 1; font-size: 15px; }
.khatma-start { display: block; text-decoration: none; color: inherit; margin-bottom: 14px; }
.khatma-start .row b { display: block; margin-bottom: 8px; }
.khatma-start .row small { color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 8px; }
.bar span { display: block; height: 100%; background: var(--gold); }
.ayah-acts { display: flex; gap: 4px; margin-top: 10px; }
.ayah-acts .act { background: none; border: 0; font-size: 18px; color: var(--muted); cursor: pointer; width: 38px; height: 34px; border-radius: 9px; }
.ayah-acts .act.on { color: var(--gold); }
.list .act { background: none; border: 0; color: var(--muted); font-size: 15px; cursor: pointer; padding: 4px 8px; }
.chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart .col b { font-size: 11px; color: var(--muted); font-weight: 600; min-height: 14px; }
.chart .col i { width: 100%; max-width: 26px; border-radius: 7px 7px 0 0; background: linear-gradient(180deg, var(--brand-2), var(--brand)); }
.chart .col small { font-size: 10px; color: var(--muted); }

.pstrip { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; text-decoration: none; color: var(--ink); font-size: 14px; box-shadow: var(--shadow); }
.pstrip b { color: var(--brand); }
.pstrip span { margin-inline-start: auto; color: var(--muted); }
.row.now { background: var(--soft); }
.row.now b { color: var(--brand); }
.sw { width: 46px; height: 28px; border-radius: 99px; border: 0; background: var(--line); position: relative; cursor: pointer; transition: background .2s; }
.sw::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.sw.on { background: var(--brand); }
.sw.on::after { transform: translateX(-18px); }
.tinput { font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
