/* Daily Tasbeeh, Final v1: green night, emerald and gold. Dark by default, cream as an option. */

:root {
  --night: #07170F;
  --cream: #FFF8E8;
  --emerald: #0F7A4A;
  --deep: #0A3D2A;
  --gold: #F2C14E;
  --gold-line: #C9A227;
  --butter: #FFF1B5;
  --glacier: #B5E2F4;
  --sand: #E8CFA9;
  --ink: #1E2A22;

  /* Dark (default) */
  --bg: var(--night);
  --sheet: #0A1E14;
  --line: rgba(201, 162, 39, .32);
  --line-soft: rgba(201, 162, 39, .18);
  --text: #F3EEE1;
  --muted: #D6C8AC;          /* secondary text, sand toned */
  --label: var(--glacier);
  --translit: var(--glacier);
  --meaning: var(--sand);
  --head: var(--gold);
  --gold-ui: var(--gold);
  --count: var(--gold);
  --band-ar: #FFE9A8;        /* Arabic inside the emerald band */
  --ar: #FFE9A8;             /* Arabic on the page */
  --hint: var(--sand);
  --pattern-opacity: .07;
  --danger: #FF9C8A;
  --on-emerald: #FFF8E8;
  --string: var(--gold-line);

  --f-head: 'Space Grotesk', system-ui, sans-serif;
  --f-ar: 'Amiri', 'Geeza Pro', 'Noto Naskh Arabic', serif;

  --gutter: 16px;
  --topbar: 64px;
  --tabbar: 64px;
  color-scheme: dark;
}

/* Light: cream with emerald and gold */
:root[data-theme="light"] {
  --bg: var(--cream);
  --sheet: #FFF8E8;
  --line: rgba(169, 122, 16, .38);
  --line-soft: rgba(169, 122, 16, .2);
  --text: var(--ink);
  --muted: #5A4A20;
  --label: #0B6E8C;
  --translit: #0B6E8C;
  --meaning: #5A4A20;
  --head: #8A6A12;
  --gold-ui: #8A6A12;
  --count: var(--emerald);
  --band-ar: var(--gold);
  --ar: var(--deep);
  --hint: #5A4A20;
  --pattern-opacity: .12;
  --danger: #A8402E;
  --string: #A97A10;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-head);
  font-size: 16px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
}
/* Very faint gold eight pointed stars */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--pattern-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23F2C14E' stroke-width='1'%3E%3Crect x='29' y='29' width='30' height='30'/%3E%3Crect x='29' y='29' width='30' height='30' transform='rotate(45 44 44)'/%3E%3Crect x='37.5' y='37.5' width='13' height='13' transform='rotate(22.5 44 44)'/%3E%3Cpath d='M44 0V22.8M44 88V65.2M0 44H22.8M88 44H65.2M0 0L28.4 28.4M88 0L59.6 28.4M0 88L28.4 59.6M88 88L59.6 59.6'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 88px 88px;
}
:root[data-theme="light"] body::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23C9A227' stroke-width='1'%3E%3Crect x='29' y='29' width='30' height='30'/%3E%3Crect x='29' y='29' width='30' height='30' transform='rotate(45 44 44)'/%3E%3Crect x='37.5' y='37.5' width='13' height='13' transform='rotate(22.5 44 44)'/%3E%3Cpath d='M44 0V22.8M44 88V65.2M0 44H22.8M88 44H65.2M0 0L28.4 28.4M88 0L59.6 28.4M0 88L28.4 59.6M88 88L59.6 59.6'/%3E%3C/g%3E%3C/svg%3E");
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold-ui); outline-offset: 3px; }
[lang="ar"] { font-family: var(--f-ar); }
.k {
  font-family: var(--f-head);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 11px;
  font-weight: 500;
  color: var(--label);
}

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 640px;
  min-height: var(--topbar);
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand {
  display: inline-flex; align-items: center;
  min-height: 44px;
  font-size: 12px; font-weight: 600;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold-ui);
  text-decoration: none;
}
.topbar-actions { display: flex; gap: 10px; }
.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--gold-ui); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }

/* ---------- Counter ---------- */
.view { max-width: 640px; margin: 0 auto; }
.counter {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - var(--topbar) - var(--tabbar) - env(safe-area-inset-bottom));
  min-height: calc(100svh - var(--topbar) - var(--tabbar) - env(safe-area-inset-bottom));
  padding: 0 var(--gutter);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
/* The whole screen counts. Everything on top lets taps through. */
.tap-area {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  padding: 0; border: 0; background: none;
  touch-action: manipulation;
  cursor: pointer;
}
.tap-area:focus-visible { outline: 2px solid var(--gold-ui); outline-offset: -6px; border-radius: 12px; }
.stage, .tap-hint, .milestone, .welcome { position: relative; z-index: 2; pointer-events: none; }

.stage {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 0 4px;
}
.band-wrap { width: 100%; max-width: 520px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.diamonds { display: flex; align-items: center; gap: 9px; }
.diamonds::before, .diamonds::after { content: ""; width: 44px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line)); }
.diamonds::after { background: linear-gradient(90deg, var(--gold-line), transparent); }
.diamonds i { width: 5px; height: 5px; background: var(--gold-line); transform: rotate(45deg); }
.diamonds i:nth-child(2) { width: 8px; height: 8px; background: var(--gold); }
.ar-band {
  width: 100%;
  min-height: clamp(76px, 12svh, 104px);
  display: grid; place-items: center;
  padding: 8px 18px;
  background: var(--emerald);
  border: 2px solid var(--gold-line);
  border-radius: 6px;
  box-shadow: inset 0 0 0 4px var(--emerald), inset 0 0 0 5px rgba(242, 193, 78, .45);
}
.ar-text {
  margin: 0;
  font-family: var(--f-ar);
  font-size: clamp(34px, min(11.5vw, 6.4svh), 48px);
  line-height: 1.7;
  color: var(--band-ar);
}
.ar-text.mid { font-size: clamp(28px, 8.6vw, 40px); }
.ar-text.long { font-size: clamp(24px, 7vw, 32px); }
.ar-text.xlong { font-size: clamp(19px, 5.4vw, 25px); line-height: 1.8; }
.ar-text.latin { font-family: var(--f-head); font-size: 26px; font-weight: 600; line-height: 1.3; color: var(--band-ar); }
.translit { margin: clamp(8px, 1.8svh, 16px) 0 0; font-size: 18px; font-weight: 500; line-height: 1.3; color: var(--translit); }
.meaning { margin: 4px 0 0; font-size: 14.5px; line-height: 1.4; color: var(--meaning); max-width: 36ch; }
.phase-line { margin: 8px 0 0; font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--label); }

.ring-wrap { position: relative; width: min(84vw, 40svh, 380px); aspect-ratio: 320 / 330; margin-top: clamp(6px, 1.6svh, 18px); }
.ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ring-edge { fill: none; stroke: var(--gold-line); stroke-width: 1; opacity: .35; }
.ring-string { fill: none; stroke: var(--string); stroke-width: 1.2; opacity: .6; }
.bead { transform-box: view-box; transform-origin: 160px 160px; transition: transform .26s cubic-bezier(.3, .7, .25, 1); }
.bead-in { transform-box: view-box; transform-origin: 280px 160px; transition: transform .26s cubic-bezier(.3, .7, .25, 1); }
.bead .lit, .bead .halo, .imam .lit { opacity: 0; transition: opacity .22s ease; }
.bead.on .lit, .bead.on .halo, .imam.on .lit, .spacer .lit { opacity: 1; }
#beads, #tassel { transition: filter .5s ease; }
.ring-wrap.glow #beads, .ring-wrap.glow #tassel { filter: drop-shadow(0 0 6px rgba(242, 193, 78, .9)) drop-shadow(0 0 16px rgba(242, 193, 78, .5)); }
.ring-center {
  position: absolute; left: 50%; top: 48.5%; width: 58%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.count {
  font-family: var(--f-head);
  font-weight: 500;
  font-size: clamp(54px, min(19vw, 9svh), 92px);
  line-height: .95;
  color: var(--count);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
}
.of { margin-top: 6px; max-width: 100%; font-size: 13px; line-height: 1.35; letter-spacing: .04em; color: var(--meaning); }
body.locked .quick-actions { display: none; }
.quick-actions { position: relative; z-index: 3; pointer-events: auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: clamp(10px, 2svh, 18px); }
.qa {
  min-height: 44px; padding: 0 18px;
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--text); font-size: 14px; font-weight: 500;
  touch-action: manipulation;
}
.qa svg { width: 17px; height: 17px; fill: none; stroke: var(--gold-ui); stroke-width: 1.7; stroke-linecap: round; }
.qa:active { border-color: var(--gold-line); }
.done { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; position: relative; z-index: 3; }
.done-title { margin: 0; font-size: 28px; font-weight: 500; color: var(--head); line-height: 1.2; }
.done-sub { margin: 0 0 12px; font-size: 14px; color: var(--meaning); max-width: 30ch; }

.tap-hint { margin: 2px 0 12px; font-size: 12.5px; letter-spacing: .08em; color: var(--hint); text-align: center; }

.milestone, .welcome {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translate(-50%, 6px);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--sheet);
  border: 1px solid var(--gold-line);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  line-height: 1.35;
  opacity: 0;
  transition: opacity .35s ease, transform .35s ease;
  z-index: 4;
}
.milestone.show, .welcome.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Content sections ---------- */
.content { padding: 8px var(--gutter) 32px; }
#view-counter .content { margin-top: 8px; }
.seo-title {
  margin: 36px 0 8px;
  text-align: center;
  font-size: 13px; font-weight: 500;
  letter-spacing: .24em; text-transform: uppercase;
  color: var(--head);
}
.block { padding: 26px 0; border-top: 1px solid var(--line); }
.block:last-of-type { border-bottom: 1px solid var(--line); }
h2 { margin: 0 0 12px; font-size: 22px; line-height: 1.25; font-weight: 500; color: var(--head); letter-spacing: -.005em; }
h3 { margin: 22px 0 8px; font-size: 16px; font-weight: 600; color: var(--head); }
.block p { margin: 0 0 10px; }
.block p:last-child { margin-bottom: 0; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 14px; }
.steps li { counter-increment: s; position: relative; padding-left: 40px; }
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--gold-line); color: var(--gold-ui); font-size: 13px; font-weight: 600;
}
details { border-top: 1px solid var(--line-soft); }
summary { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-weight: 500; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--gold-ui); font-size: 22px; font-weight: 400; }
details[open] summary::after { content: "×"; }
details p { color: var(--muted); margin: 0 0 14px; }
.links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 28px 0 8px; }

.page-title { font-size: 28px; margin: 14px 0 18px; }
.ar-title { margin: 32px 0 0; font-family: var(--f-ar); font-size: 38px; line-height: 1.7; color: var(--ar); }
.soon { text-align: center; padding-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.soon .page-title { margin: 0 0 6px; }
.soon p { color: var(--muted); max-width: 34ch; margin: 0 0 16px; }

/* Stats: numbers and thin lines, no boxes */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); }
.tile { padding: 16px 4px; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line-soft); }
.tile:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.tile:nth-child(even) { padding-left: 18px; }
.tile-num { font-size: 32px; font-weight: 500; line-height: 1.1; color: var(--count); font-variant-numeric: tabular-nums; }
.tile-num small { font-size: 14px; font-weight: 400; color: var(--muted); }
.card { margin-top: 8px; padding: 22px 0 6px; border-top: 1px solid var(--line); }
.card > .k, .card h3.k { margin: 0 0 14px; }
.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 150px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar .v { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar .b { width: 100%; max-width: 26px; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--emerald); transition: height .3s ease; }
.bar.today .b { background: var(--gold); }
.bar .d { font-size: 10.5px; letter-spacing: .1em; color: var(--label); text-transform: uppercase; }
.bar.today .d { color: var(--gold-ui); font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); margin: 14px 0 0; border-top: 1px solid var(--line); }
.facts div { padding: 14px 4px; border-bottom: 1px solid var(--line-soft); }
.facts div:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.facts div:nth-child(even) { padding-left: 18px; }
.facts dd { margin: 4px 0 0; font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-head .k { margin: 0; }
.filter select { min-height: 44px; max-width: 200px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); }
.filter select option { background: var(--sheet); color: var(--text); }
.history { list-style: none; margin: 8px 0 0; padding: 0; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.history li:first-child { border-top: 0; }
.history .name { font-weight: 500; }
.history .meta { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--label); }
.history .num { text-align: right; font-weight: 600; color: var(--count); font-variant-numeric: tabular-nums; white-space: nowrap; }
.history .num small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
.btn.primary { background: var(--emerald); border-color: var(--gold-line); color: var(--on-emerald); }
.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn:disabled { opacity: .45; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.link-btn { display: block; margin: 12px auto 0; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--gold-ui); font-weight: 500; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding: 0 8px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 48px;
  border: 0; background: none;
  color: var(--muted);
  font-size: 11px; font-weight: 500;
  text-decoration: none;
}
.tab svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--gold-ui); }
.tab span { white-space: nowrap; }
@media (max-width: 440px) {
  .tabbar { padding: 0 4px env(safe-area-inset-bottom); }
  .tab { font-size: 10.5px; line-height: 1.15; }
  .tab span { white-space: normal; text-align: center; max-width: 7ch; }
}

/* ---------- Full screen ---------- */
.fs-exit {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent;
  display: none; place-items: center;
}
.fs-exit svg { width: 20px; height: 20px; stroke: var(--gold-ui); stroke-width: 1.8; fill: none; stroke-linecap: round; }
body.focus { overflow: hidden; padding-bottom: 0; }
body.focus .topbar, body.focus .tabbar, body.focus .content { display: none !important; }
body.focus .fs-exit { display: grid; }
body.focus #view-counter {
  position: fixed; inset: 0; z-index: 50;
  max-width: none;
  background: var(--bg);
  cursor: pointer;
  touch-action: manipulation;
}
body.focus .counter { min-height: 100vh; min-height: 100svh; max-width: 640px; margin: 0 auto; padding-top: max(56px, env(safe-area-inset-top)); }
body.focus .ring-wrap { width: min(88vw, 48svh, 460px); }

/* ---------- Sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(3, 10, 6, .55); opacity: 0; transition: opacity .25s ease; }
:root[data-theme="light"] .scrim { background: rgba(30, 42, 34, .35); }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  max-width: 640px; max-height: 88svh; margin: 0 auto;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 8px var(--gutter) max(24px, env(safe-area-inset-bottom));
  background: var(--sheet);
  border-top: 1px solid var(--gold-line);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .3);
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}
.sheet.open { transform: none; }
.grab { width: 40px; height: 3px; border-radius: 3px; background: var(--line); margin: 4px auto 8px; }
.sheet-head { position: sticky; top: -8px; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 6px 0 12px; background: var(--sheet); }
.sheet-head h2 { margin: 0; font-size: 22px; }
.close { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--gold-ui); font-size: 24px; line-height: 1; }
.note { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }

/* Counter tools at the top of the picker */
.tools { padding: 2px 0 18px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.now { margin: 0 0 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.now strong { font-size: 18px; font-weight: 600; color: var(--text); }
.now .source { font-size: 12px; color: var(--muted); }
.source.unverified { color: var(--danger); }
.tool-row { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.tool {
  min-height: 66px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 2px;
  border: 0; background: none;
  font-size: 12.5px; line-height: 1.15; color: var(--text);
  touch-action: manipulation;
}
.tool + .tool { border-left: 1px solid var(--line-soft); }
.tool svg { width: 21px; height: 21px; fill: none; stroke: var(--gold-ui); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tool:disabled { opacity: .4; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); margin: 14px 0 0; text-align: center; }
.quick dt { font-size: 10px; letter-spacing: .12em; }
.quick dd { margin: 2px 0 0; font-size: 19px; font-weight: 500; color: var(--count); font-variant-numeric: tabular-nums; }
.tool-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; }
.tool-links .link-btn { margin: 0; }

.dlist { list-style: none; margin: 0; padding: 0; }
.ditem-wrap { position: relative; border-bottom: 1px solid var(--line-soft); }
.ditem {
  width: 100%; text-align: left;
  display: grid; gap: 2px;
  padding: 16px 6px;
  border: 0; background: none;
}
.ditem.current { background: color-mix(in srgb, var(--gold) 7%, transparent); box-shadow: inset 2px 0 0 var(--gold-line); }
.ditem .arabic { font-family: var(--f-ar); color: var(--ar); font-size: 27px; line-height: 1.7; text-align: right; }
.ditem .dname { font-weight: 600; color: var(--head); }
.ditem .translit { color: var(--translit); font-size: 14.5px; }
.ditem .meaning { max-width: none; margin: 0; font-size: 14px; }
.ditem .dmeta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ditem .source { margin-top: 2px; font-size: 12px; color: var(--muted); }
.ditem-del { position: absolute; top: 12px; left: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--sheet); color: var(--danger); font-size: 12px; }

.custom-form, .inline-form { display: grid; gap: 12px; margin-top: 18px; }
.custom-form h3 { margin-top: 8px; }
.inline-form { grid-template-columns: 1fr auto; align-items: end; }
label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
input[type="number"], input:not([type]) {
  min-height: 48px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--line);
  background: transparent; color: var(--text); font-size: 16px;
}
input[dir="rtl"] { font-family: var(--f-ar); font-size: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 46px; min-width: 64px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-weight: 500; }
.chip.on { background: var(--emerald); border-color: var(--gold-line); color: var(--on-emerald); }
.chip:disabled { opacity: .4; }

.menu { display: grid; border-top: 1px solid var(--line-soft); }
.menu-item {
  display: grid; gap: 2px; text-align: left;
  min-height: 60px; padding: 12px 4px;
  border: 0; border-bottom: 1px solid var(--line-soft); background: none;
}
.menu-item strong { font-weight: 600; color: var(--text); }
.menu-item span { font-size: 13px; color: var(--muted); }
.menu-item.danger strong { color: var(--danger); }
a.menu-item { color: inherit; text-decoration: none; }

.toggles { display: grid; border-top: 1px solid var(--line-soft); }
.toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 64px; padding: 10px 4px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer; color: var(--text);
}
.toggle span { display: grid; }
.toggle strong { font-weight: 600; }
.toggle small { font-size: 13px; color: var(--muted); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { flex: none; position: relative; width: 48px; height: 28px; border-radius: 99px; border: 1px solid var(--line); background: transparent; transition: background .2s ease; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .2s ease, background .2s ease; }
.toggle input:checked + i { background: var(--emerald); border-color: var(--gold-line); }
.toggle input:checked + i::after { transform: translateX(20px); background: var(--gold); }
.toggle input:focus-visible + i { outline: 2px solid var(--gold-ui); outline-offset: 2px; }

.dialog { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: var(--gutter); background: rgba(3, 10, 6, .6); }
.dialog-box { width: 100%; max-width: 360px; padding: 24px; border-radius: 18px; background: var(--sheet); border: 1px solid var(--gold-line); }
.dialog-box p { margin: 0 0 18px; }
.dialog-box .row .btn { flex: 1; }

.toast {
  position: fixed; left: 50%; z-index: 95;
  bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  max-width: calc(100% - 32px);
  padding: 10px 18px; border-radius: 999px;
  background: var(--butter); color: var(--night); font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
:root[data-theme="light"] .toast { background: var(--deep); color: var(--cream); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Picker: search, tabs, Names of Allah ---------- */
.sheet-top { position: sticky; top: -8px; z-index: 2; background: var(--sheet); padding: 6px 0 10px; }
.search {
  display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line);
  color: var(--text);
}
.search:focus-within { border-color: var(--gold-ui); }
.search svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--gold-ui); stroke-width: 1.8; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; min-height: 46px; border: 0; padding: 0; background: none; outline: none; font-size: 16px; color: var(--text); }
.search input::placeholder { color: var(--muted); opacity: .85; }

.seg { display: grid; grid-template-columns: 1fr 1fr; margin-top: 8px; border-bottom: 1px solid var(--line-soft); }
.seg-btn {
  min-height: 46px; border: 0; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-weight: 500; font-size: 14.5px; color: var(--muted);
}
.seg-btn[aria-selected="true"] { color: var(--gold-ui); border-bottom-color: var(--gold); }
.seg.searching { opacity: .45; }

.names-intro { padding: 6px 4px 14px; text-align: center; }
.names-intro p { margin: 0 0 4px; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.names-intro .source { display: block; margin-top: 4px; font-size: 12px; color: var(--label); }

.ngrid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line-soft); }
.ncard {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 2px; min-height: 132px; padding: 12px 6px;
  border: 0; border-bottom: 1px solid var(--line-soft); background: none;
  text-align: center;
}
.ncard:not(:nth-child(3n)) { border-right: 1px solid var(--line-soft); }
.ncard.current { background: color-mix(in srgb, var(--gold) 8%, transparent); box-shadow: inset 0 -2px 0 var(--gold-line); }
.ncard .nnum { font-size: 10.5px; letter-spacing: .1em; color: var(--label); }
.ncard .ntr { font-weight: 600; font-size: 13px; line-height: 1.2; color: var(--head); }
.ncard .nar { font-family: var(--f-ar); font-size: 25px; line-height: 1.7; color: var(--ar); }
.ncard .nen { font-size: 11.5px; line-height: 1.3; color: var(--muted); }
.ncard .ncount { margin-top: auto; padding-top: 4px; font-size: 10px; letter-spacing: .04em; color: var(--gold-ui); }
.results-head { margin: 8px 4px 8px; }
.results-head + .dlist, .results-head + .ngrid { margin-bottom: 16px; }

/* ---------- Prayer times ---------- */
.prayer { max-width: 560px; margin: 0 auto; }
.pt-date { margin: 16px 0 0; }
.prayer .page-title { margin-top: 4px; }
.pt-city { display: flex; align-items: center; gap: 6px; margin: -8px 0 26px; color: var(--muted); font-size: 15px; }
.pt-city svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--gold-ui); stroke-width: 1.6; }
/* Next prayer: the same emerald band with a gold border */
.pt-next {
  position: relative;
  padding: 22px 20px 20px;
  background: var(--emerald);
  border: 2px solid var(--gold-line);
  border-radius: 6px;
  box-shadow: inset 0 0 0 4px var(--emerald), inset 0 0 0 5px rgba(242, 193, 78, .45);
  color: var(--cream); text-align: center;
  margin-bottom: 8px;
}
.pt-next::before, .pt-next::after {
  content: ""; position: absolute; left: 50%;
  width: 9px; height: 9px; margin-left: -4.5px;
  background: var(--gold); transform: rotate(45deg);
  box-shadow: 0 0 0 3px var(--bg);
}
.pt-next::before { top: -6px; }
.pt-next::after { bottom: -6px; }
.pt-next .k { color: var(--butter); }
.pt-next p { margin: 0; }
.pt-next-name { font-size: 34px; font-weight: 500; color: var(--gold); letter-spacing: -.01em; line-height: 1.15; margin-top: 4px !important; }
.pt-next-time { font-size: 17px; color: var(--cream); }
.pt-count { font-size: 40px; font-weight: 500; letter-spacing: .01em; font-variant-numeric: tabular-nums; color: var(--butter); margin-top: 10px !important; line-height: 1.1; }
.pt-note { font-size: 13.5px; color: #E8F1EA; margin-top: 12px !important; padding-top: 12px; border-top: 1px solid rgba(242, 193, 78, .35); }
.pt-list { list-style: none; margin: 0; padding: 0; }
.pt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line-soft); }
.pt-row:last-child { border-bottom: 0; }
.pt-row-name { display: flex; flex-direction: column; }
.pt-row-name strong { font-weight: 500; font-size: 16.5px; }
.pt-row-name span { font-size: 12.5px; color: var(--muted); }
.pt-row-time { font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-row.past { opacity: .5; }
.pt-row.next { box-shadow: inset 2px 0 0 var(--gold-line); padding-left: 14px; background: color-mix(in srgb, var(--gold) 7%, transparent); }
.pt-row.next .pt-row-time, .pt-row.next strong { color: var(--gold-ui); }
.pt-loc { text-align: center; }
.pt-loc .btn { width: 100%; }
.pt-privacy { margin: 10px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.pt-setup { border-top: 1px solid var(--line); }
.pt-setup h3 { margin-top: 0; font-size: 19px; }
.pt-setup > p { color: var(--muted); margin: 0 0 16px; }
.pt-setup .pt-msg { color: var(--gold-ui); font-weight: 500; }
.pt-actions { display: grid; gap: 10px; }
.pt-search { margin-top: 14px; }
.pt-search .search { padding: 0 16px; }
.pt-results { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--line-soft); }
.pt-result { width: 100%; min-height: 54px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 8px 4px; border: 0; border-bottom: 1px solid var(--line-soft); background: none; text-align: left; }
.pt-result:hover, .pt-result:focus-visible { color: var(--gold-ui); }
.pt-result span { font-size: 13px; color: var(--muted); }
.pt-none { color: var(--muted); font-size: 14px; padding: 6px 2px; }
.pt-adjust { padding-top: 4px; padding-bottom: 8px; }
.pt-adjust summary { font-weight: 600; color: var(--head); }
.pt-adjust-intro { font-size: 13.5px; }
.pt-adj { display: grid; grid-template-columns: 1fr auto 44px 44px; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.pt-adj-name { font-weight: 500; }
.pt-adj-val { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.pt-step { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; display: grid; place-items: center; }
.pt-step svg { width: 18px; height: 18px; fill: none; stroke: var(--gold-ui); stroke-width: 2; stroke-linecap: round; }
.pt-step:disabled { opacity: .35; }
.pt-disclaimer { text-align: center; color: var(--text); font-size: 14px; margin: 24px 0 6px; }
.pt-method { text-align: center; color: var(--muted); font-size: 12.5px; margin: 0 auto; max-width: 46ch; }

/* ---------- Accounts ---------- */
.acct-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding: 14px 0; }
.acct-card p { margin: 0; font-size: 14.5px; color: var(--text); }
.acct-card.in p { display: flex; flex-direction: column; }
.acct-card.in p span { font-size: 12.5px; color: var(--muted); }
.acct-card .btn { flex: none; min-height: 44px; padding: 0 18px; }
.acct { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.acct form { display: flex; flex-direction: column; gap: 10px; }
.acct-lead { margin: 0 0 4px; color: var(--muted); }
.acct-lead b { color: var(--text); font-weight: 600; word-break: break-all; }
.acct-label { font-weight: 500; font-size: 14px; }
.acct input[type="email"] {
  min-height: 50px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 16px; width: 100%;
}
.acct input[type="email"]:focus { outline: none; border-color: var(--gold-ui); }
.acct-wide { width: 100%; gap: 10px; }
.acct-provider svg { width: 20px; height: 20px; flex: none; }
.acct-small { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.acct-small a, .acct-sent a { color: var(--gold-ui); }
.acct-msg { margin: 0; color: var(--danger); font-size: 14px; }
.acct-sent { padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.acct-sent p { margin: 0 0 6px; }
.acct-sent .link-btn { margin: 4px 0 0; padding: 0; min-height: 44px; }
.acct-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 6px 0; }
.acct-or::before, .acct-or::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.acct-status { margin: 0 0 6px; font-size: 14px; color: var(--text); }
.menu-item b { font-weight: 600; color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .bead, .bead-in, .bead .lit, .bead .halo, .imam .lit, .sheet, .milestone, .welcome, .toast, .scrim, .bar .b { transition: none; }
}

/* ---------- Learn to pray ---------- */
@media (max-width: 440px) {
  .tabbar { padding: 0 2px env(safe-area-inset-bottom); }
  .tab { font-size: 10px; }
}
.pg-intro { margin: -6px 0 18px; color: var(--meaning); }
.pg-cards { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.pg-card {
  display: flex; align-items: center; gap: 14px;
  min-height: 78px; padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.pg-card .pg-pose { flex: none; width: 58px; height: 56px; }
.pg-card-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pg-card-text strong { font-size: 19px; font-weight: 500; color: var(--head); }
.pg-card-text span { font-size: 13.5px; color: var(--meaning); }
.pg-card-go { font-size: 26px; line-height: 1; color: var(--gold-ui); }
.pg-card:active { background: color-mix(in srgb, var(--gold) 7%, transparent); }

.pg-pose { display: block; fill: none; stroke: var(--gold); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="light"] .pg-pose { stroke: var(--gold-line); }
.pg-pose .pg-ground { stroke-width: 1.4; opacity: .45; }
.pg-pose .pg-turbah { stroke-width: 2; }

.pg-player { max-width: 640px; margin: 0 auto; padding: 0 var(--gutter); }
.pg-top { display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; }
.pg-top .icon-btn { flex: none; }
.pg-top-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pg-top-text strong { font-size: 20px; font-weight: 500; color: var(--head); line-height: 1.2; }
.pg-top-text span { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--label); margin-top: 2px; }
.pg-stepnum { flex: none; font-size: 12.5px; color: var(--muted); }
.pg-progress { height: 2px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.pg-progress i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s ease; }

.pg-body { padding: 14px 0 20px; text-align: center; touch-action: pan-y; min-height: 52svh; }
.pg-fig { display: flex; justify-content: center; margin: 2px 0 8px; }
.pg-fig .pg-pose { width: min(46vw, 22svh, 190px); height: auto; }
.pg-title { margin: 4px 0 8px; font-size: 26px; }
.pg-text { margin: 0 auto 12px; max-width: 34ch; font-size: 16.5px; line-height: 1.5; color: var(--text); }
.pg-list { text-align: left; margin: 4px auto 14px; padding-left: 22px; max-width: 40ch; }
.pg-list li { margin: 0 0 10px; line-height: 1.5; }
.pg-rec {
  display: inline-block; margin: 0 0 12px; padding: 4px 12px;
  border: 1px solid var(--gold-line); border-radius: 999px;
  font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--gold-ui);
}
.pg-rec.in-band { margin: 6px 0 0; border-color: rgba(242, 193, 78, .6); color: var(--butter); font-size: 11px; padding: 2px 10px; }
.pg-band {
  margin: 6px 0 10px; padding: 18px 16px;
  background: var(--emerald);
  border: 2px solid var(--gold-line); border-radius: 6px;
  box-shadow: inset 0 0 0 4px var(--emerald), inset 0 0 0 5px rgba(242, 193, 78, .45);
}
.pg-ar { margin: 0; font-family: var(--f-ar); font-size: clamp(24px, 7vw, 30px); line-height: 1.9; color: var(--band-ar); }
.pg-ar.long { font-size: clamp(20px, 5.6vw, 25px); }
.pg-ar.quran { font-size: clamp(21px, 6vw, 26px); line-height: 2; }
.pg-band-label { margin: 0 0 4px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--butter); }
.pg-band-gap { display: block; height: 1px; margin: 14px 20%; background: rgba(242, 193, 78, .45); }
.pg-tr { margin: 10px 0 0; font-size: 16px; font-weight: 500; line-height: 1.45; color: #B5E2F4; }
.pg-en { margin: 6px 0 0; font-size: 14.5px; line-height: 1.45; color: #F3E3C3; }
.pg-qsrc { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.pg-note { margin: 0 auto 10px; max-width: 36ch; font-size: 14.5px; line-height: 1.45; color: var(--meaning); }
.pg-src { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 14px 0 0; font-size: 13px; }
.pg-src-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--gold-ui); font-weight: 500; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.pg-cite { font-size: 12.5px; color: var(--muted); }
.pg-list .pg-cite { white-space: nowrap; }
.pg-count { min-width: 200px; margin: 6px 0 4px; }

.pg-nav {
  position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 12px 0 14px;
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
}
.pg-nav .btn { width: 100%; }
@media (prefers-reduced-motion: reduce) { .pg-progress i { transition: none; } }

/* Verse by verse: Arabic, then how to say it, then the meaning */
.pg-verse { padding: 12px 0; border-top: 1px solid rgba(242, 193, 78, .28); }
.pg-verse:first-of-type { border-top: 0; padding-top: 4px; }
.pg-verse:last-child { padding-bottom: 2px; }
.pg-verse .pg-tr { margin-top: 4px; }
.pg-verse .pg-en { margin-top: 4px; }
.pg-verse .pg-rec.in-band { display: table; margin: 2px auto 16px; }
.pg-verse .pg-rec.in-band + .pg-ar { line-height: 2.1; }

/* The fuller ruling, shown under the ruku and sajdah dhikr */
.pg-ruling { margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); text-align: left; }
.pg-ruling-title { margin: 0 0 10px; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--label); }
.pg-ruling-list { margin: 0; padding-left: 20px; }
.pg-ruling-list li { margin: 0 0 9px; font-size: 15px; line-height: 1.5; color: var(--text); }
.pg-ruling-list li::marker { color: var(--gold-ui); }
.pg-ruling-list .pg-cite { white-space: nowrap; }
.pg-ruling-links { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.pg-ruling-links .pg-src-link { min-height: 0; padding: 6px 0; }

/* Prayer tab: switch between the times and the step by step guide */
.pp-switch { display: grid; grid-template-columns: 1fr 1fr; margin: 6px 0 4px; border-bottom: 1px solid var(--line-soft); }
.pp-switch a {
  display: flex; align-items: center; justify-content: center;
  min-height: 46px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 15px; font-weight: 500; text-decoration: none;
}
.pp-switch a.on { color: var(--gold-ui); border-bottom-color: var(--gold); }
@media (max-width: 440px) { .tab { font-size: 11px; } }

/* Three buttons under the ring stay on one row */
.quick-actions { flex-wrap: nowrap; gap: 8px; max-width: 100%; }
.qa { padding: 0 13px; gap: 6px; font-size: 13.5px; white-space: nowrap; }
.qa svg { width: 15px; height: 15px; flex: none; }
@media (max-width: 360px) { .qa { padding: 0 10px; font-size: 12.5px; } .qa svg { display: none; } }
/* Short phones: make room so the buttons stay above the tab bar */
@media (max-height: 720px) {
  .ar-band { min-height: 64px; padding: 4px 14px; }
  .band-wrap { gap: 6px; }
  .ring-wrap { width: min(72vw, 34svh, 380px); margin-top: 2px; }
  .translit { margin-top: 6px; font-size: 16.5px; }
  .meaning { font-size: 13.5px; }
  .phase-line { margin-top: 4px; }
  .quick-actions { margin-top: 6px; }
  .tap-hint { margin: 0 0 6px; font-size: 11.5px; }
}
