@font-face {
  font-family: "Noto Naskh Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/naskh-400-ar.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, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/naskh-400-lat.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+2012-2027, U+2030-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/naskh-700-ar.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, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/naskh-700-lat.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+2012-2027, U+2030-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f3efe4;
  --surface: #fffdf8;
  --ink: #221c16;
  --muted: #5c5348;
  --line: #e4d9c6;
  --line-strong: #8a7f70;
  --btn: #0e5c43;
  --btn-ink: #f7f4ec;
  --green: #0e5c43;
  --pill-bg: #e5f3ec;
  --pill-ink: #0b4a36;
  --gold: #8d6b2f;
  --gold-soft: #f4ead4;
  --danger: #8d342c;
  --warn-bg: #f8e6e2;
  --tab-h: calc(64px + env(safe-area-inset-bottom));
  --bump: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101513;
    --surface: #1b2320;
    --ink: #f4efe6;
    --muted: #cfc3b2;
    --line: #314039;
    --line-strong: #8d9a93;
    --btn: #0e5c43;
    --btn-ink: #f7f4ec;
    --green: #9be0c2;
    --pill-bg: #16352b;
    --pill-ink: #c8f3dc;
    --gold: #e4c98a;
    --gold-soft: #2c281c;
    --danger: #ffb4ab;
    --warn-bg: #3a2422;
    color-scheme: dark;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  font-size: 17px;
  line-height: 1.7;
  direction: rtl;
}

@media (min-width: 380px) {
  body { font-size: 18px; }
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

::selection { background: var(--gold-soft); color: var(--ink); }

:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  inset-inline-start: 8px;
  top: -48px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 12px;
  z-index: 80;
}
.skip:focus { top: calc(8px + env(safe-area-inset-top)); }

.app { width: min(720px, 100%); margin-inline: auto; min-height: 100dvh; }
.app[data-font="1"] { --bump: 4px; }
.app[data-font="2"] { --bump: 9px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.top { padding-bottom: 4px; }
.top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 4px 16px 8px;
}
.top-row h1 {
  margin: 0;
  flex: 1;
  font-size: 1.2rem;
  line-height: 1.4;
}
.home-link {
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.net {
  margin: 0;
  padding: 8px 16px;
  background: var(--gold-soft);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.6;
}
.net.warn { background: var(--warn-bg); color: var(--danger); }

main {
  padding: 8px 16px calc(28px + var(--tab-h));
}

h2 { font-size: 1.28rem; line-height: 1.45; margin: 22px 0 8px; }
h3 { font-size: 1.08rem; margin: 14px 0 8px; }
p { margin: 0 0 10px; }

.lead { font-size: 1.05rem; line-height: 1.9; }
.note { color: var(--muted); font-size: 0.92rem; line-height: 1.7; display: block; }
.foot { color: var(--muted); font-size: 0.92rem; line-height: 1.75; margin-top: 22px; }
.empty { color: var(--muted); padding: 8px 0 16px; }
.prose { font-size: 1.06rem; line-height: 2; margin: 0 0 14px; }
.unc { background: var(--gold-soft); border-radius: 4px; padding: 0 0.15em; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 12px 0;
  scroll-margin-top: 140px;
}
.pad { padding: 14px; }
.notice { border-color: var(--gold); }
.install-steps { margin: 8px 0 12px; padding-inline-start: 1.25rem; }
.install-steps li { margin: 6px 0; line-height: 1.75; }

.card > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 60px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.card > summary::-webkit-details-marker { display: none; }
.card > summary .grow { flex: 1; line-height: 1.45; }
.card > summary .count { color: var(--muted); font-weight: 400; font-size: 0.92rem; }
.card > summary .chev { width: 20px; height: 20px; flex: 0 0 auto; transition: transform 0.15s ease; }
details[open] > summary .chev { transform: rotate(180deg); }
.stage-body, .card .pad { padding: 0 12px 12px; }
.card.pad { padding: 14px; }

.lecture-line { color: var(--muted); font-size: 0.98rem; line-height: 1.8; margin: 0 0 8px; }

.progress-label { font-weight: 700; margin-bottom: 8px; }
.bar {
  height: 10px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  display: flex;
  margin-bottom: 8px;
}
.bar > span { display: block; height: 100%; background: var(--btn); border-radius: inherit; }

.counters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.counter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.counter h2 { font-size: 1.05rem; margin: 0; text-align: center; }
.counter .sub { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 0; }
.dots { display: flex; gap: 5px; justify-content: center; margin: 4px 0; }
.dots i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--green);
  display: block;
}
.dots i.on { background: var(--green); }
.counter .num {
  margin: 0;
  text-align: center;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.2;
}
.counter .num.done { color: var(--green); }
.counter-actions { display: flex; gap: 8px; }
.counter-actions .btn {
  flex: 1;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 6px;
}
.counter-actions .plus { flex: 1.25; }
.counter-actions b { font-size: 1.55rem; line-height: 1; font-weight: 700; }
.counter-actions small { font-size: 0.75rem; font-weight: 700; }
.counter .text-btn { align-self: center; }

.strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 12px 10px;
  background: var(--bg);
}
.strip .cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 6px 4px 8px;
  min-height: 52px;
}
.strip .who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.strip .who b { font-size: 0.95rem; }
.strip .who span { color: var(--muted); font-size: 0.78rem; }
.strip .who span.done { color: var(--green); font-weight: 700; }
.strip .mini {
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  font-weight: 700;
}
.strip .mini.plus { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.strip .mini:disabled { opacity: 0.35; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 112px;
  padding: 14px;
  text-align: start;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.tile .ico { width: 26px; height: 26px; color: var(--green); }
.tile strong { font-size: 1.08rem; }
.tile span { color: var(--muted); font-size: 0.85rem; line-height: 1.45; }

.btn {
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 0;
  background: var(--btn);
  color: var(--btn-ink);
  font-weight: 700;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
}
.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
}
.btn:disabled { opacity: 0.38; }
.rowbtns { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.rowbtns .btn { flex: 1 1 auto; min-width: 5.6rem; }
.text-btn {
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--green);
  font-weight: 700;
}

.fontctl {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
}
.seg {
  flex: 1;
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: transparent;
}
.seg.on { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }

.tick {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  text-align: start;
  padding: 12px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  min-height: 56px;
}
.box {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  margin-top: 3px;
  display: grid;
  place-items: center;
}
.tick.on .box { background: var(--btn); border-color: var(--btn); }
.tick.on .box::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid var(--btn-ink);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(40deg) translate(-1px, -2px);
}
.tick-label { display: block; font-size: 1.05rem; line-height: 1.75; }
.tick.on .tick-label { color: var(--muted); text-decoration: line-through; }
.tick-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin-top: 4px; }
.src { color: var(--muted); font-size: 0.82rem; line-height: 1.6; }
.pill {
  display: inline-block;
  background: var(--pill-bg);
  color: var(--pill-ink);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.78rem;
  line-height: 1.7;
  font-weight: 700;
}

.dua {
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--gold);
  border-radius: 14px;
  padding: 14px;
  margin: 10px 0;
}
.dua .text {
  white-space: pre-wrap;
  margin: 0;
  font-size: calc(1.2rem + var(--bump));
  line-height: 2.05;
}
.cite { color: var(--muted); font-size: 0.82rem; line-height: 1.65; margin: 8px 0 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field > span:first-child { font-weight: 700; }
textarea,
input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px;
  line-height: 1.8;
  scroll-margin-bottom: calc(var(--tab-h) + 16px);
  scroll-margin-top: 90px;
}
textarea { min-height: 110px; resize: vertical; }
.composer .btn { width: 100%; margin-top: 8px; }
.mine {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.mine-text { white-space: pre-wrap; font-size: 1.12rem; line-height: 1.9; margin: 0; }

.days {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 12px 10px;
  scroll-snap-type: x mandatory;
}
.day {
  flex: 0 0 48px;
  height: 48px;
  border-radius: 14px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  scroll-snap-align: start;
  font-weight: 700;
}
.day.on { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }

.prayer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin: 10px 0;
}
.prayer h3 { margin: 0 0 8px; }
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chip {
  min-height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  font-size: 0.95rem;
  padding: 4px;
}
.chip.on { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }

.list { list-style: none; padding: 0; margin: 8px 0 0; }
.list li {
  position: relative;
  padding: 10px 0;
  padding-inline-start: 22px;
  border-bottom: 1px solid var(--line);
  line-height: 1.8;
}
.list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 2px;
  top: 1.15em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}
.list.warn li::before { background: var(--danger); }

.source {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  min-height: 52px;
  justify-content: center;
}
.source strong { font-size: 1.02rem; line-height: 1.5; }
.source .site { color: var(--muted); font-size: 0.85rem; direction: ltr; unicode-bidi: isolate; text-align: end; }

details.fold > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.backup details { margin-top: 8px; }
.backup textarea { margin: 8px 0; }

.tabbar {
  position: fixed;
  z-index: 30;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: 6px 1px 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
}
.tab .ico { width: 22px; height: 22px; }
.tab span { max-width: 100%; text-align: center; }
.tab[aria-current="page"] { color: var(--green); }
.tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--gold);
}

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(var(--tab-h) + 12px);
  transform: translateX(-50%);
  width: min(680px, calc(100% - 24px));
  background: var(--ink);
  color: var(--bg);
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.6;
}

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 16, 10, 0.48);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: min(720px, 100%);
  background: var(--surface);
  color: var(--ink);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet p { font-size: 1.06rem; line-height: 1.85; margin: 0 0 16px; }

body.lock { overflow: hidden; }
.ico { display: block; }

.boot { padding: 24px 16px; line-height: 1.8; }

@media (max-width: 340px) {
  .tab { font-size: 10px; }
  .counters { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chev { transition: none; }
}
