/* Digital Tasbeeh web — "manuscript & tasbeeh". Tokens follow the app's
   design system (docs/21_DESIGN_SYSTEM.md); the site adds the bead string,
   manuscript ruling on cards and Ruqaa display type. */
:root {
  --bg: #f6f1e7;
  --bg-deep: #efe7d6;
  --surface: #fffdf8;
  --primary: #0f4c45;
  --primary-ink: #0a3a35;
  --on-primary: #ffffff;
  --accent: #8f6418;
  --accent-soft: #e9d6ac;
  --text: #1d2422;
  --muted: #5e6b67;
  --line: #e4dccb;
  --bead-off: #d9cfba;
  --danger: #b3261e;
  --hero-bg: #0f4c45;
  --hero-text: #f6f1e7;
  --hero-bead: #d9b25c;
  --shadow: 0 1px 0 rgba(29, 36, 34, 0.04), 0 8px 24px -14px rgba(15, 76, 69, 0.25);
  --radius: 14px;
  --text-scale: 1;
  --font-ui: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-text: 'Amiri', 'Noto Naskh Arabic', 'Traditional Arabic', serif;
  /* Headings: Amiri bold, not a Ruqaa display face. Ruqaa stacks dots and
     hamzas so tightly that in «أذكار» the dot of ذ merged into the hamza on
     iPhone (P5.51). Amiri keeps marks apart and is already loaded for the text. */
  --font-display: 'Amiri', 'Noto Naskh Arabic', 'Traditional Arabic', serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1615;
    --bg-deep: #0a1110;
    --surface: #16211f;
    --primary: #7fc8b8;
    --primary-ink: #a6dccf;
    --on-primary: #06201c;
    --accent: #d9b25c;
    --accent-soft: #3a3220;
    --text: #e8efec;
    --muted: #9aa8a4;
    --line: #26332f;
    --bead-off: #2c3a36;
  --danger: #f2b8b5;
    --hero-bg: #0a1312;
    --hero-text: #e8efec;
    --hero-bead: #d9b25c;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 30px -18px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e1615;
  --bg-deep: #0a1110;
  --surface: #16211f;
  --primary: #7fc8b8;
  --primary-ink: #a6dccf;
  --on-primary: #06201c;
  --accent: #d9b25c;
  --accent-soft: #3a3220;
  --text: #e8efec;
  --muted: #9aa8a4;
  --line: #26332f;
  --bead-off: #2c3a36;
  --danger: #f2b8b5;
  --hero-bg: #0a1312;
  --hero-text: #e8efec;
  --hero-bead: #d9b25c;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 30px -18px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 76px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.7 var(--font-ui);
  min-height: 100vh;
  overflow-x: hidden;
}
a {
  color: var(--primary);
  text-underline-offset: 3px;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
img {
  max-width: 100%;
}
[hidden] {
  display: none !important;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.muted {
  color: var(--muted);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.skip {
  position: absolute;
  inset-inline-start: 8px;
  top: -60px;
  background: var(--primary);
  color: var(--on-primary);
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 50;
}
.skip:focus {
  top: 8px;
}
.ic {
  width: 22px;
  height: 22px;
  flex: none;
}

/* ---------- top bar ---------- */
#app-header {
  display: contents;
}
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px max(12px, env(safe-area-inset-left)) 8px max(12px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-decoration: none;
  color: var(--text);
  margin-inline-end: auto;
  min-width: 0;
}
.wm-ar {
  font: 700 1.3rem/1.5 var(--font-display);
  color: var(--primary);
  white-space: nowrap;
  /* A long Latin name (e.g. a domain) must never slide under the icons. */
  overflow: hidden;
  text-overflow: ellipsis;
}
.wm-ar[lang='en'] {
  font: 600 clamp(0.82rem, 3.6vw, 1.05rem) / 1.2 var(--font-ui);
  letter-spacing: 0.01em;
}
.wm-sub {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--bg-deep);
}
.lang select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  max-width: 7.5rem;
  cursor: pointer;
}
@media (max-width: 400px) {
  .lang select {
    max-width: 5.5rem;
    padding-inline: 10px;
  }
}

/* drawer */
.drawer {
  margin: 0;
  margin-inline-start: 0;
  inset-inline-start: 0;
  inset-inline-end: auto;
  height: 100dvh;
  max-height: 100dvh;
  width: min(86vw, 340px);
  border: 0;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
}
.drawer::backdrop {
  background: rgba(10, 20, 18, 0.45);
}
.drawer[open] {
  animation: slide-in 0.22s ease-out;
}
@keyframes slide-in {
  from {
    transform: translateX(calc(var(--dir, 1) * 40px));
  }
}
[dir='rtl'] .drawer {
  --dir: 1;
}
[dir='ltr'] .drawer {
  --dir: -1;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-list,
.drawer-links {
  list-style: none;
  margin: 0;
  padding: 8px;
}
.drawer-list a,
.drawer-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}
.drawer-list a:hover,
.drawer-links a:hover {
  background: var(--bg);
}
.drawer-links {
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
.ornament {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex: none;
  --surface: var(--surface);
}
.ornament.sm {
  width: 12px;
  height: 12px;
}

.dev-banner {
  background: repeating-linear-gradient(-45deg, #fff4d6, #fff4d6 12px, #fbe9b9 12px, #fbe9b9 24px);
  color: #5a3f05;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 14px;
  border-bottom: 1px solid #e6cf8f;
}
:root[data-theme='dark'] .dev-banner {
  background: repeating-linear-gradient(-45deg, #2f2712, #2f2712 12px, #3a3016 12px, #3a3016 24px);
  color: #f0d99a;
  border-color: #4d3f1a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .dev-banner {
    background: repeating-linear-gradient(-45deg, #2f2712, #2f2712 12px, #3a3016 12px, #3a3016 24px);
    color: #f0d99a;
    border-color: #4d3f1a;
  }
}

/* ---------- layout ---------- */
main {
  display: block;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}
body[data-route='home'] main {
  max-width: 1040px;
  padding-top: 0;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  margin: 0 -16px 22px;
  padding: 34px 20px 30px;
  text-align: center;
  color: var(--hero-text);
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(217, 178, 92, 0.18), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cpath d='M32 4l7 11 13-2-2 13 11 7-11 7 2 13-13-2-7 11-7-11-13 2 2-13-11-7 11-7-2-13 13 2z' fill='none' stroke='%23ffffff' stroke-opacity='.06'/%3E%3C/svg%3E"),
    var(--hero-bg);
  border-radius: 0 0 28px 28px;
  overflow: hidden;
}
@media (min-width: 1072px) {
  .hero {
    margin-inline: 0;
    border-radius: 0 0 32px 32px;
  }
}
.hero-beads {
  display: block;
  width: min(560px, 100%);
  margin: 0 auto 6px;
  --bead-on: var(--hero-bead);
  --bead-off: rgba(255, 255, 255, 0.16);
  --thread: rgba(255, 255, 255, 0.22);
}
.hero-beads .b {
  animation: bead-in 0.5s ease-out both;
}
.hero-title {
  margin: 4px 0 0;
  font: 700 clamp(2.3rem, 9vw, 3.6rem) / 1.5 var(--font-display);
  color: var(--hero-text);
}
.hero-title small {
  display: block;
  font: 500 0.9rem/1.6 var(--font-ui);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.75;
}
.hero-tag {
  margin: 10px auto 18px;
  max-width: 36em;
  opacity: 0.88;
}
.hero-search {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
  padding: 4px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #1d2422;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
}
.hero-search input {
  flex: 1;
  border: 0;
  background: none;
  padding: 10px 0;
  outline: none;
  color: #1d2422;
  min-width: 0;
}

/* bead string */
.beads .thread {
  fill: none;
  stroke: var(--thread, var(--line));
  stroke-width: 1.5;
}
.beads .b {
  fill: var(--bead-off);
  transition: fill 0.3s ease, transform 0.3s ease;
  transform-box: fill-box;
  transform-origin: center;
}
.beads .b.on {
  fill: var(--bead-on, var(--accent));
}
.beads .b.on:last-of-type,
.beads .b.lead {
  transform: scale(1.15);
}
.hero-beads .b:nth-of-type(33n + 17) {
  fill: var(--hero-bead);
}
@keyframes bead-in {
  from {
    transform: translateY(-6px);
  }
}

/* ---------- tiles (home) ---------- */
.tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 640px) {
  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
}
@media (min-width: 920px) {
  .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.tile a {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  min-height: 112px;
  padding: 14px 14px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
  animation: rise 0.4s ease-out both;
  animation-delay: calc(var(--i, 0) * 18ms);
}
.tile a:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.tile-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  clip-path: polygon(50% 0, 64% 14%, 85% 15%, 86% 36%, 100% 50%, 86% 64%, 85% 85%, 64% 86%, 50% 100%, 36% 86%, 15% 85%, 14% 64%, 0 50%, 14% 36%, 15% 15%, 36% 14%);
}
.tile-title {
  font: 700 1.2rem/1.6 var(--font-display);
  color: var(--primary-ink);
  margin-top: auto;
}
.tile-count {
  font-size: 0.78rem;
  color: var(--muted);
}
.tile-wide {
  grid-column: span 2;
}
.tile-wide a {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #000));
  color: var(--on-primary);
  border-color: transparent;
}
.tile-wide .tile-title {
  color: var(--on-primary);
  font-size: 1.6rem;
}
.tile-wide .tile-count {
  color: color-mix(in srgb, var(--on-primary) 75%, transparent);
}
.tile-wide .tile-num {
  background: rgba(255, 255, 255, 0.16);
  color: var(--on-primary);
}
.tile-names a {
  background: linear-gradient(160deg, var(--surface), var(--accent-soft));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
@keyframes rise {
  from {
    transform: translateY(6px);
  }
}

/* ---------- page head ---------- */
.crumbs {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 4px 0 6px;
}
.crumbs a {
  color: var(--muted);
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--primary);
}
.crumbs .sep {
  opacity: 0.5;
}
.page-head {
  text-align: center;
  margin: 10px 0 18px;
}
.page-head .ornament.head {
  width: 26px;
  height: 26px;
}
.page-head h1 {
  margin: 4px 0 0;
  font: 700 clamp(1.7rem, 6.5vw, 2.4rem) / 1.55 var(--font-display);
  color: var(--primary-ink);
}
.page-head p {
  margin: 2px 0 0;
  font-size: 0.9rem;
}

/* progress string */
.progress {
  position: sticky;
  top: 59px;
  z-index: 10;
  margin: 0 -16px 14px;
  padding: 6px 16px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.progress-beads {
  display: block;
  width: 100%;
  max-width: 560px;
  height: 30px;
  margin: 0 auto;
}
.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
}
.linklike {
  border: 0;
  background: none;
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: 6px;
}
.linklike .ic {
  width: 16px;
  height: 16px;
}
.text-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  margin-bottom: 10px;
}
.text-tools button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  min-width: 38px;
  height: 32px;
  cursor: pointer;
  font-size: 0.85rem;
}

/* ---------- chapters (Hisn al-Muslim) ---------- */
.chapter-tools input,
.search-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 11px 14px;
  outline: none;
}
.chapter-tools input:focus,
.search-form:focus-within {
  border-color: var(--primary);
}
.chapters {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 6px;
}
@media (min-width: 700px) {
  .chapters {
    grid-template-columns: 1fr 1fr;
  }
}
.chapters a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
}
.chapters a:hover {
  border-color: var(--accent);
}
.ch-num {
  flex: none;
  width: 34px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}
.ch-title {
  flex: 1;
  font-family: var(--font-text);
  font-size: 1.12rem;
  line-height: 1.6;
}
.ch-count {
  flex: none;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 1px 9px;
}

/* ---------- cards ---------- */
.cards {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cards > .ornament.divider {
  align-self: center;
  width: 14px;
  height: 14px;
  opacity: 0.55;
  margin: 6px 0;
}
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 10px;
  padding-inline-start: 24px;
  transition: opacity 0.4s ease, border-color 0.3s ease;
}
/* manuscript ruling: a double gold rule on the starting edge */
.card::before {
  content: '';
  position: absolute;
  inset-block: 14px;
  inset-inline-start: 10px;
  width: 4px;
  border-inline: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 2px;
}
.card.done {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}
.card.done::before {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}
.card.done .dhikr-text {
  opacity: 0.6;
}
.card.flash {
  animation: flash 0.6s ease-out;
}
@keyframes flash {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  }
  100% {
    box-shadow: 0 0 0 14px transparent;
  }
}
.kind-tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 8px;
  margin-bottom: 4px;
}
.dhikr-title {
  margin: 0 0 6px;
  font: 700 1.1rem/1.6 var(--font-ui);
  color: var(--primary-ink);
}
.dhikr-text {
  font-family: var(--font-text);
  font-size: calc(1.55rem * var(--text-scale));
  line-height: 2.05;
  white-space: pre-line;
  overflow-wrap: anywhere;
  color: var(--text);
  text-align: start;
  transition: opacity 0.3s ease;
}
.essay .dhikr-text {
  font-size: calc(1.28rem * var(--text-scale));
  line-height: 2;
}
.single .dhikr-text {
  font-size: calc(1.75rem * var(--text-scale));
}
.name-text {
  font: 700 calc(2.6rem * var(--text-scale)) / 1.6 var(--font-display);
  text-align: center;
  color: var(--primary-ink);
}
.dhikr-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}
.dhikr-meta b {
  font-weight: 600;
}
.chip {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  padding: 1px 10px;
  border-radius: 999px;
}
.virtue {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-size: 0.95rem;
}
.virtue b {
  color: var(--accent);
  font-size: 0.82rem;
}
.virtue p {
  margin: 2px 0 0;
  font-family: var(--font-text);
  font-size: 1.08rem;
  line-height: 1.9;
}
.src {
  margin: 4px 0 0;
  font-size: 0.78rem !important;
  color: var(--muted);
  font-family: var(--font-ui) !important;
  line-height: 1.5 !important;
}

details > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details > summary::-webkit-details-marker {
  display: none;
}
.explain,
.translations {
  margin-top: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}
.explain > summary,
.translations > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  padding: 4px 2px;
}
.explain > summary::before,
.translations > summary::before {
  content: '';
  width: 7px;
  height: 7px;
  border-inline-end: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
[dir='rtl'] .explain > summary::before,
[dir='rtl'] .translations > summary::before {
  transform: rotate(45deg);
}
details[open] > summary::before {
  transform: rotate(45deg) !important;
}
.explain .when-open,
.explain[open] .when-closed {
  display: none;
}
.explain[open] .when-open {
  display: inline;
}
.explain-body {
  font-family: var(--font-text);
  font-size: calc(1.1rem * var(--text-scale));
  line-height: 1.95;
  white-space: pre-line;
  padding: 6px 2px;
}
.translations .count {
  font-size: 0.72rem;
  background: var(--bg);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--muted);
}
.tr-list {
  display: grid;
  gap: 10px;
  padding: 8px 0 4px;
}
.tr {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg);
}
.tr h4 {
  margin: 0;
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.tr p {
  margin: 2px 0 0;
  white-space: pre-line;
  font-size: calc(0.98rem * var(--text-scale));
  line-height: 1.75;
}
.tr[lang='ur'] p {
  font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', var(--font-text);
  line-height: 2.3;
}

/* actions + bead counter */
.dhikr-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.dhikr-actions .spacer {
  flex: 1;
}
.act {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.act:hover {
  color: var(--primary);
  background: var(--bg);
}
.act .ic {
  width: 20px;
  height: 20px;
}
.bead {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--primary) 70%, #fff) 0, var(--primary) 55%, color-mix(in srgb, var(--primary) 75%, #000) 100%);
  color: var(--on-primary);
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--primary) 80%, transparent), inset 0 -3px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s ease, background 0.3s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.bead:active {
  transform: scale(0.92);
}
.bead svg {
  position: absolute;
  inset: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  transform: rotate(-90deg);
}
.bead-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 2.5;
}
.bead-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 0.25s ease;
}
.bead-n {
  position: relative;
  font-weight: 600;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.bead-done {
  display: none;
  position: relative !important;
  inset: auto !important;
  width: 26px !important;
  height: 26px !important;
  transform: none !important;
}
.bead.complete {
  background: radial-gradient(circle at 35% 30%, #f3dc9f 0, #c99a3e 55%, #8f6418 100%);
  color: #2a1d05;
}
.bead.complete .bead-n {
  display: none;
}
.bead.complete .bead-done {
  display: block;
}
.bead.pop {
  animation: pop 0.25s ease-out;
}
@keyframes pop {
  50% {
    transform: scale(1.1);
  }
}
.bead-hint {
  font-size: 0.78rem;
  color: var(--muted);
}
.card.done .bead-hint {
  color: var(--accent);
}

/* names of Allah */
.names-grid {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 560px) {
  .names-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.name {
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.name[open] {
  grid-column: 1 / -1;
  border-color: var(--accent);
}
.name > summary {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 92px;
  padding: 14px 8px 10px;
}
.name-num {
  position: absolute;
  top: 6px;
  inset-inline-start: 10px;
  font-size: 0.72rem;
  color: var(--accent);
}
.name-ar {
  font: 700 1.75rem/1.5 var(--font-display);
  color: var(--primary-ink);
  text-align: center;
}
.name-meaning {
  padding: 0 16px 14px;
  border-top: 1px dashed var(--line);
}
.name-meaning b {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--accent);
}
.name-meaning p {
  margin: 4px 0 8px;
  font-family: var(--font-text);
  font-size: calc(1.15rem * var(--text-scale));
  line-height: 1.95;
}
.name-link {
  font-size: 0.85rem;
}

/* item page */
.found-in {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 16px 0 8px;
}
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.pager a {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}
.pager a.next {
  text-align: end;
}
.pager small {
  color: var(--accent);
  font-size: 0.75rem;
}
.pager span {
  font-family: var(--font-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* search */
.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 0;
  position: relative;
}
.search-form .ic {
  position: absolute;
  inset-inline-start: 12px;
  color: var(--muted);
}
.search-form input {
  padding-inline-start: 42px;
  font-size: 1.05rem;
}
.search-hint {
  font-size: 0.82rem;
  margin: 6px 2px;
}
.search-count {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.4em;
}
mark {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: inherit;
  border-radius: 3px;
}

[data-search-results] .essay .dhikr-text {
  max-height: 9.5em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 60%, transparent);
  mask-image: linear-gradient(#000 60%, transparent);
}

/* credits / prose */
.lead {
  font-size: 1.02rem;
  text-align: center;
  color: var(--muted);
  max-width: 34em;
  margin: 0 auto 18px;
}
.sources {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 8px;
}
.sources li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.sources.small li {
  font-size: 0.88rem;
  display: block;
}
.lang-tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 8px;
  margin-inline-end: 6px;
}
h2 {
  font: 700 1.35rem/1.6 var(--font-display);
  color: var(--primary-ink);
  margin: 26px 0 10px;
}
.prose {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 20px 20px;
}
.prose h1 {
  font: 700 1.6rem/1.55 var(--font-display);
  color: var(--primary-ink);
}
.prose h2 {
  font-size: 1.2rem;
}
.prose li {
  margin-bottom: 6px;
}
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  text-decoration: none;
}
.empty {
  text-align: center;
  color: var(--muted);
}

/* ---------- ads: few, labelled, reserved space (no layout jump) ---------- */
.ad {
  margin: 26px auto 8px;
  max-width: 728px;
  text-align: center;
}
.ad-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.ad-box {
  min-height: 100px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-deep) 70%, transparent);
  overflow: hidden;
}

/* ---------- app promotion ---------- */
.promo {
  margin: 28px 0 8px;
}
.promo-title {
  font-size: 1.1rem;
  margin: 0 0 10px;
  text-align: center;
}
.promo-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'icon text' 'badge badge';
  align-items: center;
  gap: 8px 14px;
  max-width: 560px;
  margin: 0 auto 10px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(120deg, var(--surface), color-mix(in srgb, var(--primary) 9%, var(--surface)));
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
}
@media (min-width: 520px) {
  .promo-card {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: 'icon text badge';
  }
}
.promo-icon {
  grid-area: icon;
  width: 56px;
  height: 56px;
  border-radius: 14px;
}
.promo-icon-default {
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--on-primary);
}
.promo-icon-default svg {
  width: 40px;
  height: 40px;
}
.promo-text {
  grid-area: text;
  display: flex;
  flex-direction: column;
  line-height: 1.4;
}
.promo-text strong {
  font: 700 1.15rem/1.4 var(--font-display);
  color: var(--primary-ink);
}
.promo-text span {
  font-size: 0.85rem;
  color: var(--muted);
}
.play-badge {
  grid-area: badge;
  height: 44px;
  width: auto;
  justify-self: center;
}
.promo-foot {
  margin-top: 0;
}

/* ---------- footer ---------- */
.foot {
  max-width: 780px;
  margin: 0 auto;
  padding: 10px 16px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
  border-top: 1px solid var(--line);
}
.foot-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.foot-name {
  font: 700 1.1rem/1.5 var(--font-display);
  color: var(--primary-ink);
}
.foot-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 0.88rem;
  margin: 6px 0;
}
.foot-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 4px 0 0;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translate(-50%, 30px);
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
  max-width: calc(100vw - 32px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* non-Arabic UI */
[dir='ltr'] .wm-ar[lang='ar'] {
  font-size: 1.3rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
@media print {
  .top,
  .foot,
  .ad,
  .promo,
  .dhikr-actions,
  .progress,
  .text-tools,
  .dev-banner {
    display: none !important;
  }
  .card {
    box-shadow: none;
    break-inside: avoid;
  }
}

/* SEO intro, tags, related links, language links (P5.33–P5.36) */
.intro {
  font-family: var(--font-ui);
  line-height: 1.85;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 0 0 16px;
}
.intro p {
  margin: 0 0 10px;
}
.intro p:last-child {
  margin-bottom: 0;
}
.tag-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--primary);
  text-decoration: none;
  font-size: 0.92rem;
}
.tag:hover {
  border-color: var(--accent);
}
.tag .count {
  color: var(--muted);
  font-size: 0.8rem;
}
.tag-list.big .tag {
  font-size: 1.05rem;
  padding: 8px 16px;
}
.tag-cloud {
  margin: 28px 0 8px;
}
.tag-cloud h2,
.related h2 {
  font-size: 1.1rem;
  margin: 0 0 8px;
}
.tag-row,
.lang-links {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 8px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.lang-links a {
  color: var(--primary);
}
.related {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.related ul {
  margin: 0;
  padding-inline-start: 20px;
  line-height: 2;
}
.mt-label {
  margin: 4px 0 0;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--muted);
}

/* ---------- report a problem (dialog is created on first click) ---------- */
.report-dialog {
  width: min(92vw, 460px);
  max-height: 92dvh;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.report-dialog::backdrop {
  background: rgba(10, 20, 18, 0.45);
}
.rp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rp-head h2 {
  margin: 0;
  font-size: 1.1rem;
}
.report-dialog form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.report-dialog label {
  font-weight: 600;
  font-size: 0.9rem;
}
.report-dialog textarea,
.report-dialog input[type='text'] {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: inherit;
  font: inherit;
}
.rp-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}
.rp-types legend {
  padding: 0;
  margin-block-end: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}
.rp-chip {
  position: relative;
}
.rp-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.rp-chip span {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.88rem;
}
.rp-chip input:checked + span {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border-color: var(--primary);
  color: var(--primary);
}
.rp-chip input:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.rp-count,
.rp-hint {
  color: var(--muted);
  font-size: 0.78rem;
}
.rp-count {
  justify-self: end;
}
.rp-status {
  margin: 0;
  min-height: 1.3em;
  font-size: 0.9rem;
}
.rp-status.ok {
  color: var(--primary);
}
.rp-status.err {
  color: var(--danger);
}
.rp-actions .btn {
  border: 0;
  cursor: pointer;
  font: inherit;
}
.rp-actions .btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.report-cta {
  text-align: center;
}

/* ---------- 404 sections and contact (P5.51) ---------- */
.nf-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 4px;
  margin-block: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.contact-mail {
  font-size: 1.2rem;
  font-weight: 600;
}
