/* أذكار · Adhkar — © 2026 Khalid Al-Ghamdi · خالد الغامدي. All rights reserved.
   Quiet by design: one decorative element (the sky band, coloured from the real sun position) and the misbaha beads.
   Logical properties only, so Arabic (RTL) and English (LTR) mirror on their own. */

/* Every colour lives in www/data/themes.json and is generated into www/css/themes.css (tools/palettes.mjs).
   No colour is written here: tests/themes.test.mjs fails on a hand-written hex outside the generated file. */
:root {
  --ui: 'IBM Plex Sans Arabic', system-ui, sans-serif; --display: 'Reem Kufi', var(--ui); --naskh: 'Amiri', 'Noto Naskh Arabic', serif;
  /* 2026-11-20: Reem Kufi's flat connectors read as a line through the word at title size, so --display is kept for the
     wordmark and the big numerals only, and every heading uses --title (the UI face at 600/700). */
  --title: var(--ui);
  --text-scale: 1; --radius: 18px;
  --z-bar: 10; --z-toast: 50;
  /* Capacitor injects --safe-area-inset-* (SystemBars insetsHandling "css"); browsers have env() */
  --sa-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px)); --sa-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

/* Reem Kufi is for Arabic headings; its Latin squeezes word spaces, so English headings use the UI face */
:root[lang="en"] { --display: var(--ui); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100svh; background: var(--bg); background-attachment: fixed; color: var(--ink); font: 400 1rem/1.6 var(--ui); -webkit-tap-highlight-color: transparent; }
#view { max-width: 600px; margin: 0 auto; min-height: 100svh; outline: none; padding-bottom: calc(24px + var(--sa-bottom)); }
button, input, select { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--agate); outline-offset: 2px; }
.ic { flex: none; }
[dir="ltr"] .ic-back, [dir="ltr"] .ic-prev, [dir="ltr"] .ic-next { transform: scaleX(-1); }
.fatal { padding: 24px; text-align: center; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500; }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--agate); border-color: var(--agate); color: var(--agate-ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-quiet { border-color: transparent; background: none; color: var(--danger); }
.btn-quiet { border-color: transparent; background: none; color: var(--ink-2); }
.icon-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 0; background: none; color: inherit; }
.icon-btn:active, .btn:active { transform: scale(.97); }

/* ---------- the sky: one FIXED layer the whole app scrolls over (skyart.js) ---------- */
.sky-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top, var(--bg)) 0%, var(--sky-bottom, var(--bg)) 46%, var(--bg) 86%); }
.sa-defs { position: absolute; width: 0; height: 0; }
.sa-glow { position: absolute; inset: auto 0 0 0; height: 56%;
  background: radial-gradient(130% 92% at 50% 116%, var(--sky-bottom, transparent) 0%, transparent 72%); opacity: .55; }
.sa-layer { position: absolute; inset-inline: 0; top: var(--top); height: var(--h); width: 100%; }
.sa-sheet rect { fill: #fff; }
.sky-bg:not(.is-night) .sa-sheet rect { fill: #fff; }
.sky-bg.is-night .sa-sheet { opacity: .22; }
.sa-sheet { animation: sa-drift var(--t) linear infinite alternate; will-change: transform; }
.sa-sheet.rev { animation-direction: alternate-reverse; }
@keyframes sa-drift { from { transform: translateX(-9%); } to { transform: translateX(9%); } }
.sa-stars { opacity: 0; transition: opacity 1.2s; }
.sky-bg.is-night .sa-stars { opacity: 1; }
.sa-star { fill: #fff; opacity: var(--o, .5); animation: sa-twinkle 4.5s ease-in-out infinite; animation-delay: var(--d); }
@keyframes sa-twinkle { 0%, 100% { opacity: var(--o, .5); } 50% { opacity: calc(var(--o, .5) * .35); } }
html[data-motion="lite"] .sa-sheet, html[data-motion="lite"] .sa-star { animation: none; }
@media (prefers-reduced-motion: reduce) { .sa-sheet, .sa-star { animation: none !important; } }

/* ---------- the sky band (home) ----------
   2026-11-20: the band no longer ends in a seam. home.js computes --sky-fade (the band's own bottom colour mixed into
   the page) and the page behind it carries the same tint, so the whole screen is dawn-coloured at dawn. */

.sky { position: relative; padding: calc(14px + var(--sa-top)) 20px 30px; color: #15212a; }
.sky.sky-dark { color: #f3efe8; }
/* the veil under the header's text: its strength is computed per render (sky.js skyInk) and is 0 for most of the
   day — it only rises where the band runs from deep blue to pale and no single ink can carry both ends. It fades
   out at its own bottom, so it never ends in a straight line (قاعدة خالد، 2026-11-21). */
.sky::before { content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--sky-veil, #000) calc(var(--sky-veil-a, 0) * 100%), transparent) 0 84%,
    color-mix(in srgb, var(--sky-veil, #000) 0%, transparent) 100%); }
.sky > * { position: relative; z-index: 1; }
.sky-row { display: flex; align-items: center; justify-content: space-between; }
.sky-actions { display: flex; align-items: center; gap: 2px; }
.brand { margin: 0; font: 700 1.75rem/1.2 var(--display); letter-spacing: 0; }
.sky-date { margin: 10px 0 0; font-weight: 500; }
.sky-prayers { margin: 2px 0 0; font-size: .9rem; opacity: .85; }

/* ---------- the hero: the hour, on the sky ---------- */
.sky-hero { padding: calc(14px + var(--sa-top)) 20px 26px; }
.hero-count { display: grid; justify-items: center; gap: 4px; width: 100%; margin-top: 14px; padding: 6px 0 0; border: 0; background: none; color: inherit; }
.hero-label { font-size: .9rem; opacity: .9; }
.hero-clock { font: 700 3.1rem/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.hero-bar { display: block; width: 100%; height: 4px; margin-top: 10px; border-radius: 4px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.sky:not(.sky-dark) .hero-bar { background: rgba(0, 0, 0, .14); }
.hero-fill { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: currentColor; opacity: .85; border-radius: 4px; }
.hero-ends { display: flex; justify-content: space-between; width: 100%; font-size: .8rem; opacity: .85; }
.hero-times { display: flex; justify-content: space-between; gap: 2px; margin-top: 16px; padding: 8px 6px; border-radius: 16px;
  background: radial-gradient(120% 160% at 50% 50%, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, .06) 100%); backdrop-filter: blur(6px); }
.sky:not(.sky-dark) .hero-times { background: rgba(255, 255, 255, .35); }
.hero-t { display: grid; justify-items: center; gap: 1px; min-width: 0; flex: 1 1 0; }
.hero-t-name { font-size: .7rem; opacity: .85; }
.hero-t-at { font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-t.is-next { font-weight: 700; }
.hero-t.is-next .hero-t-name, .hero-t.is-next .hero-t-at { opacity: 1; }

/* a line of the dhikr itself, inside the card that opens it */
.card-peek { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--ink-2);
  font: 400 calc(1.02rem * var(--text-scale))/1.95 var(--naskh); text-align: start; }
.card-go { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--agate); font-weight: 600; }
.card-go .ic { width: 16px; height: 16px; }

/* ---------- القمر: the box, as the rival's is read (خالد، 2026-11-21) ----------
   One night behind everything, the disc in the middle with its arc, a column of words on each side, one line under
   it. The disc does NOT spin and nothing slides over anything: the «four layers» were the spin, the halo and the
   shadow moving apart. moondisc.js draws the real maria in their real places instead. */
.moon-box { display: grid; gap: 8px; }
.moon-stage { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 14px 12px; border-radius: 18px; overflow: hidden;
  background: radial-gradient(130% 120% at 50% 118%, color-mix(in srgb, var(--agate) 18%, transparent) 0%, transparent 62%),
    linear-gradient(180deg, #0a1018 0%, #0e1624 58%, #121d2c 100%); }
.moon-col { display: grid; gap: 8px; min-width: 0; z-index: 1; }
.moon-col-a { text-align: end; }
.moon-col-b { text-align: start; }
.moon-cell { display: grid; gap: 1px; min-width: 0; }
.moon-cell-k { color: #9fb3c8; font-size: .74rem; }
.moon-cell-v { color: #e8eef5; font-size: .86rem; font-variant-numeric: tabular-nums; }
.moon-caption { margin: 0; color: var(--ink-2); font-size: .82rem; text-align: center; }
.moon-orb { position: relative; display: grid; place-items: center; width: 132px; height: 132px; z-index: 1; }
.moon-arc { position: absolute; inset: 0; width: 100%; height: 100%; }
.ma-track { fill: none; stroke: rgba(255, 255, 255, .10); stroke-width: 4; stroke-linecap: round; }
.ma-lit { fill: none; stroke-width: 4; stroke-linecap: round; }
.ms-stars { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .75; }
.moon-disc { position: relative; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .45)); }
.md-mare { fill: #39414d; }
.md-crater-bright, .md-ray { fill: #ffffff; stroke: #ffffff; }
.md-night { fill: #070b11; opacity: .94; }
.md-lightside { fill: var(--moon-hi); }
.md-rim { fill: none; stroke: rgba(255, 255, 255, .14); stroke-width: 1; }

/* ---------- home ---------- */
.home { display: grid; gap: 12px; padding: 0 16px; margin-top: -8px; }
/* glass (Khalid, 2026-11-21): the sky must show through the surfaces, with a lit edge so each one reads as a pane.
   2026-11-22: the tint is no longer written here. It used to say 78 % «enough for the contrast the suite measures on
   the solid colour to hold on the glass too» — an assertion, and a wrong one: behind the glass sits the sky AND the
   white cloud sheets, and on five of the eleven faces a cloud bank drifting behind a card dropped --ink-2 to about
   3.7:1. --glass / --glass-main / --glass-bar now come from tools/palettes.mjs, which gives each face the SMALLEST
   tint that holds both inks at 4.5:1 all day under every cloud; tests/glass.test.mjs is the gate. */
.card { display: grid; gap: 4px; width: 100%; padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: start; }
@supports (backdrop-filter: blur(2px)) {
  .card, .group, .more-list, .times-list, .occ-list, .rooms, .cal-day, .count-dock, .tabbar, .sheet, .dialog {
    background: color-mix(in srgb, var(--surface) var(--glass, 78%), transparent);
    backdrop-filter: blur(16px) saturate(1.25);
    border-color: color-mix(in srgb, var(--ink) 14%, transparent);
    box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 16%, transparent), 0 10px 28px -22px #000;
  }
  .card-main { background: color-mix(in srgb, var(--surface-2) var(--glass-main, 82%), transparent); }
  .sheet, .dialog { backdrop-filter: blur(22px) saturate(1.2); background: color-mix(in srgb, var(--surface) max(var(--glass, 78%), 86%), transparent); }
  .tabbar { background: color-mix(in srgb, var(--surface) var(--glass-bar, 92%), transparent); }
}
.session-card { position: relative; padding-inline-start: 44px; }
.session-card::before { content: ''; position: absolute; inset-inline-start: 18px; top: 24px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--agate); }
.session-card.is-done::before { background: var(--agate); }
/* the session that is due now: the one block the eye should land on — the secondary surface, a brand rail, the accent
   carried into its own line (the 30 % and the 10 % of the colour budget) */
.card-main { position: relative; overflow: hidden; padding-block: 24px; border-color: var(--agate); background: var(--surface-2); box-shadow: 0 10px 30px -22px var(--ink); }
.card-main::before { top: 30px; }
.card-main::after { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--agate) 0%, transparent), var(--agate) 22%, var(--agate) 78%, color-mix(in srgb, var(--agate) 0%, transparent)); }
.card-main .card-sub { color: var(--agate); font-weight: 500; }
.card-title { font: 700 1.25rem/1.3 var(--title); letter-spacing: -.01em; }
.card-main .card-title { font-size: 1.5rem; }
.card-sub { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.card-sub .ic { color: var(--agate); width: 18px; height: 18px; }
.card-meta { color: var(--ink-2); font-size: .85rem; }
.tasbih-card .card-title { font-size: 1.15rem; }
/* 2026-11-20, second pass: the tasbih count was given the bead colour and taken back — «the 10 % is a budget, not a
   licence: if two things on a screen are both in the accent colour, neither is the accent» (canon COLOUR-CRAFT § 1),
   and --amber is a shape colour, held to 3:1, so it must never carry text. The due session keeps the one accent. */
.enable-card { gap: 8px; border-style: dashed; }
.enable-title { margin: 0; font-weight: 600; }
.enable-hint { margin: 0 0 6px; color: var(--ink-2); font-size: .92rem; }
.enable-card .btn { justify-self: start; }
.remind-line { display: flex; justify-content: space-between; gap: 12px; margin: 4px 4px 0; color: var(--ink-2); font-size: .92rem; }
.remind-label { font-weight: 500; color: var(--ink); }
.more { display: grid; gap: 8px; padding-top: 8px; }
.more-title { margin: 4px 4px 0; font: 600 1.05rem/1.4 var(--title); }
.more-list { display: grid; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.more-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 18px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-align: start; }
.more-item:last-child { border-bottom: 0; }
.more-item:active { background: var(--surface-2); }
.more-name { font-weight: 500; }
.more-count { flex: none; color: var(--ink-2); font-size: .85rem; }
.streak { padding: 16px 4px 4px; }
.streak-num { margin: 0 0 12px; font-weight: 500; }
.week { display: flex; justify-content: space-between; gap: 6px; }
.wday { position: relative; display: grid; grid-template-rows: 14px 14px auto; justify-items: center; width: 36px; }
.wday .half { width: 28px; height: 14px; border: 1.5px solid var(--line); background: var(--surface); }
.wday .half.top { border-radius: 14px 14px 0 0; border-bottom-width: .75px; }
.wday .half.bottom { border-radius: 0 0 14px 14px; border-top-width: .75px; }
.wday .half.on { background: var(--agate); border-color: var(--agate); }
.wday.is-today .half { border-color: var(--ink-2); }
.wday-name { margin-top: 6px; font-size: .75rem; color: var(--ink-2); }

/* ---------- the destination bar (1.0) ---------- */
#view[data-route="prayer"], #view[data-route="home"] { padding-bottom: calc(86px + var(--sa-bottom)); }
.tabbar::before { content: ''; position: absolute; inset: -28px 0 100% 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 55%, transparent)); }
.tabbar { position: fixed; inset: auto 0 0 0; z-index: var(--z-bar); display: flex; justify-content: center; gap: 4px;
  width: 100%; max-width: 600px; margin: 0 auto; padding: 6px 8px calc(6px + var(--sa-bottom));
  background: color-mix(in srgb, var(--surface) var(--glass-bar, 92%), transparent); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
@supports not (backdrop-filter: blur(1px)) { .tabbar { background: var(--surface); } }
.tab { display: grid; justify-items: center; gap: 2px; flex: 1 1 0; min-width: 0; min-height: 56px; padding: 6px 2px;
  border: 0; border-radius: 14px; background: none; color: var(--ink-2); }
.tab .ic { width: 24px; height: 24px; }
.tab-name { font-size: .72rem; font-weight: 500; }
.tab.is-on { color: var(--agate); }
.tab:active { background: var(--surface-2); }

/* ---------- the prayer destination ---------- */
.prayer { display: grid; gap: 12px; padding: 0 16px; margin-top: -8px; }
.brand-sm { font-size: 1.3rem; }
.count-wrap { display: grid; gap: 6px; padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--agate); background: var(--surface-2); }
.count-label { margin: 0; color: var(--ink-2); font-size: .92rem; }
.count-clock { margin: 0; font: 700 2.6rem/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.count-bar { height: 5px; margin-top: 6px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.count-fill { height: 100%; width: calc(var(--p, 0) * 100%); background: var(--agate); border-radius: 5px; transition: width .9s linear; }
.count-ends { display: flex; justify-content: space-between; gap: 12px; margin: 2px 0 0; color: var(--ink-2); font-size: .85rem; }
.times-list { display: grid; margin: 0; padding: 0; list-style: none; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.time-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 18px; border-bottom: 1px solid var(--line); }
.time-row:last-child { border-bottom: 0; }
.time-row.is-next { background: radial-gradient(118% 150% at 50% 50%, var(--agate-soft) 0%, color-mix(in srgb, var(--agate-soft) 0%, transparent) 100%); }
.time-row.is-next .time-name { font-weight: 700; color: var(--agate); }
.time-name { font-weight: 500; }
.time-at { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.time-row.is-next .time-at { color: var(--agate); font-weight: 600; }
/* walking the days: the arrows mirror with the page, so «previous» is always behind you in reading order */
.daywalk { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.walk-day { flex: 1 1 auto; min-width: 0; text-align: center; font-weight: 500; }
button.walk-day { min-height: 44px; }
/* «الآن» — ONE card for the hour on the home: the session due, its own text, «تابع ›», and مشاركة. What else the
   hour asks sits under it as chips, because a second box with the same name was the thing Khalid read as «لخبطة». */
.now-card { display: grid; gap: 8px; padding: 14px 18px; }
.now-title { margin: 0; }
.hour-card { gap: 10px; padding: 14px 18px 16px; border-color: var(--agate); }
.hour-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; }
.hour-share { width: 40px; height: 40px; color: var(--ink-2); }
.hour-open { display: grid; gap: 4px; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: start; }
.hour-open .card-title { font-size: 1.4rem; }
.hour-extras { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.now-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.now-chip { min-height: 44px; }
.now-note { color: var(--ink-2); font-size: .92rem; }
.night-card { display: grid; gap: 6px; }
.moon-card { display: grid; gap: 4px; }
.moon-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.night-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.night-card .note { margin: 2px 0 0; }

/* القبلة في شريط يطلع من تحت — بلا بطاقة وبلا لمعان (خالد، 2026-11-21: «كنسل اللمعان وكنسل البطاقة»). */
.sheet.sheet-card, .sheet.sheet-card .sheet-body { scrollbar-width: none; }
.sheet.sheet-card::-webkit-scrollbar, .sheet.sheet-card .sheet-body::-webkit-scrollbar { width: 0; height: 0; display: none; }
.q-face { display: grid; justify-items: center; gap: 6px; padding: 6px 2px 10px; }
.q-place-line { margin: 0; color: var(--ink-2); font-size: .9rem; }
.q-dial-lg { width: min(74vw, 290px); height: auto; }
.q-northmark { fill: var(--danger); }
/* the needle: a small droplet, the Kaaba at its hub */
.q-needle-body { fill: var(--agate); }
.q-needle-hole { fill: var(--surface); }
.q-ray { transform-origin: 50% 50%; transition: rotate .18s linear; }
.q-static .q-ray, .q-static .q-rose { transition: none; }
.k-face { fill: #15161a; }
.k-band { fill: var(--amber); }
.k-door { fill: var(--amber); opacity: .85; }
.is-aligned .q-needle-body { fill: var(--amber); }
.q-warn-line { margin: 10px 2px; }
/* 17b: the declination the arrow was corrected by — a fact about the place, in the accent that may carry text */
.q-decl-line { margin: 8px 2px; color: var(--agate); }
@media (prefers-reduced-motion: reduce) { .q-ray { transition: none; } }

/* ---------- القبلة ---------- */
#view[data-route="qibla"] { padding-bottom: calc(86px + var(--sa-bottom)); }
.qibla { display: grid; justify-items: center; gap: 12px; padding: 8px 16px 0; }
.q-place { display: grid; justify-items: center; gap: 2px; min-height: 48px; padding: 6px 14px; border: 0; border-radius: 14px; background: none; color: var(--ink); font-weight: 500; }
.q-km { color: var(--ink-2); font-size: .85rem; font-weight: 400; }
.q-deg { display: grid; justify-items: center; gap: 0; margin: 0; }
.q-deg-num { font: 700 3rem/1 var(--display); font-variant-numeric: tabular-nums; color: var(--agate); }
.q-deg-label { color: var(--ink-2); font-size: .85rem; }
.q-dial { width: min(78vw, 300px); height: auto; }
.q-ring { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.q-rose, .q-needle { transform-origin: 50% 50%; transition: transform .18s linear; }
.q-static .q-rose, .q-static .q-needle { transition: none; }
.q-tick { stroke: var(--line); stroke-width: 2; }
.q-tick-long { stroke: var(--ink-2); stroke-width: 2.5; }
.q-letter { fill: var(--ink-2); font: 600 13px var(--ui); }
.q-north { fill: var(--danger); }
.q-arrow { fill: var(--agate); }
.q-hub { fill: var(--surface); stroke: var(--agate); stroke-width: 2; }
.is-aligned .q-arrow { fill: var(--amber); }
.is-aligned .q-ring { stroke: var(--amber); stroke-width: 3; }
.q-live { margin: 0; min-height: 1.4em; font-weight: 500; }
.q-hint { margin: 0; color: var(--ink-2); font-size: .9rem; text-align: center; }
.q-warn { width: 100%; }
@media (prefers-reduced-motion: reduce) { .q-rose, .q-needle { transition: none; } }

/* ---------- التقويم ---------- */
#view[data-route="calendar"] { padding-bottom: calc(86px + var(--sa-bottom)); }
.bar.cal-bar { grid-template-columns: 48px 48px 1fr 48px; }  /* .bar is defined later, so this needs both classes to win */
.cal-title { text-align: center; font-size: 1.05rem; }
.calendar { display: grid; gap: 12px; padding: 4px 16px 0; }
.cal-tabs { display: flex; width: 100%; }
.cal-tabs .seg-btn { flex: 1 1 0; }
.cal-table { display: grid; gap: 8px; }
.cal-day { display: grid; gap: 6px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.cal-day.is-today { border-color: var(--agate); background: radial-gradient(120% 150% at 50% 100%, var(--agate-soft) 0%, color-mix(in srgb, var(--agate-soft) 0%, transparent) 100%); }
.cal-day-head { display: flex; align-items: baseline; gap: 8px; }
.cal-day-num { font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-day-name { font-weight: 500; }
.cal-day-alt { margin-inline-start: auto; color: var(--ink-2); font-size: .8rem; }
.cal-times { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.cal-t { display: grid; justify-items: center; gap: 1px; min-width: 0; }
.cal-t-name { color: var(--ink-2); font-size: .68rem; }
.cal-t-at { font-size: .78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.occ-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.occ-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.occ-row:last-child { border-bottom: 0; }
.occ-main { display: grid; gap: 2px; min-width: 0; }
.occ-name { font-weight: 600; }
.occ-when { color: var(--ink-2); font-size: .82rem; }
.occ-left { flex: none; color: var(--agate); font-weight: 600; font-size: .88rem; }

/* ---------- ورد اليوم ---------- */
.wird-card { display: grid; gap: 2px; padding: 14px 18px 16px; }
.wird-title { margin: 0 0 4px; }
.wird-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 4px 0; border: 0; background: none; color: var(--ink); text-align: start; }
.wird-mark { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); color: var(--agate-ink); }
.wird-row.is-done .wird-mark { background: var(--agate); border-color: var(--agate); }
.wird-mark .ic { width: 15px; height: 15px; }
.wird-name { font-weight: 500; }
.wird-state { margin-inline-start: auto; color: var(--ink-2); font-size: .85rem; }
.wird-card .streak-num { margin: 10px 0 10px; }
.news-list { display: grid; gap: 8px; margin: 6px 0 4px; padding-inline-start: 20px; }
.news-list li { line-height: 1.6; }

/* ---------- bars (reader, tasbih) ---------- */
.bar { position: sticky; top: 0; z-index: var(--z-bar); display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 4px; padding: calc(6px + var(--sa-top)) 8px 6px;
  background: linear-gradient(180deg, var(--bg) 0 68%, color-mix(in srgb, var(--bg) 0%, transparent) 100%); backdrop-filter: blur(10px); }
.bar-reader { grid-template-columns: 48px 1fr auto 48px; }
.bar-title { margin: 0; font: 700 1.2rem/1.3 var(--title); }
.bar-progress { padding-inline-end: 10px; color: var(--ink-2); font-size: .9rem; font-variant-numeric: tabular-nums; }
.progress { height: 3px; margin: 0 16px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; width: calc(var(--p, 0) * 100%); background: var(--agate); transition: width .3s ease; }

/* ---------- reader ---------- */
/* خالد (2026-11-22): «المفترض إن السابق والتراجع والتالي وخانة العد تبقى ثابتة تحت، واللي يتحرك المكان
   اللي فيه الذكر نفسه». كان الشريط `sticky`، فهو يثبت فقط حين تطول الصفحة: ذكرٌ قصير يرفعه إلى منتصف
   الشاشة وذكرٌ طويل ينزله، فيقفز مع كل «التالي». الآن القارئ عمودٌ بارتفاع الشاشة: الذكر وحده يُمرَّر،
   والشريط صفٌّ أخير لا يتحرّك أبدًا. */
.reader { display: grid; grid-template-rows: 1fr auto; gap: 0; padding: 0 16px;
  /* ما تبقّى بعد الشريط العلوي وشريط التقدّم وشريط الأبواب */
  height: calc(100svh - var(--reader-chrome, 150px)); min-height: 280px; }
.reader > .dhikr-card, .reader > .takhrij { grid-row: 1; }
/* the dhikr and its source scroll together inside the first row; the dock never moves */
.reader-scroll { grid-row: 1; display: grid; gap: 14px; align-content: start; padding: 16px 0 14px;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.reader-scroll::-webkit-scrollbar { display: none; }
.dhikr-card { display: grid; gap: 14px; width: 100%; padding: 22px 20px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: start; transition: transform .12s; }
.dhikr-card:active { transform: scale(.985); }
.dhikr { margin: 0; font: 400 calc(1.32rem * var(--text-scale))/var(--dhikr-lh, 2.15) var(--naskh); text-align: var(--dhikr-align, justify); text-align-last: start; overflow-wrap: anywhere; }
.run-eve { color: var(--ink-2); font-size: .82em; }
.run-eve-off { color: var(--ink-2); font-size: .82em; opacity: .75; }
.eve-note { display: grid; gap: 4px; padding: 12px 14px; border-radius: 14px; color: var(--eve-ink);
  background: linear-gradient(180deg, var(--eve-bg) 0 54%, color-mix(in srgb, var(--eve-bg) 38%, transparent) 100%); }
.eve-label { font-size: .8rem; font-weight: 600; }
.eve-text { margin: 0; font: 400 calc(1.2rem * var(--text-scale))/2 var(--naskh); }
.translit { margin: 0; color: var(--ink-2); font: italic 400 .95rem/1.6 var(--ui); text-align: left; }
.translation { margin: 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-2); font: 400 .95rem/1.6 var(--ui); text-align: left; }
/* the count and the source on one line (worklist 19, 20) */
.takhrij-count { font-weight: 600; }
.takhrij-count.is-many { color: var(--agate); }
.takhrij-sep { color: var(--line); }
/* the takhrij: a quiet footnote under the card — smaller than the dhikr, muted, two lines until «More» */
.takhrij { display: flex; flex-wrap: wrap; align-items: baseline; justify-items: start; gap: 6px; margin: 10px 4px 0; color: var(--ink-2); font: 400 calc(.82rem * var(--text-scale))/1.7 var(--ui); }
.takhrij-label { font-weight: 600; font-size: .9em; }
.takhrij-body { width: 100%; text-align: start; overflow-wrap: anywhere; }
.takhrij-p { margin: 0; display: inline; }
.takhrij:not(.open) .takhrij-body { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.takhrij.open .takhrij-p { display: block; }
.takhrij.open .takhrij-p + .takhrij-p { margin-top: .4em; }
.takhrij-more { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ink-2); text-decoration: underline; font: 600 .95em/1 var(--ui); cursor: pointer; }
.takhrij-more[hidden] { display: none; }
/* the chapter strip: one tap from any session to any other (worklist 18) */
.chapter-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 8px 16px 2px; scroll-padding-inline: 16px;
  /* the strip runs off both sides instead of being cut by a straight edge (خالد، 2026-11-21) */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%); }
.chapter-strip::-webkit-scrollbar { display: none; }
.chip-sm { min-height: 40px; padding: 4px 14px; white-space: nowrap; font-size: .92rem; }
.chip-sm.is-on { background: var(--agate); border-color: var(--agate); color: var(--agate-ink); }

/* the dock: the count under the thumb, the tools under it (worklist 21) */
.dock { grid-row: 2; display: grid; gap: 6px; padding: 8px 0 calc(10px + var(--sa-bottom));
  background: linear-gradient(transparent, var(--bg) 22%); }
.count-dock { width: 100%; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); }
.count-dock:active { background: var(--surface-2); }
.reader-foot { display: grid; justify-items: center; gap: 8px; padding: 12px 8px 14px; }
.times { margin: 0; color: var(--ink-2); font-size: .92rem; }
/* 21b — الحلقة المزدوجة: the beads and the big count became the two rings (views/countring.js); the information
   is the same, one mark per repeat, with the place in the session around it. */
.cring { position: relative; display: grid; place-items: center; width: 118px; height: 118px; }
.cr-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cr-track { fill: none; stroke: color-mix(in srgb, var(--line) 70%, transparent); stroke-width: 3; }
.cr-track-in { stroke-width: 6; }
.cr-out { fill: none; stroke: var(--agate); stroke-width: 3; stroke-linecap: round; transition: d .3s ease; }
.cr-seg, .cr-in { fill: none; stroke: color-mix(in srgb, var(--line) 80%, transparent); stroke-width: 6; stroke-linecap: round; transition: stroke .22s; }
.cr-seg.on, .cr-in { stroke: var(--amber); }
.cr-mid { display: grid; justify-items: center; gap: 2px; line-height: 1; }
.cr-num { font: 700 2.3rem/1 var(--display); font-variant-numeric: tabular-nums; }
.cr-of { color: var(--ink-2); font-size: .74rem; }
.run-step { background: color-mix(in srgb, var(--amber) 28%, transparent); border-radius: 6px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 28%, transparent); }
.step-counter { display: grid; justify-items: center; gap: 8px; }
.step-ind { margin: 0; font-size: .85rem; color: var(--ink-2); }
.hint { margin: 0; font-size: .85rem; color: var(--ink-2); }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.tool { padding: 0 10px; font-size: .95rem; }
.tasbih-notif { display: grid; margin: 0; }
.tasbih-notif .btn { gap: 8px; }
.tasbih-notif .btn[aria-pressed="true"] { border-color: var(--amber); }
.complete { display: grid; justify-items: center; gap: 10px; padding: 48px 12px; text-align: center; }
.complete-mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--agate-soft); color: var(--agate); }
.complete-mark .ic { width: 34px; height: 34px; }
.complete-title { margin: 6px 0 0; font: 700 1.5rem/1.3 var(--title); }
.complete-body { margin: 0; color: var(--ink-2); max-width: 32ch; }
.complete-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }

/* ---------- tasbih ---------- */
.tasbih { display: grid; gap: 10px; padding: 12px 16px 0; }
.field-label { margin: 6px 0 0; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 48px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.chip-ar { font: 400 1.05rem/1.6 var(--naskh); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--agate); border-color: var(--agate); color: var(--agate-ink); }
.phrases .chip { max-width: 100%; text-align: start; }
.tasbih-phrase { margin: 4px 0 0; font: 400 calc(1.4rem * var(--text-scale))/2 var(--naskh); text-align: center; }
.ring-wrap { position: relative; width: min(86vw, 340px); aspect-ratio: 1; margin: 6px auto 0; }
.ring { width: 100%; height: 100%; display: block; }
.ring-string { fill: none; stroke: var(--line); stroke-width: 1.5; }
.ring-imam { fill: var(--amber); }
.rb { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; transition: fill .15s; }
.rb.on { fill: var(--agate); stroke: var(--agate); }
.rb.last { fill: var(--amber); stroke: var(--amber); }
.ring-tap { position: absolute; inset: 11%; display: grid; place-content: center; gap: 4px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.ring-tap:active { background: var(--agate-soft); }
.ring-count { font: 700 4rem/1 var(--display); font-variant-numeric: tabular-nums; }
.ring-sub { color: var(--ink-2); font-size: .9rem; }
.tasbih-stats { display: flex; justify-content: center; gap: 8px; margin: 4px 0 0; color: var(--ink-2); }

/* ---------- settings sheet and dialogs ---------- */
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(8, 14, 18, .45); }
/* «دائمًا اللون يندمج إلى آخر خط موجود في القالب» (خالد، 2026-11-21): no block ends in a straight colour edge.
   Every surface that meets the sky fades out instead of stopping. */
.sheet { position: fixed; inset: auto 0 0 0; width: min(100%, 600px); max-width: 100%; max-height: 90svh; margin: 0 auto; padding: 0; border: 0; border-radius: 22px 22px 0 0; background: var(--bg); overflow: auto; overscroll-behavior: contain; }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 20px;
  background: linear-gradient(180deg, var(--bg) 60%, color-mix(in srgb, var(--bg) 0%, transparent) 100%); }
[dir="rtl"] .sheet-head { padding: 10px 20px 6px 12px; }
.sheet-title { margin: 0; font: 700 1.25rem/1.3 var(--title); }
.sheet-body { display: grid; gap: 18px; padding: 4px 16px calc(24px + var(--sa-bottom)); }
.group { scroll-margin-top: 72px; display: grid; gap: 2px; padding: 6px 16px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.group-title { margin: 8px 0 4px; font-size: .85rem; font-weight: 600; color: var(--agate); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.row:last-of-type { border-bottom: 0; }
.row-text { display: grid; }
.row-label { font-weight: 500; }
.row-note { font-size: .82rem; color: var(--ink-2); }
.row-value { color: var(--ink-2); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 13px; background: var(--surface-2); }
.seg-btn { min-height: 44px; min-width: 48px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); }
.seg-btn[aria-checked="true"] { background: var(--agate); color: var(--agate-ink); }
.seg-size { font: 400 calc(1rem * var(--s)) var(--naskh); padding: 0 8px; }
.seg-font { font: 400 1.05rem/1 var(--f); }
/* the size row keeps its seven steps on one line at phone width */
.row-wide .seg { display: flex; flex-wrap: nowrap; }
.row-wide .seg .seg-size { flex: 1 1 0; min-width: 0; padding: 0 2px; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; width: 100%; padding: 4px 0 8px; }
/* the four that matter: «حسب الجهاز» and Khalid's three, drawn larger so the eye lands on them first */
.themes-main { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.themes-main .swatch-chip { width: 72px; height: 46px; border-radius: 10px; font-size: 1.3rem; }
.themes-main .swatch-name { font-size: .92rem; font-weight: 500; }
.row-label-quiet { color: var(--ink-2); font-weight: 500; font-size: .92rem; }
.swatch { display: grid; gap: 6px; justify-items: center; min-height: 48px; padding: 8px 6px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.swatch[aria-checked="true"] { border-color: var(--agate); box-shadow: 0 0 0 2px var(--agate); }
.swatch-chip { display: grid; place-items: center; width: 44px; height: 30px; border-radius: 8px; background: var(--sw-bg); color: var(--sw-ink); font: 400 1.05rem/1 var(--naskh); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.swatch-chip::after { content: ""; width: 8px; height: 8px; margin-top: 2px; border-radius: 50%; background: var(--sw-acc); }
.swatch-name { font-size: .8rem; }
.row-wide { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; gap: 6px; min-height: 0; padding: 10px 0; }
.switch { position: relative; flex: none; width: 54px; height: 32px; border-radius: 16px; border: 0; background: var(--line); transition: background .2s; }
.switch .knob { position: absolute; top: 3px; inset-inline-start: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: inset-inline-start .2s; }
.switch[aria-checked="true"] { background: var(--agate); }
.switch[aria-checked="true"] .knob { inset-inline-start: 25px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.step-btn { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 1.2rem; }
.step-btn:disabled { opacity: .4; }
.step-val { min-width: 80px; text-align: center; font-variant-numeric: tabular-nums; }
.field { min-height: 48px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.btn-block { width: 100%; }
.place-btn { max-width: 100%; min-width: 0; text-align: start; }
.place-search { width: 100%; }
.place-list { display: grid; gap: 2px; }
.place-item { display: grid; justify-items: start; gap: 2px; min-height: 52px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 10px; background: none; color: var(--ink); text-align: start; }
.place-item:active { background: var(--surface-2); }
.place-main { font-weight: 500; }
.place-sub { font-size: .82rem; color: var(--ink-2); }
.note { margin: 8px 0 0; font-size: .85rem; color: var(--ink-2); }
.note-status:empty, .reliability:empty { display: none; }
.reliability { display: grid; gap: 8px; margin-top: 10px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.reliability .row-label { margin: 0; }
.rel-line { display: grid; grid-template-columns: 12px 1fr; align-items: start; gap: 8px; font-size: .88rem; color: var(--ink-2); }
.rel-line .btn-small { grid-column: 2; justify-self: start; min-height: 40px; padding: 0 12px; font-size: .88rem; }
.rel-dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; border: 2px solid var(--amber); }
.rel-line.ok .rel-dot { background: var(--agate); border-color: var(--agate); }
.group > .btn { margin-top: 10px; justify-self: start; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.help-line { margin: 6px 0; color: var(--ink-2); font-size: .92rem; }
.advanced { margin-top: 6px; }
.advanced-sum { display: flex; align-items: center; gap: 8px; min-height: 48px; cursor: pointer; list-style: none; color: var(--ink-2); font-weight: 500; }
.advanced-sum::-webkit-details-marker { display: none; }
.advanced-sum:focus-visible { outline: 2px solid var(--agate); outline-offset: 2px; border-radius: 8px; }
.advanced .tag { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--agate); font-size: .8rem; font-weight: 600; }
.chev { margin-inline-start: auto; width: 9px; height: 9px; border-inline-end: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; }
.advanced[open] .chev { transform: rotate(225deg); }
.advanced .btn-small { min-height: 44px; padding: 0 12px; font-size: .9rem; }
.place-hint { margin: 0 0 10px; }
.place-card { gap: 10px; background: var(--surface-2); }
.place-card-text { margin: 0; color: var(--ink-2); font-size: .95rem; }
.place-card .btn-row { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
.about-source { padding: 10px 0; border-bottom: 1px solid var(--line); }
.about-source .row-label { margin: 0; }
.rights { margin: 14px 0 4px; font-size: .8rem; color: var(--ink-2); }
.dialog { width: min(92vw, 420px); padding: 22px; border: 0; border-radius: 22px; background: var(--surface); }
.dlg-title { margin: 0 0 8px; font: 700 1.2rem/1.4 var(--title); }
.dlg-body { margin: 0 0 14px; color: var(--ink-2); }
.dialog .field { width: 100%; margin-bottom: 14px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* الإعدادات: غرف لا ورقة طويلة */
.rooms { display: grid; gap: 2px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.room { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-align: start; }
.room:last-child { border-bottom: 0; }
.room:active { background: var(--surface-2); }
.room-ic { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--agate-soft); color: var(--agate); }
.room-ic .ic { width: 20px; height: 20px; }
.room-text { display: grid; gap: 1px; min-width: 0; }
.room-name { font-weight: 600; }
.room-note { color: var(--ink-2); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-chev { flex: none; margin-inline-start: auto; width: 8px; height: 8px; border-inline-end: 2px solid var(--ink-2); border-top: 2px solid var(--ink-2); transform: rotate(45deg); }
[dir="rtl"] .room-chev { transform: rotate(-135deg); }

/* حساب الزكاة */
#view[data-route="zakat"] { padding-bottom: calc(32px + var(--sa-bottom)); }
.zakat { display: grid; gap: 12px; padding: 4px 16px 0; }
.zak-input { width: 100%; font-variant-numeric: tabular-nums; }
.zak-out { display: grid; gap: 6px; }
.zak-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.zak-due { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.zak-amount { font: 700 1.6rem/1 var(--display); color: var(--agate); font-variant-numeric: tabular-nums; }

/* «تنبيهاتي» */
.rem-card { display: grid; gap: 6px; }
.rem-text { flex: 1 1 auto; min-width: 0; }
.rem-days { display: flex; gap: 4px; padding: 6px 0 2px; }  /* seven days on one line at phone width */
.chip-day { flex: 1 1 0; min-width: 40px; min-height: 44px; padding: 0 2px; justify-content: center; }
.chip-day.is-on { background: var(--agate); border-color: var(--agate); color: var(--agate-ink); }
.rem-card .btn-small { justify-self: start; min-height: 40px; padding: 0 12px; }

/* ---------- toast: one live region, above every layer ---------- */
.rights-link { color: var(--agate); text-decoration: underline; text-underline-offset: 3px; }

/* الثلث الأخير حين يبدأ: السطر نفسه يقولها، بعد أن حُذف كرت «الآن» من صفحة الصلاة (خالد، 2026-11-22) */
.night-row.is-now .row-label, .night-row.is-now .time-at { color: var(--agate); font-weight: 600; }

/* «الليلة»: الطريق الظاهر للرجوع بعد أن يمشي الشهر تحت الإصبع (خالد، 2026-11-22) */
.moon-home-chip { min-height: 34px; padding: 0 12px; margin-inline-start: auto; font-size: .82rem;
  color: var(--agate); border-color: color-mix(in srgb, var(--agate) 45%, transparent); }
.moon-home-chip[hidden] { display: none; }

/* ---------- شريط النسخة المرفوعة (2026-11-22) ----------
   يجلس فوق كل شيء في أعلى الصفحة، صلبًا لا زجاجيًّا (فوقه سماء، ونصُّه يجب أن يُقرأ)، ويُزاح بنفسه عند الإغلاق. */
.webhint { position: sticky; top: 0; z-index: var(--z-bar); display: grid; gap: 8px;
  padding-block: calc(10px + var(--sa-top)) 10px; background: var(--surface-2); color: var(--ink);
  border-bottom: 1px solid var(--line); box-shadow: 0 8px 24px -20px #000;
  /* the ✕ sits at the inline END; the room for it must be reserved on the SAME side, or it lands on a button
     (it did, in RTL: physical `padding-right` with a logical `inset-inline-end` — seen on screen, 2026-11-22) */
  padding-inline: 14px 46px; }
.wh-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wh-text { flex: 1 1 14ch; font-size: .9rem; line-height: 1.6; }
.wh-glyph { display: inline-flex; vertical-align: -4px; margin: 0 4px; }
.wh-glyph svg { width: 18px; height: 18px; }
.wh-act { min-height: 40px; padding: 0 14px; white-space: nowrap; }
.wh-close { position: absolute; inset-block-start: calc(8px + var(--sa-top)); inset-inline-end: 8px;
  width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: none; color: var(--ink-2); }

/* ---------- الختمة (2026-11-22) ----------
   «من أين أقرأ اليوم» — سطرٌ واحد كبير هو كل الشاشة، والباقي تحته. لا مصحف هنا ولا نصّ. */
.khatmah { display: grid; gap: 12px; padding: 12px 16px calc(24px + var(--sa-bottom)); }
.kh-card .card-sub { margin-top: 2px; }
.kh-start .card-sub { margin-bottom: 4px; }
.kh-periods { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.kh-pace { margin: 2px 0 10px; color: var(--ink-2); font-size: .9rem; }
.kh-go { width: 100%; }
.kh-today .k { color: var(--agate); font-size: .85rem; font-weight: 600; }
.kh-from { margin: 6px 0 0; font: 700 1.35rem/1.45 var(--ui); }
.kh-to { margin: 2px 0 0; font: 500 1.05rem/1.5 var(--ui); color: var(--ink); }
.kh-today .card-sub { margin: 6px 0 12px; }
.kh-done-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.kh-done-row .kh-tick { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--agate); color: var(--agate-ink); }
.kh-undo { margin-inline-start: auto; min-height: 40px; padding: 0 14px; }
.kh-big { margin: 6px 0 8px; font: 700 1.5rem/1 var(--ui); font-variant-numeric: tabular-nums; }
.kh-bar { height: 8px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.kh-fill { display: block; height: 100%; width: calc(var(--p, 0) * 100%); border-radius: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--agate) 55%, transparent), var(--agate)); }
.kh-head .card-sub { margin-top: 6px; }
.kh-note .card-sub { margin: 0 0 6px; }
.kh-end { width: 100%; margin-top: 6px; }

.toast { position: fixed; inset: auto 16px calc(20px + var(--sa-bottom)) 16px; z-index: var(--z-toast); width: auto; max-width: 560px; margin: 0 auto; padding: 12px 16px; border: 0; border-radius: 14px; background: var(--ink); color: var(--bg); text-align: center; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--danger); color: #fff; }
.toast:popover-open { display: block; }

/* ---------- movement (0.4, 2026-11-20) ----------
   One curve for arrivals — cubic-bezier(.23,1,.32,1) — and transform/opacity only, so nothing leaves the compositor.
   The vocabulary and its values: brain/research/adhkar-ui-and-launch-study-2026-11.md § 7. Three ways out: the
   phone's «less motion», a weak device (html[data-motion="lite"], set in main.js), and nothing at all on first paint
   of a cold start, so the app never looks slow to open. */
#view.v-stagger > *:not(.home), #view.v-stagger > .home > * { animation: v-rise .42s cubic-bezier(.23, 1, .32, 1) both; }
#view.v-fade > *:not(.home), #view.v-fade > .home > * { animation: v-fade .2s cubic-bezier(.23, 1, .32, 1) both; }
/* 38 ms between blocks, eight at most: after that the page is already scrolled past */
#view.v-stagger > :nth-child(2), #view.v-stagger > .home > :nth-child(2) { animation-delay: 38ms; }
#view.v-stagger > :nth-child(3), #view.v-stagger > .home > :nth-child(3) { animation-delay: 76ms; }
#view.v-stagger > :nth-child(4), #view.v-stagger > .home > :nth-child(4) { animation-delay: 114ms; }
#view.v-stagger > :nth-child(5), #view.v-stagger > .home > :nth-child(5) { animation-delay: 152ms; }
#view.v-stagger > :nth-child(6), #view.v-stagger > .home > :nth-child(6) { animation-delay: 190ms; }
#view.v-stagger > :nth-child(7), #view.v-stagger > .home > :nth-child(7) { animation-delay: 228ms; }
#view.v-stagger > :nth-child(n+8), #view.v-stagger > .home > :nth-child(n+8) { animation-delay: 266ms; }
@keyframes v-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes v-fade { from { opacity: 0; transform: translateY(4px); } }

/* the reader moves sideways: the next dhikr comes from the leading edge, the previous from the trailing one.
   Logical properties are not animatable, so the sign is set in JS (--slide) and RTL/LTR each get their own. */
/* the dock stays put: only what changes slides (2026-11-22) */
.reader.slide .dhikr-card, .reader.slide .takhrij { animation: v-slide .28s cubic-bezier(.23, 1, .32, 1) both; }
@keyframes v-slide { from { opacity: 0; transform: translateX(calc(var(--slide, 1) * 26px)); } }

/* one tap, one bead: the bead that just filled settles instead of blinking on */
.bead.on { animation: bead-pop .22s cubic-bezier(.23, 1, .32, 1); }
@keyframes bead-pop { from { transform: scale(.72); } 60% { transform: scale(1.14); } }

/* the session is finished: the tick draws itself once, quietly — no confetti in a dhikr app */
.complete-mark { animation: v-rise .34s cubic-bezier(.23, 1, .32, 1) both; }
.complete-mark .ic path { stroke-dasharray: 28; stroke-dashoffset: 28; animation: tick-draw .5s cubic-bezier(.23, 1, .32, 1) .16s both; }
@keyframes tick-draw { to { stroke-dashoffset: 0; } }

/* Sheets and dialogs arrive the way the phone's own do. Written as animations on [open] rather than transitions with
   @starting-style: a transition parks the resting state in the *base* rule (translateY(100%)), so on a WebView that
   does not run it the settings sheet sits off screen — a blank screen, not a missing animation. With an animation the
   resting state is the natural one and only the entrance is borrowed, so the worst case is no movement. */
dialog.sheet[open] { animation: sheet-in .34s cubic-bezier(.32, .72, 0, 1) both; }
@keyframes sheet-in { from { transform: translateY(100%); } }
dialog.dialog[open] { animation: dlg-in .2s cubic-bezier(.23, 1, .32, 1) both; }
@keyframes dlg-in { from { opacity: 0; transform: scale(.96); } }
dialog[open]::backdrop { animation: v-fadein .26s cubic-bezier(.23, 1, .32, 1) both; }
@keyframes v-fadein { from { opacity: 0; } }

/* a weak phone keeps the meaning (sheets, the reader's direction) and drops the decoration */
html[data-motion="lite"] #view.v-stagger > *, html[data-motion="lite"] #view.v-stagger > .home > *,
html[data-motion="lite"] #view.v-fade > *, html[data-motion="lite"] #view.v-fade > .home > *,
html[data-motion="lite"] .reader.slide .dhikr-card, html[data-motion="lite"] .bead.on, html[data-motion="lite"] .complete-mark,
html[data-motion="lite"] .complete-mark .ic path { animation: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .icon-btn:active, .btn:active, .dhikr-card:active { transform: none; }
  .complete-mark .ic path { stroke-dashoffset: 0; }
  dialog.sheet[open], dialog.dialog[open], dialog[open]::backdrop { transform: none; opacity: 1; }
}
