/* Sakīna – calm, mobile-first design system. Logical properties → automatic RTL. No external resources. */

@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("../fonts/noto-naskh-arabic.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

/* Semantic theme tokens. Rule: a component that sets a background also takes the text colour of the SAME pair –
   surface* ↔ text-primary/secondary/muted, surface-accent ↔ text-on-accent(-muted), accent ↔ on-accent, gold ↔ text-on-gold.
   Light and dark define every token; tests/unit/contrast_test.php checks all pairs against WCAG AA (4.5:1). */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-subtle: #eeebe3;
  --surface-accent: #1d6a57;       /* hero cards: background … */
  --surface-accent-2: #134a3c;     /* … gradient end */
  --text-primary: #1c2420;
  --text-secondary: #39443e;
  --text-muted: #56615a;
  --text-on-accent: #ffffff;        /* text on surface-accent */
  --text-on-accent-muted: #d9ece4;
  --border: #dcd7cb;
  --border-strong: #b3ab9b;
  --accent: #1d6a57;               /* links, primary buttons, focus */
  --accent-hover: #175545;
  --on-accent: #ffffff;            /* text on accent (buttons, chips) */
  --accent-soft: #e0eee8;
  --gold: #a9853a;
  --text-on-gold: #1c1406;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #7f5300;
  --warn-soft: #fbf0d9;
  --info-soft: #e6eef6;
  --info: #2c5282;
  /* aliases of the pre-1.5 names (kept so older rules keep working – same pairs) */
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --surface-2: var(--surface-subtle);
  --accent-contrast: var(--on-accent);
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Naskh Arabic", "Geeza Pro", sans-serif;
  --font-ar: "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", "Arabic Typesetting", "Traditional Arabic", serif;
  --tap: 48px;
  --header-h: 56px;
  --nav-h: 64px;
  color-scheme: light;
}

/* dark: the same token set (explicit choice, or "auto" + system dark mode) */
:root[data-theme="dark"] {
  --bg: #0e1412; --surface: #151d1a; --surface-raised: #1a2420; --surface-subtle: #1f2a26;
  --surface-accent: #1f5446; --surface-accent-2: #143a30;
  --text-primary: #e7ece9; --text-secondary: #c5cfca; --text-muted: #a3afa9; --text-on-accent: #eef7f3; --text-on-accent-muted: #c9e0d7;
  --border: #2a3631; --border-strong: #46554e;
  --accent: #58b99a; --accent-hover: #6fcbad; --on-accent: #05130e; --accent-soft: #173229; --gold: #d3b26c; --text-on-gold: #1c1406;
  --danger: #f2877e; --danger-soft: #3a1d1b; --warn: #e8bd62; --warn-soft: #33281a; --info-soft: #1a2635; --info: #9cc2ec;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0e1412; --surface: #151d1a; --surface-raised: #1a2420; --surface-subtle: #1f2a26;
    --surface-accent: #1f5446; --surface-accent-2: #143a30;
    --text-primary: #e7ece9; --text-secondary: #c5cfca; --text-muted: #a3afa9; --text-on-accent: #eef7f3; --text-on-accent-muted: #c9e0d7;
    --border: #2a3631; --border-strong: #46554e;
    --accent: #58b99a; --accent-hover: #6fcbad; --on-accent: #05130e; --accent-soft: #173229; --gold: #d3b26c; --text-on-gold: #1c1406;
    --danger: #f2877e; --danger-soft: #3a1d1b; --warn: #e8bd62; --warn-soft: #33281a; --info-soft: #1a2635; --info: #9cc2ec;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
/* The HTML hidden attribute must always win over component display rules (.btn, .resume-box, .start-overlay, .field …).
   Without this, "hidden" elements stayed visible – e.g. the empty green resume button in the player (v1.0.0 bug). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh;
}
:lang(ar), .ar { font-family: var(--font-ar); }
html[dir="rtl"] body { font-size: 17px; line-height: 1.7; }
.ar { font-size: 1.12em; line-height: 1.8; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-weight: 650; letter-spacing: -.01em; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 { letter-spacing: 0; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
.small { font-size: .875rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.25em; height: 1.25em; fill: currentColor; vertical-align: -.2em; flex: none; }
html[dir="rtl"] .icon-back { transform: scaleX(-1); }
/* moved off-screen vertically (not sideways – a negative inline offset creates horizontal scroll in RTL) */
.skip { position: absolute; inset-inline-start: 8px; top: -200px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { top: 8px; }

/* ---- layout ------------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 30; height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.topnav { display: none; gap: 2px; margin-inline-start: 12px; }
.topnav a { padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 550; }
.topnav a[aria-current="page"], .topnav a:hover { background: var(--surface-2); color: var(--text); }
.topbar .spacer { flex: 1; }
.iconbtn {
  display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px; border: 0;
  background: transparent; color: var(--text); cursor: pointer; font: inherit; text-decoration: none;
}
.iconbtn:hover { background: var(--surface-2); }
.langswitch { display: flex; gap: 2px; }
.langswitch a { font-size: .8rem; padding: 6px 7px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; }
.langswitch a[aria-current="true"] { color: var(--accent); background: var(--accent-soft); }

main.container { max-width: 1120px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.bare main.container { padding-bottom: 32px; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.tabbar a .icon { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  main.container { padding-bottom: 48px; }
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
/* min(…, 100%) so a grid column never exceeds its container on 320 px screens (also inside padded cards) */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.section { margin-top: 26px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.section-title h2 { margin: 0; }

/* ---- cards & lists ------------------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
/* Hero cards sit on surface-accent; everything inside takes the on-accent text pair. Nested boxes (why-body, kbd) set
   their own background AND text colour – they never inherit the white/dark hero text onto a light/dark surface. */
.card.hero { background: linear-gradient(135deg, var(--surface-accent) 0%, var(--surface-accent-2) 100%); color: var(--text-on-accent); border: 0; }
.card.hero a:not(.btn), .card.hero .muted { color: var(--text-on-accent-muted); }
.card.hero .kbd { background: color-mix(in srgb, var(--text-on-accent) 16%, transparent); color: var(--text-on-accent); }
.card.hero details.why summary { color: var(--text-on-accent); text-decoration: underline; text-underline-offset: 3px; }
.card.hero .why-body { background: var(--surface); color: var(--text-primary); }
.card h3 { margin-bottom: 4px; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card-link:hover { border-color: var(--accent); }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
/* Rows wrap: the text column keeps at least ~11rem; action groups that don't fit move below instead of squeezing the text. */
.list > li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); min-height: 60px; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1 1 11rem; min-width: 0; overflow-wrap: anywhere; }
.list .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list .sub { color: var(--muted); font-size: .86rem; }
.list .num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---- buttons & forms ------------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-contrast); }
.card.hero .btn-primary { background: var(--accent-contrast); color: var(--accent); border-color: var(--accent-contrast); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-lg { min-height: 58px; font-size: 1.08rem; padding: 12px 24px; border-radius: 14px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
form.inline { display: inline; }

.field { display: block; margin-bottom: 14px; }
.field > span, .label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.hint { color: var(--muted); font-size: .84rem; margin-top: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="time"],
input[type="url"], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; /* 16px avoids iOS zoom */
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: center; min-height: 40px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
select { text-overflow: ellipsis; }
fieldset { min-width: 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px 4px; margin: 0 0 16px; }
legend { font-weight: 650; padding: 0 6px; }

/* chips (multi/single choice) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; user-select: none;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- badges ------------------------------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; letter-spacing: .01em; }
.badge-AUTHENTIC_TIME_BOUND { background: var(--accent-soft); color: var(--accent); }
.badge-GENERALLY_RECOMMENDED { background: var(--info-soft); color: var(--info); }
.badge-PERSONAL_CHOICE { background: var(--surface-2); color: var(--muted); }
.badge-WEAK_OR_DISPUTED { background: var(--warn-soft); color: var(--warn); }
.badge-NOT_ESTABLISHED { background: var(--danger-soft); color: var(--danger); }
.badge-demo { background: var(--warn-soft); color: var(--warn); }
.badge-required { background: var(--gold); color: var(--text-on-gold); }

/* ---- flash ------------------------------------------------------------------------------------- */
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface); }
.flash-success { border-color: var(--accent); background: var(--accent-soft); }
.flash-error { border-color: var(--danger); background: var(--danger-soft); }
.flash-warning { border-color: var(--warn); background: var(--warn-soft); }
.flash-info { border-color: var(--info); background: var(--info-soft); }

/* ---- tables ------------------------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }

/* ---- auth pages --------------------------------------------------------------------------------- */
.auth-wrap { min-height: calc(100dvh - 120px); display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand-big { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; text-align: center; }
.auth-card .brand-big img { width: 64px; height: 64px; border-radius: 16px; }
.auth-card .brand-big .ar { font-size: 1.4rem; color: var(--gold); }

/* ---- dashboard -------------------------------------------------------------------------------- */
.quick { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick a { display: flex; flex-direction: column; gap: 8px; padding: 16px; min-height: 104px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 650; box-shadow: var(--shadow); }
.quick a .icon { width: 28px; height: 28px; color: var(--accent); }
.quick a:hover { border-color: var(--accent); }
.resume { display: flex; align-items: center; gap: 12px; }
.resume .grow { flex: 1; min-width: 0; }
.copyline { display: flex; gap: 8px; align-items: stretch; min-width: 0; }
.copyline input { flex: 1 1 auto; min-width: 0; }
.copyline .btn { flex: none; }
.copyline input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; direction: ltr; text-align: left; }

/* ---- player ------------------------------------------------------------------------------------- */
.player { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.player-head { text-align: center; }
.player-head .pl-title { color: var(--muted); font-weight: 600; font-size: .92rem; }
.now { text-align: center; padding: 8px 4px; }
.now .t { font-size: 1.45rem; font-weight: 700; line-height: 1.3; margin: 0; }
.now .t-ar { font-family: var(--font-ar); font-size: 1.6rem; color: var(--gold); margin: 6px 0 0; line-height: 1.6; }
.now .who { color: var(--muted); margin-top: 4px; }
.now .pos { color: var(--muted); font-size: .88rem; margin-top: 6px; font-variant-numeric: tabular-nums; }
.seek { width: 100%; }
/* the media timeline is not mirrored in RTL (same as the time labels and the controls) */
.seek input[type="range"] { width: 100%; height: 36px; accent-color: var(--accent); background: transparent; direction: ltr; }
.times { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; direction: ltr; }
.controls { display: flex; align-items: center; justify-content: center; gap: 22px; direction: ltr; /* media controls are not mirrored in RTL */ }
.ctl { display: grid; place-items: center; border: 0; cursor: pointer; border-radius: 50%; background: var(--surface-2); color: var(--text); -webkit-tap-highlight-color: transparent; }
.ctl:active { transform: scale(.96); }
.ctl .icon { width: 34px; height: 34px; }
.ctl-sm { width: 72px; height: 72px; }
.ctl-main { width: 96px; height: 96px; background: var(--accent); color: var(--accent-contrast); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent); }
.ctl-main .icon { width: 46px; height: 46px; }
.secondary { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.secondary .btn { min-height: 44px; }
.secondary .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.plprogress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.plprogress > div { height: 100%; width: 0; background: var(--gold); transition: width .4s; }
.plmeta { display: flex; justify-content: space-between; color: var(--muted); font-size: .86rem; font-variant-numeric: tabular-nums; }
/* Queue rows (v1.5): the former one-line flex row put number, title, a non-wrapping badge and the duration side by side –
   on phones the title column collapsed to a few pixels and broke letter by letter. Now a grid: number | title+reciter |
   duration, with reasons/notes in their own wrapping line below. From 700 px the badge gets its own column again. */
.queue .current { background: var(--accent-soft); }
.queue .current .q-title { color: var(--text-primary); }
.queue button.qitem {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; align-items: start;
  grid-template-columns: 1.75rem minmax(0, 1fr) auto; grid-template-areas: "idx main dur" ". meta meta"; column-gap: 10px; row-gap: 6px;
}
.queue button.qitem:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.queue .idx { grid-area: idx; text-align: center; color: var(--text-muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.queue .q-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow-wrap: break-word; }
.queue .q-title { font-weight: 600; color: var(--text-primary); line-height: 1.35; }
.queue .q-sub { color: var(--text-muted); font-size: .86rem; line-height: 1.35; }
.queue .num { grid-area: dur; padding-top: 1px; }
.queue .q-meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-width: 0; }
.queue .q-meta .badge { white-space: normal; max-width: 100%; line-height: 1.3; }
.queue .q-note { color: var(--text-secondary); font-size: .8rem; }
.queue li.missing .q-title { font-style: italic; }   /* no opacity: dimmed text would fall below WCAG AA; the note "file missing" says it */
@media (min-width: 700px) {
  .queue button.qitem { grid-template-columns: 2rem minmax(0, 1fr) auto auto; grid-template-areas: "idx main meta dur"; align-items: center; }
  .queue .q-meta { justify-content: flex-end; max-width: 16rem; }
}
.start-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 24px;
}
.start-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 22px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; text-align: center; }
.start-card h2 { margin: 0; font-size: 1.35rem; }
.start-kicker { margin: 0; color: var(--accent); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.start-why { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.btn-xl { min-height: 72px; font-size: 1.25rem; border-radius: 18px; padding: 14px 22px; margin-top: 6px; }
.btn-xl .icon { width: 30px; height: 30px; }
body.drive .start-card { background: #0c1714; border-color: #1f2d28; color: #eef3f0; }
.start-btn { display: flex; flex-direction: column; align-items: center; gap: 14px; border: 0; background: none; color: var(--text); cursor: pointer; font: inherit; }
.start-btn .circle { width: 160px; height: 160px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); display: grid; place-items: center;
  box-shadow: 0 10px 40px color-mix(in srgb, var(--accent) 45%, transparent); }
.start-btn .circle .icon { width: 72px; height: 72px; margin-inline-start: 8px; }
.start-btn strong { font-size: 1.5rem; }
.resume-box { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }

/* Driving mode: huge targets, nothing else. Dark by default for night driving. */
body.drive { background: #07100d; color: #eef3f0; }
body.drive .topbar, body.drive .tabbar, body.drive .no-drive { display: none !important; }
body.drive main.container { padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); max-width: none; }
body.drive .player { max-width: none; min-height: calc(100dvh - 40px); justify-content: space-between; gap: 12px; }
body.drive .now .t { font-size: clamp(1.6rem, 6vw, 2.6rem); color: #fff; }
body.drive .now .t-ar { font-size: clamp(1.7rem, 6.5vw, 2.8rem); color: #e2c98b; }
body.drive .now .who, body.drive .now .pos, body.drive .times, body.drive .plmeta { color: #a8b8b0; font-size: 1.05rem; }
/* sizes scale with the viewport so prev/play/next always fit side by side (320 px: 77 + 104 + 77 + gaps ≤ 288) */
body.drive .controls { gap: clamp(10px, 3vw, 40px); }
body.drive .ctl { background: #16231e; color: #fff; }
body.drive .ctl-sm { width: clamp(72px, 24vw, 150px); height: clamp(72px, 24vw, 150px); }
body.drive .ctl-sm .icon { width: clamp(36px, 11vw, 50px); height: clamp(36px, 11vw, 50px); }
body.drive .ctl-main { width: clamp(104px, 32vw, 210px); height: clamp(104px, 32vw, 210px); background: #58b99a; color: #05130e; }
body.drive .ctl-main .icon { width: clamp(52px, 17vw, 80px); height: clamp(52px, 17vw, 80px); }
body.drive .drive-exit { display: inline-flex !important; }
body.drive .remaining-big { display: block !important; font-size: 1.3rem; text-align: center; color: #cfdcd5; font-variant-numeric: tabular-nums; }
.drive-exit, .remaining-big { display: none !important; }
body.drive .drive-exit { align-self: center; background: transparent; color: #a8b8b0; border-color: #2a3631; }
@media (orientation: landscape) and (max-height: 520px) {
  body.drive .player { display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: calc(100dvh - 32px); }
  body.drive .now { grid-column: 1; }
  body.drive .controls { grid-column: 2; grid-row: 1 / span 3; }
}

/* ---- why / explanation --------------------------------------------------------------------------- */
details.why { margin-top: 6px; }
details.why summary { cursor: pointer; color: var(--accent); font-size: .86rem; font-weight: 600; list-style: none; min-height: 32px; display: inline-flex; align-items: center; gap: 4px; }
details.why summary::-webkit-details-marker { display: none; }
.why-body { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: .9rem; }
.why-body ul { margin: 6px 0 0; padding-inline-start: 18px; }
.why-body .caution { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--text); }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.reasons span { font-size: .74rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }

/* ---- builder ---------------------------------------------------------------------------------- */
.builder { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 960px) { .builder { grid-template-columns: 1fr 1fr; align-items: start; } .builder .sticky { position: sticky; top: calc(var(--header-h) + 12px); } }
.totalbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-variant-numeric: tabular-nums; font-weight: 650; }
.totalbar.over { background: var(--warn-soft); }
.totalbar.good { background: var(--accent-soft); }
.items li { touch-action: pan-y; }
.items li.dragging { opacity: .6; background: var(--accent-soft); }
.items li.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.handle { cursor: grab; color: var(--muted); padding: 8px 4px; touch-action: none; min-width: 32px; min-height: 44px; display: grid; place-items: center; }
.item-actions { display: flex; gap: 2px; }
.item-actions .iconbtn { min-width: 40px; }
.filters { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 10px; }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 12px; }
.pager a, .pager button { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; }

/* ---- wizard ------------------------------------------------------------------------------------ */
.wizard .step { display: none; }
.wizard .step.active { display: block; }
.steps-dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0 18px; }
.steps-dots span { width: 28px; height: 5px; border-radius: 999px; background: var(--border); }
.steps-dots span.on { background: var(--accent); }
.wizard .nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
.duration-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.result-item { align-items: flex-start !important; }
.result-item .grow { padding-top: 2px; }

/* ---- misc ---------------------------------------------------------------------------------------- */
.kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: embed; }
.ltr { direction: ltr; unicode-bidi: embed; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.toast { position: fixed; inset-inline: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 70; margin: 0 auto; max-width: 420px;
  background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); text-align: center; }
.stat { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.upload-drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px 16px; text-align: center; background: var(--surface); }
.upload-drop.hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-list .bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.upload-list .bar > div { height: 100%; width: 0; background: var(--accent); }
/* utilities (CSP forbids inline style attributes) */
.m-0 { margin: 0 !important; }
.mt-4 { margin-top: 4px !important; }
.mt-6 { margin-top: 6px !important; }
.mt-8 { margin-top: 8px !important; }
.mt-10 { margin-top: 10px !important; }
.mt-12 { margin-top: 12px !important; }
.mt-16 { margin-top: 16px !important; }
.mb-4 { margin-bottom: 4px !important; }
.mb-6 { margin-bottom: 6px !important; }
.mw-220 { max-width: 220px; }
.mw-260 { max-width: 260px; }
.text-center { text-align: center; }
.btn-outline-light { background: transparent; color: inherit; border-color: currentColor; }
.card.hero .btn-outline-light:hover { color: inherit; border-color: currentColor; background: rgba(255, 255, 255, .08); }
.flash.inline-warning { margin: 10px 0 0; }
/* ---- v1.3: sharing, impact, setup, diagnostics ----------------------------------------------------- */
.player-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sheet-overlay { position: fixed; inset: 0; z-index: 65; display: grid; place-items: end center; background: color-mix(in srgb, #000 35%, transparent); }
.sheet { width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto; background: var(--surface); color: var(--text);
  border-radius: 20px 20px 0 0; padding: 18px max(16px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); box-shadow: var(--shadow); }
@media (min-width: 640px) { .sheet-overlay { place-items: center; padding: 24px; } .sheet { border-radius: 20px; padding-bottom: 20px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.qrbox { display: grid; place-items: center; }
.qrbox svg { width: min(240px, 70vw); height: auto; background: #fff; padding: 10px; border-radius: 12px; }
.impact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
@media (min-width: 700px) { .impact-grid.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.impact-hero { background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); }
.impact-line { margin: 12px 0 0; }
.impact-card .impact-mini { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--muted); }
.impact-mini strong { color: var(--text); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.country-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.country-list li { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: .88rem; }
.period-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.period-chips a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; }
.period-chips a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.tree { list-style: none; margin: 0; padding: 0; }
.tree li { padding: 8px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.tree .d1 { padding-inline-start: 16px; } .tree .d2 { padding-inline-start: 32px; } .tree .d3 { padding-inline-start: 48px; }
.tree .d4 { padding-inline-start: 64px; } .tree .d5 { padding-inline-start: 80px; } .tree .d6 { padding-inline-start: 96px; }
.setup-step + .setup-step { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.setup-form.js .setup-step { display: none; margin: 0; padding: 0; border: 0; }
.setup-form.js .setup-step.active { display: block; }
.setup-form:not(.js) [data-setup-dots] { display: none; }
.setup-nav { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.setup-nav [data-setup-done] { margin-inline-start: auto; }
.choice-cards { display: grid; gap: 10px; }
.choice-card { position: relative; display: block; cursor: pointer; }
.choice-card input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice-card .cc { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.choice-card input:checked + .cc { border-color: var(--accent); background: var(--accent-soft); }
.choice-card input:focus-visible + .cc { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice-card .cc .ar { font-size: 1.3rem; line-height: 1.6; }
.place-results { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.place-results:empty { display: none; }
.place-results button { all: unset; display: block; width: 100%; box-sizing: border-box; padding: 12px 14px; min-height: 44px; cursor: pointer; border-bottom: 1px solid var(--border); }
.place-results li:last-child button { border-bottom: 0; }
.place-results button:hover, .place-results button:focus-visible { background: var(--accent-soft); }
.place-chosen { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-weight: 600; overflow-wrap: anywhere; }
.diag { position: fixed; inset-inline: 8px; bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom)); z-index: 70; max-height: 45dvh; overflow: auto;
  background: #0b1512; color: #cfe9dd; border-radius: 12px; padding: 10px; font-size: 12px; direction: ltr; text-align: left; }
.diag pre { margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Menlo, Consolas, monospace; }
body.drive .diag { bottom: 8px; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4em; }
.pre-line { white-space: pre-line; }

/* ---- language menu (11+ languages: one compact button instead of a row of codes) ---------------------- */
.langmenu { position: relative; }
.langmenu > summary { list-style: none; cursor: pointer; font-weight: 700; font-size: .82rem; color: var(--muted); }
.langmenu > summary::-webkit-details-marker { display: none; }
.langmenu[open] > summary { color: var(--accent); background: var(--accent-soft); }
.langmenu-list { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 40; min-width: 13rem; max-height: min(70dvh, 30rem);
  overflow: auto; display: flex; flex-direction: column; padding: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); }
.langmenu-list a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--text); }
.langmenu-list a:hover { background: var(--surface-2); }
.langmenu-list a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.langmenu-list a[lang="ur"] { font-family: var(--font-urdu); line-height: 1.9; }
.langmenu-list a[lang="bn"] { font-family: var(--font-beng); }
.langmenu-list a[lang="hi"] { font-family: var(--font-deva); }

/* ---- scripts & languages: system fonts per script (nothing is forced that could miss glyphs), bundled Naskh as the
        guaranteed Arabic-script fallback, taller lines for scripts with tall marks (Nastaliq, Bengali, Devanagari) ---- */
:root {
  --font-urdu: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", "Noto Naskh Arabic", "Geeza Pro", serif;
  --font-beng: "Noto Sans Bengali", "Kohinoor Bangla", "Bangla Sangam MN", "Nirmala UI", "Vrinda", system-ui, sans-serif;
  --font-deva: "Noto Sans Devanagari", "Kohinoor Devanagari", "Devanagari Sangam MN", "Nirmala UI", "Mangal", system-ui, sans-serif;
}
html[lang="ur"] body { font-family: var(--font-urdu); font-size: 17px; line-height: 2.05; }
html[lang="ur"] h1, html[lang="ur"] h2, html[lang="ur"] h3 { line-height: 1.9; }
html[lang="ur"] .tabbar a { font-size: .76rem; line-height: 1.7; }
html[lang="ur"] .ar, html[lang="ur"] [lang="ar"] { font-family: var(--font-ar); line-height: 1.8; }   /* Arabic content stays Naskh */
html[lang="fa"] body { font-family: var(--font-ar); }
html[lang="bn"] body { font-family: var(--font-beng); font-size: 17px; line-height: 1.75; }
html[lang="hi"] body { font-family: var(--font-deva); font-size: 17px; line-height: 1.75; }
html[lang="bn"] h1, html[lang="bn"] h2, html[lang="bn"] h3, html[lang="hi"] h1, html[lang="hi"] h2, html[lang="hi"] h3 { line-height: 1.45; letter-spacing: 0; }
html[lang="bn"] .ar, html[lang="hi"] .ar { font-family: var(--font-ar); }
.kbd, .ltr, code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---- responsive layer (mobile-first; one place instead of per-page fixes) ------------------------ */
main.container { overflow-wrap: break-word; }
.kbd { overflow-wrap: anywhere; }
.row > * { min-width: 0; }
/* Touch devices: every control at least 44 px high/wide (Apple HIG / WCAG 2.5.5). */
@media (pointer: coarse) {
  .btn-sm { min-height: 44px; }
  .iconbtn { min-width: 44px; height: 44px; }
  .langswitch a { display: inline-grid; place-items: center; min-width: 36px; min-height: 40px; }
  details.why summary { min-height: 44px; }
}
/* Small phones (≤ 380 px: iPhone SE/mini, 360 Android). */
@media (max-width: 380px) {
  main.container { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .card { padding: 14px 12px; }
  .list > li { padding: 10px 12px; }
  h1 { font-size: 1.35rem; }
  .topbar { gap: 4px; }
  .brand span { font-size: .98rem; }
  .langswitch a { padding: 6px 5px; min-width: 32px; }
  .controls { gap: 14px; }
  .ctl-sm { width: 64px; height: 64px; }
  .ctl-main { width: 86px; height: 86px; }
  .btn-lg { padding-inline: 18px; }
  .start-overlay { padding: 16px; }
  .quick a { padding: 14px 12px; min-height: 96px; }
}
/* 320 px: logo only (brand text + 3 language links + 2 icon buttons would not fit with 44 px targets) */
@media (max-width: 340px) { .brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .topbar, .tabbar { display: none; } }

/* ---- v1.5: semantic pairs for accent surfaces, routine card, plan, link cards ------------------------------------ */
.btn-on-accent, .card.hero .btn-primary { background: var(--text-on-accent); color: var(--surface-accent-2); border-color: var(--text-on-accent); }
.btn-on-accent:hover, .card.hero .btn-primary:hover { background: color-mix(in srgb, var(--text-on-accent) 88%, var(--surface-accent)); color: var(--surface-accent-2); border-color: var(--text-on-accent); }
.btn-outline-on-accent, .card.hero .btn-outline-light { background: transparent; color: var(--text-on-accent); border-color: color-mix(in srgb, var(--text-on-accent) 70%, transparent); }
.btn-outline-on-accent:hover, .card.hero .btn-outline-light:hover { color: var(--text-on-accent); border-color: var(--text-on-accent); background: color-mix(in srgb, var(--text-on-accent) 10%, transparent); }
.badge-required { background: var(--gold); color: var(--text-on-gold); }

/* routine card: one clear hierarchy – what fits now, how long, the steps, two actions; details only on demand */
.routine-now { display: flex; flex-direction: column; gap: 6px; padding: 18px; }
.routine-now .now-kicker { margin: 0; display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-on-accent-muted); }
html[dir="rtl"] .routine-now .now-kicker { letter-spacing: 0; }
.routine-now .now-title { margin: 0; font-size: clamp(1.5rem, 5vw, 1.9rem); line-height: 1.2; color: var(--text-on-accent); }
.routine-now .now-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--text-on-accent-muted); font-weight: 600; }
.routine-now .now-steps { color: var(--text-on-accent); }
.routine-now .now-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.routine-now .now-actions .btn { flex: 1 1 12rem; }
.routine-now details.why { margin-top: 4px; }

/* explanation boxes: own surface + own text colour in both themes */
.why-body { color: var(--text-primary); }
.why-body .why-h { margin: 10px 0 4px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.why-body .why-h:first-child { margin-top: 0; }
html[dir="rtl"] .why-body .why-h { letter-spacing: 0; }
.why-body .plan-lines { margin: 6px 0 0; padding-inline-start: 18px; color: var(--text-primary); }
.why-body .tech { margin: 4px 0 0; padding-inline-start: 18px; font-size: .84rem; color: var(--text-muted); }
.next-list { list-style: decimal; margin: 4px 0 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; }
.next-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; }
.next-list .nl-title { font-weight: 600; min-width: 0; overflow-wrap: break-word; }
.next-list .nl-note { grid-column: 1 / -1; grid-row: 2; font-size: .82rem; color: var(--text-secondary); }
.next-list .nl-dur { grid-column: 2; grid-row: 1; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.player-head .pl-steps { margin-top: 2px; font-size: .9rem; color: var(--text-secondary); }
.start-steps { color: var(--text-secondary); }
.start-next { text-align: start; padding: 10px 12px; border-radius: 12px; background: var(--surface-subtle); color: var(--text-primary); }
.start-next .why-h { margin: 0 0 4px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }

/* access-link cards: full URL always visible (wraps inside the URL, never widens the page) */
.linklist > li.linkcard { align-items: flex-start; }
.linkcard.inactive .title { color: var(--text-muted); }
.fullurl { margin: 8px 0 4px; padding: 8px 10px; border-radius: 10px; background: var(--surface-subtle); color: var(--text-primary); border: 1px solid var(--border); }
.fullurl code { font-size: .86rem; overflow-wrap: anywhere; word-break: break-all; direction: ltr; unicode-bidi: embed; user-select: all; }
.fullurl.unknown { color: var(--text-muted); border-style: dashed; }
.link-actions { flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
@media (min-width: 900px) { .link-actions { flex: 0 1 auto; align-items: flex-end; } }
details.more > summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 36px; font-size: .88rem; font-weight: 600; color: var(--accent); }
@media (pointer: coarse) { details.more > summary { min-height: 44px; } }
.share-sheet-own .share-explain, #share-sheet.own-url .share-explain, #share-sheet.own-url [data-share-result] > .hint { display: none; }
.filters-bar { margin-bottom: 6px; }
.player-head .why-body { text-align: start; }

/* ---- v1.6: prayer time while listening (player) – calm full-screen card, controls discreet ------------------------- */
.prayer-banner { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.prayer-card { width: 100%; max-width: 460px; text-align: center; display: flex; flex-direction: column; gap: 8px; padding: 26px 22px; border-radius: 22px;
  background: linear-gradient(160deg, var(--surface-accent), var(--surface-accent-2)); color: var(--text-on-accent); box-shadow: var(--shadow); }
.prayer-card p { margin: 0; }
.pb-ar { font-family: var(--font-ar); font-size: clamp(2.6rem, 12vw, 4rem); line-height: 1.3; color: var(--text-on-accent); }
.pb-name { font-size: 1.5rem; font-weight: 700; }
.pb-time { font-size: 1.2rem; font-variant-numeric: tabular-nums; direction: ltr; }
.pb-state { color: var(--text-on-accent-muted); }
.pb-dua { font-family: var(--font-ar); font-size: 1.2rem; line-height: 2; }
.pb-src { font-family: var(--font); font-size: .8rem; color: var(--text-on-accent-muted); }
.prayer-card .btn-primary { background: var(--text-on-accent); color: var(--surface-accent-2); border-color: var(--text-on-accent); margin-top: 8px; }
.pb-quiet { justify-content: center; }
.pb-quiet .btn-ghost { color: var(--text-on-accent-muted); }
body.drive .prayer-banner { background: #07100d; }
html[lang="ar"] .prayer-card .pb-name { display: none; }   /* see prayer.css: no "الفجر الفجر" */

/* ---- v1.7: public start page (personal link without an account) --------------------------------------------------- */
.landing { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.landing-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0 4px; }
.landing-hero h1 { font-size: clamp(1.8rem, 7vw, 2.4rem); display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; justify-content: center; }
.landing-hero h1 .ar { font-family: var(--font-ar); color: var(--accent); font-weight: 600; }
.landing-hero .lead { margin: 0; max-width: 34rem; color: var(--text-secondary); font-size: 1.05rem; }
.landing-form { display: flex; flex-direction: column; gap: 14px; }
.landing-form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.landing-form legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.landing-lang { color: var(--text-secondary); }
.landing-own .row .btn { flex: 1 1 12rem; }
.landing-points { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
.landing-points > div { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--surface-subtle); color: var(--text-primary); }
.landing-points p { margin: 0; font-size: .92rem; }
.landing-points .icon { flex: none; width: 22px; height: 22px; color: var(--accent); }
.landing-login { text-align: center; color: var(--text-secondary); }
.hp { position: absolute !important; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }   /* honeypot, invisible for people */
.guest-ready { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.guest-ready .row .btn { flex: 1 1 10rem; }
.guest-upgrade { margin-top: 14px; }

/* ---- v1.7: Qāriʾ choice (listener + public form) -------------------------------------------------------------------- */
.reciter-search { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.reciter-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: min(52vh, 420px); overflow-y: auto; }
.reciter-list .rc { width: 100%; display: flex; gap: 10px; align-items: center; justify-content: space-between; text-align: start; min-height: 52px; padding: 8px 12px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); font: inherit; cursor: pointer; }
.reciter-list .rc:hover, .reciter-list .rc:focus-visible { border-color: var(--accent); }
.reciter-list .rc.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.rc-main { display: flex; flex-direction: column; min-width: 0; }
.rc-main strong { overflow-wrap: anywhere; }
.rc-main .ar { font-family: var(--font-ar); font-size: .95rem; color: var(--text-secondary); }
.rc-st { flex: none; font-size: .8rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-subtle); color: var(--text-secondary); white-space: nowrap; }
.rc-st.st-available { color: var(--success-text, var(--accent)); }
.rc-st.st-preparing { color: var(--accent); }
.listener-intro { display: flex; flex-direction: column; gap: 8px; text-align: start; padding: 12px; border-radius: 14px; background: var(--surface-subtle); color: var(--text-primary); }
.li-reciter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.l-pending { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-subtle); color: var(--text-primary); display: flex; flex-direction: column; gap: 6px; }
.l-pending .plprogress { margin: 0; }
.l-sec { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); }
.l-sec:first-of-type { border-top: 0; margin-top: 4px; padding-top: 0; }
#l-sheet .reciter-list { max-height: 38dvh; }   /* the sheet scrolls itself – keep "your name" and "my data" in reach */
.l-riwayah { font-weight: 400; color: var(--text-secondary); white-space: nowrap; }
.l-pick { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--accent); display: flex; flex-direction: column; gap: 6px; }

/* ---- v1.7: share lifecycle + names of direct recipients -------------------------------------------------------------- */
.lc-counts { list-style: none; margin: 6px 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.badge.lc-active { background: var(--accent-soft); color: var(--text-primary); }
.badge.lc-pending { background: var(--surface-subtle); color: var(--text-secondary); border: 1px dashed var(--border); }
.badge.lc-inactive { background: var(--surface-subtle); color: var(--text-muted); }
.badge.lc-expired, .badge.lc-revoked { background: var(--surface-subtle); color: var(--text-muted); text-decoration: line-through; }
.name-list { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.name-list li { padding: 4px 10px; border-radius: 999px; background: var(--surface-subtle); color: var(--text-primary); }

/* ---- v1.8: three separated statistics + quiet milestones ------------------------------------------------------------ */
.stats-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.stats-kicker { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
html[dir="rtl"] .stats-kicker { letter-spacing: 0; }
.stats-switch { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.stats-switch a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-primary); font-weight: 600; text-decoration: none; }
.stats-switch a[aria-current] { border-color: var(--accent); background: var(--accent-soft); }
.stats-switch .icon { width: 18px; height: 18px; }
.stat-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.stat-cards > div { padding: 12px 14px; border-radius: 14px; background: var(--surface-subtle); color: var(--text-primary); }
.stat-cards .stat { font-size: clamp(1.4rem, 5vw, 1.9rem); font-weight: 700; font-variant-numeric: tabular-nums; }

/* charts: SVG geometry + <progress> – no inline styles (Content-Security-Policy: style-src 'self') */
.chart { margin: 10px 0; }
.chart-bars { margin: 10px 0; }
.chart-bars svg { display: block; width: 100%; height: 120px; }
.chart-bars rect { fill: var(--accent); }
.chart-axis { display: flex; justify-content: space-between; gap: 2px; margin: 4px 0 0; font-size: .68rem; color: var(--text-muted); }
.chart-axis span { flex: 1 1 0; text-align: center; overflow: hidden; white-space: nowrap; }
@media (max-width: 640px) { .chart-axis .hide-sm { visibility: hidden; } }
.chart-rows { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chart-rows li { display: grid; grid-template-columns: minmax(6rem, 10rem) minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.chart-rows .cr-label { overflow-wrap: anywhere; font-weight: 600; }
.chart-rows .cr-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 520px) { .chart-rows li { grid-template-columns: minmax(0, 1fr) auto; } .chart-rows .cr-bar { grid-column: 1 / -1; grid-row: 2; } }
progress.cr-bar { appearance: none; -webkit-appearance: none; width: 100%; height: 10px; border: 0; border-radius: 999px; background: var(--surface-subtle); color: var(--accent); }
progress.cr-bar::-webkit-progress-bar { background: var(--surface-subtle); border-radius: 999px; }
progress.cr-bar::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress.cr-bar::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.chart-split svg { display: block; width: 100%; height: 14px; border-radius: 999px; background: var(--surface-subtle); }
.chart-split rect.cs-0 { fill: var(--accent); }
.chart-split rect.cs-1 { fill: color-mix(in srgb, var(--accent) 65%, var(--surface)); }
.chart-split rect.cs-2 { fill: color-mix(in srgb, var(--accent) 40%, var(--surface)); }
.chart-split rect.cs-3 { fill: color-mix(in srgb, var(--accent) 25%, var(--surface)); }
.chart-split rect.cs-4 { fill: var(--border); }
.chart-legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9rem; }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 3px; }
.cs-0 { background: var(--accent); } .cs-1 { background: color-mix(in srgb, var(--accent) 65%, var(--surface)); }
.cs-2 { background: color-mix(in srgb, var(--accent) 40%, var(--surface)); } .cs-3 { background: color-mix(in srgb, var(--accent) 25%, var(--surface)); }
.cs-4 { background: var(--border); }

/* milestones: calm, never loud */
.ms-groups { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.ms-group { padding: 14px; border-radius: 16px; background: var(--surface-subtle); }
.ms-group h3 { margin: 0 0 8px; font-size: 1rem; }
.ms-badges { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ms-badges li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: .86rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); }
.ms-badges li.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text-primary); }
.ms-next { margin: 10px 0 0; font-size: .88rem; color: var(--text-secondary); }
.ms-next progress.cr-bar { display: block; height: 8px; margin-top: 6px; background: var(--surface); }
.ms-next progress.cr-bar::-webkit-progress-bar { background: var(--surface); }

/* v1.9: badge gallery, next milestone, personal records (tile itself: badges.css) */
.badge-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); margin: 12px 0; }
.ms-next-card { display: flex; align-items: center; gap: 16px; margin: 12px 0; padding: 14px; border-radius: 16px; background: var(--surface-subtle); }
.ms-next-card .grow { min-width: 0; text-align: start; }
@media (max-width: 520px) { .ms-next-card { flex-direction: column; text-align: center; } .ms-next-card .grow { text-align: center; } }
.record-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.record-card .stat { font-size: clamp(1.3rem, 4.5vw, 1.7rem); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
