/* Al-Bayân Nûr — البَيَانُ نُور · feuille de style
   Palette : parchemin et encre d'émeraude le jour, nuit verte et or le soir.
   Motifs : étoile à huit branches (khatam), arc de mihrab, filets dorés. */

:root {
  --bg: #f5efe2;
  --bg-2: #efe6d3;
  --surface: #fffcf5;
  --surface-2: #f8f2e6;
  --ink: #1c2a25;
  --ink-2: #4b5a53;
  --ink-3: #7b8780;
  --line: #e2d7c1;
  --emerald: #0f5f4a;
  --emerald-2: #127a5e;
  --emerald-soft: #dcebe3;
  --gold: #a8792c;
  --gold-2: #c99a45;
  --gold-soft: #f3e6c9;
  --lapis: #1f4e79;
  --rose: #a2453b;
  --ok: #2f7d4f;
  --warn: #b7791f;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 8px 24px rgba(40, 30, 10, .07);
  --radius: 18px;
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23a8792c' stroke-opacity='.13' stroke-width='1'%3E%3Cpath d='M32 10l6.5 15.5L54 32l-15.5 6.5L32 54l-6.5-15.5L10 32l15.5-6.5z'/%3E%3Cpath d='M16.4 16.4h31.2v31.2H16.4z' transform='rotate(45 32 32)'/%3E%3Cpath d='M16.4 16.4h31.2v31.2H16.4z'/%3E%3Cpath d='M0 0l10 10M64 0 54 10M0 64l10-10M64 64 54 54'/%3E%3C/g%3E%3C/svg%3E");
  --f-quran: 'Amiri Quran', 'Amiri', 'Noto Naskh Arabic', serif;
  --f-ar: 'Amiri', 'Noto Naskh Arabic', serif;
  --f-cal: 'Aref Ruqaa', 'Amiri', serif;
  --f-title: 'Fraunces', Georgia, serif;
  --f-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --qsize: 1;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1814; --bg-2: #0f201b; --surface: #12241e; --surface-2: #172d26;
    --ink: #ece4d2; --ink-2: #bdb6a6; --ink-3: #8c9a92; --line: #25403a;
    --emerald: #4cc19a; --emerald-2: #66d2ad; --emerald-soft: #173a30;
    --gold: #d9b36a; --gold-2: #e8c886; --gold-soft: #2c2817;
    --lapis: #8fb8e0; --rose: #e48a7e; --ok: #6fcf97; --warn: #f2c063;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23d9b36a' stroke-opacity='.09' stroke-width='1'%3E%3Cpath d='M32 10l6.5 15.5L54 32l-15.5 6.5L32 54l-6.5-15.5L10 32l15.5-6.5z'/%3E%3Cpath d='M16.4 16.4h31.2v31.2H16.4z' transform='rotate(45 32 32)'/%3E%3Cpath d='M16.4 16.4h31.2v31.2H16.4z'/%3E%3Cpath d='M0 0l10 10M64 0 54 10M0 64l10-10M64 64 54 54'/%3E%3C/g%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1814; --bg-2: #0f201b; --surface: #12241e; --surface-2: #172d26;
  --ink: #ece4d2; --ink-2: #bdb6a6; --ink-3: #8c9a92; --line: #25403a;
  --emerald: #4cc19a; --emerald-2: #66d2ad; --emerald-soft: #173a30;
  --gold: #d9b36a; --gold-2: #e8c886; --gold-soft: #2c2817;
  --lapis: #8fb8e0; --rose: #e48a7e; --ok: #6fcf97; --warn: #f2c063;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23d9b36a' stroke-opacity='.09' stroke-width='1'%3E%3Cpath d='M32 10l6.5 15.5L54 32l-15.5 6.5L32 54l-6.5-15.5L10 32l15.5-6.5z'/%3E%3Cpath d='M16.4 16.4h31.2v31.2H16.4z' transform='rotate(45 32 32)'/%3E%3Cpath d='M16.4 16.4h31.2v31.2H16.4z'/%3E%3Cpath d='M0 0l10 10M64 0 54 10M0 64l10-10M64 64 54 54'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: calc(100% * var(--tscale, 1)); }
body {
  margin: 0; min-height: 100vh; background: var(--bg) var(--star); background-size: 64px 64px;
  color: var(--ink); font: 1rem/var(--lh, 1.55) var(--f-body); letter-spacing: var(--ls, 0);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--emerald); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { font-family: var(--f-title); line-height: 1.2; margin: 0 0 .4em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: 10px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }

[lang="ar"], .ar { font-family: var(--f-ar); direction: rtl; unicode-bidi: isolate; }
/* lisibilité de l'arabe : taille et espace entre les mots réglables (feuille « Aa ») ; le zoom ne s'applique
   qu'à l'élément arabe le plus extérieur, pour ne pas se cumuler, et jamais aux ornements */
:where([lang="ar"], .ar, .q):not(:is([lang="ar"], .ar, .q) *):not(.brand-ar, .tile-ar, .hero-word, .letter-big, html) { zoom: var(--arscale, 1); word-spacing: var(--arws, 0); }
html[data-contrast="fort"] { --ink: #050a08; --ink-2: #1d2622; --ink-3: #3c4742; --line: #b8a988; }
html[data-contrast="fort"][data-theme="dark"] { --ink: #fffaf0; --ink-2: #e6dfcf; --ink-3: #c2bbab; --line: #4d6b62; }
@media (prefers-color-scheme: dark) { html[data-contrast="fort"]:not([data-theme="light"]) { --ink: #fffaf0; --ink-2: #e6dfcf; --ink-3: #c2bbab; --line: #4d6b62; } }
.range { width: 100%; accent-color: var(--emerald); margin-top: 4px; }
.typo-preview { background: var(--surface-2); }
.q { font-family: var(--f-quran); direction: rtl; unicode-bidi: isolate; }

/* ---------- barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand-ar { font-family: var(--f-cal); font-size: 1.9rem; color: var(--emerald); line-height: 1; }
.brand-lat { font-family: var(--f-title); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .78rem; color: var(--gold); }
.brand-ar, .brand-lat { white-space: nowrap; }
.brand-logo { width: 42px; height: 42px; align-self: center; flex: none; }
/* téléphone : le nom arabe seul, sur une ligne, laisse la place aux boutons */
@media (max-width: 520px) { .brand-lat { display: none; } .brand-ar { font-size: 1.55rem; } .brand { gap: 7px; } .brand-logo { width: 34px; height: 34px; } }
.topbar-actions { display: flex; gap: 4px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
/* petits téléphones (≤ 400 px) : boutons resserrés pour garder logo et nom sur la même ligne */
@media (max-width: 400px) { .topbar { padding-left: 12px; padding-right: 12px; } .topbar-actions { gap: 2px; } .topbar-actions .icon-btn { width: 36px; } }

/* ---------- navigation ---------- */
.nav {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border-radius: 12px;
  color: var(--ink-3); font-size: .7rem; font-weight: 600; text-decoration: none !important;
}
.nav a.on { color: var(--emerald); }
.nav a.on svg { stroke-width: 2.1; }
.nav .nav-wide { display: none; }
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 92px; }
  .topbar { margin-left: -92px; padding-left: 108px; }
  .nav {
    top: 0; right: auto; width: 92px; flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 84px 8px 16px; border-top: 0; border-right: 1px solid var(--line);
  }
  .nav a { flex: 0; padding: 10px 2px; }
  .nav .nav-wide { display: flex; }
  .nav .nav-narrow { display: none; }
}

main { max-width: 980px; margin: 0 auto; padding: 18px 16px 40px; outline: none; }
main.wide { max-width: 1200px; }

/* ---------- éléments communs ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
/* dans une grille, l'espacement vient du gap : sans cela toutes les cartes sauf la première descendent de 12px */
.grid > .card + .card, .grid > .card { margin-top: 0; }
.grid > .card { min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.eyebrow { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--gold); margin-bottom: 6px; }
.section-title { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; }
.section-title h2 { margin: 0; }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-2), transparent); opacity: .6; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  font-weight: 600; text-decoration: none !important; white-space: nowrap;
}
.btn:hover { border-color: var(--gold-2); }
.btn.primary { background: var(--emerald); border-color: var(--emerald); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #06140f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #06140f; } }
.btn.gold { background: var(--gold-soft); border-color: var(--gold-2); color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .88rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: default; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); cursor: pointer; text-decoration: none !important;
}
.chip.on, .chip:hover { border-color: var(--emerald); color: var(--emerald); }
.chip .ar { font-size: 1.05rem; }
.badge { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--emerald-soft); color: var(--emerald); }
.badge.gold { background: var(--gold-soft); color: var(--gold); }
.hd-fr { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.hd-fr summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--emerald); }
.hd-fr p { margin: 8px 0 0; line-height: 1.65; }
.badge.rose { background: color-mix(in srgb, var(--rose) 15%, transparent); color: var(--rose); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink-3); }
.dot.c0 { background: #c9a227; } .dot.c1 { background: #d88b3a; } .dot.c2 { background: #5aa469; } .dot.c3 { background: #1f8a5b; }
.input {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: inherit; font-size: 1.05rem;
}
.input:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 18%, transparent); }
.input.ar-in { font-family: var(--f-ar); font-size: 1.3rem; }
select.input { font-size: .95rem; }
.searchbar { position: relative; }
.searchbar svg { position: absolute; left: 14px; top: 13px; color: var(--ink-3); }
.searchbar .input { padding-left: 44px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; color: var(--ink); text-decoration: none !important; cursor: pointer; }
.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.progress { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--emerald), var(--gold-2)); border-radius: inherit; }
.empty { text-align: center; padding: 36px 12px; color: var(--ink-3); }
.loading { display: grid; place-items: center; padding: 48px; color: var(--ink-3); }
.loading::before {
  content: ""; width: 34px; height: 34px; margin-bottom: 10px;
  background: var(--gold); -webkit-mask: var(--star8) center/contain no-repeat; mask: var(--star8) center/contain no-repeat;
  animation: spin 2.4s linear infinite;
}
:root { --star8: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 0l11 23 25-9-9 25 23 11-23 11 9 25-25-9-11 23-11-23-25 9 9-25L0 50l23-11-9-25 25 9z'/%3E%3C/svg%3E"); }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-2); border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1; min-width: max-content; border: 0; background: transparent; padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.tabs button.on { background: var(--surface); color: var(--emerald); box-shadow: var(--shadow); }
.note { border-left: 3px solid var(--gold-2); background: var(--gold-soft); padding: 10px 12px; border-radius: 0 12px 12px 0; font-size: .88rem; color: var(--ink-2); }
.kbd-ar { font-family: var(--f-ar); font-size: 1.25rem; }
hr.ornament { border: 0; height: 18px; margin: 18px 0; background: var(--gold); opacity: .55;
  -webkit-mask: var(--orn) center/auto 18px no-repeat; mask: var(--orn) center/auto 18px no-repeat; }
:root { --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 18'%3E%3Cpath d='M0 9h96M144 9h96' stroke='black' stroke-width='1'/%3E%3Cpath d='M120 0l4 5 5-1-1 5 4 4-4 4 1 5-5-1-4 5-4-5-5 1 1-5-4-4 4-4-1-5 5 1z' transform='translate(0 -4) scale(1 1.2)'/%3E%3Ccircle cx='104' cy='9' r='2'/%3E%3Ccircle cx='136' cy='9' r='2'/%3E%3C/svg%3E"); }

/* ---------- accueil ---------- */
.hero {
  position: relative; overflow: hidden; text-align: center; padding: 34px 20px 26px; color: #f6efdc;
  border-radius: 140px 140px 26px 26px / 120px 120px 26px 26px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(217,179,106,.28), transparent 60%),
    var(--star),
    linear-gradient(170deg, #0f4d3e, #0a2f27 70%);
  background-size: auto, 64px 64px, auto;
  box-shadow: var(--shadow);
  border: 1px solid #c99a45;
}
.hero::before {
  content: ""; position: absolute; inset: 8px; border: 1px solid rgba(233,200,134,.45);
  border-radius: 132px 132px 20px 20px / 112px 112px 20px 20px; pointer-events: none;
}
.hero-word { font-family: var(--f-cal); font-size: clamp(4.2rem, 16vw, 7rem); line-height: 1.15; margin: 4px 0 0;
  background: linear-gradient(100deg, #e8c886 20%, #fff6dd 45%, #e8c886 70%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 7s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .hero-word { animation: none; } .loading::before { animation: none; } }
.hero-sub { font-family: var(--f-title); font-size: 1.15rem; letter-spacing: .02em; color: #e8c886; }
.hero-verse { font-family: var(--f-quran); font-size: 1.55rem; margin: 14px 0 4px; color: #fff; }
.hero-ref { font-size: .82rem; color: rgba(246,239,220,.75); }
.hero .btn { margin-top: 16px; }
.hero .btn.primary { background: #e8c886; border-color: #e8c886; color: #0a2f27; }
.greet { font-family: var(--f-title); font-size: 1.05rem; color: var(--ink-2); margin: 18px 4px 4px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; text-align: center; }
.stat b { display: block; font-family: var(--f-title); font-size: 1.5rem; color: var(--emerald); line-height: 1.1; }
.stat span { font-size: .75rem; color: var(--ink-3); }
.tile {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-rows: min-content; column-gap: 10px; row-gap: 6px;
  text-decoration: none !important; color: var(--ink); position: relative; overflow: hidden; min-height: 112px; align-content: start;
}
.tile:hover { border-color: var(--gold-2); }
/* la calligraphie occupe sa propre colonne, à droite du titre : elle ne recouvre plus aucun texte */
.tile .tile-ar { grid-column: 2; grid-row: 1; justify-self: end; align-self: start; margin: -6px -2px 0 0; font-family: var(--f-cal); font-size: 1.9rem; line-height: 1.15; color: var(--gold); opacity: .3; pointer-events: none; white-space: nowrap; }
.tile h3 { grid-column: 1; grid-row: 1; margin: 0; align-self: start; }
.tile > :not(.tile-ar, h3) { grid-column: 1 / -1; }
/* conseil, histoire et mot du jour : trois cartes de même hauteur, pied de carte aligné en bas */
.daily > .card { display: flex; flex-direction: column; }
.daily > .card > b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; font-family: var(--f-title); font-size: 1.05rem; line-height: 1.35; }
.daily > .card > p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 7; line-clamp: 7; overflow: hidden; }
.daily > .card > .row { margin-top: auto; padding-top: 8px; flex-wrap: nowrap; align-items: flex-end; }
.daily > .card > .row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.daily > .card > .row > a { flex: none; }

.verse-day .q { font-size: 1.6rem; line-height: 2.1; text-align: center; }

/* ---------- lecteur du Coran ---------- */
.surah-list .num {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: var(--gold);
  background: var(--gold-soft); -webkit-mask: var(--star8) center/contain no-repeat; mask: var(--star8) center/contain no-repeat;
}
.surah-list .num-wrap { position: relative; width: 40px; height: 40px; flex: none; display: grid; place-items: center; }
.surah-list .num-wrap span { position: absolute; font-weight: 700; font-size: .8rem; color: var(--gold); }
.surah-list .name-ar { font-family: var(--f-ar); font-size: 1.45rem; color: var(--emerald); }
.surah-head {
  text-align: center; padding: 26px 16px 18px; margin-bottom: 8px; position: relative;
  border-radius: 120px 120px 20px 20px / 90px 90px 20px 20px; border: 1px solid var(--gold-2);
  background: radial-gradient(100% 70% at 50% 0%, var(--gold-soft), transparent 70%), var(--surface);
}
.surah-head .ar-name { font-family: var(--f-cal); font-size: 2.6rem; color: var(--emerald); line-height: 1.2; }
.surah-head .meta { font-size: .85rem; color: var(--ink-3); }
.basmala { font-family: var(--f-quran); font-size: calc(1.7rem * var(--qsize)); text-align: center; margin: 14px 0 6px; color: var(--ink); }
.reader-tools { position: sticky; top: 57px; z-index: 20; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 8px 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); }
.verse { padding: 16px 4px 14px; border-bottom: 1px solid var(--line); scroll-margin-top: 120px; }
.verse.playing { background: linear-gradient(90deg, transparent, var(--gold-soft), transparent); }
.verse.target { animation: flash 2.2s ease-out 1; }
@keyframes flash { from { background: var(--gold-soft); } to { background: transparent; } }
.verse-ar { direction: rtl; text-align: right; font-family: var(--f-quran); font-size: calc(1.85rem * var(--qsize)); line-height: 2.35; display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: flex-start; }
.w { display: inline-flex; flex-direction: column; align-items: center; cursor: pointer; border-radius: 10px; padding: 0 4px; transition: background .15s; }
.w:hover, .w.sel { background: var(--emerald-soft); }
.w .wa { line-height: 1.9; }
.w .wt, .w .wg { font-family: var(--f-body); direction: ltr; font-size: calc(.7rem * var(--qsize) + .12rem); line-height: 1.25; text-align: center; max-width: 9.5em; }
.w .wt { color: var(--gold); font-style: italic; }
.w .wg { color: var(--ink-2); }
.w .wg.en { color: var(--ink-3); }
.w .wg.en::before { content: "EN · "; font-size: .62rem; letter-spacing: .05em; color: var(--gold); }
.w.known .wa { text-decoration: underline 2px color-mix(in srgb, var(--emerald) 45%, transparent); text-underline-offset: 10px; }
.vnum {
  position: relative; display: inline-grid; place-items: center; width: 2.1em; height: 2.1em; font-size: .62em; margin-top: .55em;
  font-family: var(--f-body); color: var(--gold); font-weight: 700; direction: ltr;
}
.vnum::before { content: ""; position: absolute; inset: 0; background: var(--gold); opacity: .9;
  -webkit-mask: var(--vring) center/contain no-repeat; mask: var(--vring) center/contain no-repeat; }
:root { --vring: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='none' stroke='black' stroke-width='5' d='M50 4l13 18 21-5-5 21 18 12-18 12 5 21-21-5-13 18-13-18-21 5 5-21L4 50l18-12-5-21 21 5z'/%3E%3C/svg%3E"); }
.verse-tr { margin-top: 8px; color: var(--ink-2); font-size: .98rem; }
.verse-tl { margin-top: 6px; color: var(--gold); font-style: italic; font-size: .9rem; }
.verse-actions { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.verse-actions .btn { min-height: 32px; padding: 0 10px; font-size: .8rem; border-radius: 9px; }
.reveal { border: 1px dashed var(--line); background: transparent; color: var(--ink-3); border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: .85rem; }

/* ---------- feuille de détail (mot, article) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(5, 15, 12, .45); }
.sheet {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  padding: 8px 18px calc(24px + env(safe-area-inset-bottom)); animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.sheet-grip { width: 44px; height: 5px; border-radius: 5px; background: var(--line); margin: 4px auto 6px; }
.sheet-close { position: absolute; right: 10px; top: 10px; }
@media (min-width: 900px) {
  .sheet { left: auto; top: 0; width: 520px; max-height: none; border-radius: 26px 0 0 26px; padding-top: 18px; animation: side .22s ease-out; }
  .sheet-grip { display: none; }
  @keyframes side { from { transform: translateX(30px); opacity: .4; } }
}
.word-head { text-align: center; padding: 12px 0 6px; }
.word-big { font-family: var(--f-quran); font-size: 3rem; line-height: 1.6; color: var(--emerald); }
.word-tl { color: var(--gold); font-style: italic; }
.word-gloss { font-family: var(--f-title); font-size: 1.25rem; margin-top: 4px; }
.root-letters { display: inline-flex; gap: 8px; direction: rtl; font-family: var(--f-ar); font-size: 1.5rem; }
.root-letters span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--gold-soft); color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: .9rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

/* ---------- article du dictionnaire ---------- */
.entry-hw { font-family: var(--f-ar); font-size: 2.2rem; color: var(--emerald); line-height: 1.5; direction: rtl; }
.senses { list-style: none; counter-reset: s; padding: 0; margin: 8px 0; }
.senses > li { counter-increment: s; position: relative; padding: 6px 0 6px 34px; border-bottom: 1px dashed var(--line); }
.senses > li::before { content: counter(s); position: absolute; left: 0; top: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: var(--emerald-soft); color: var(--emerald); }
.ex { margin: 6px 0 0; padding: 6px 10px; background: var(--surface-2); border-radius: 10px; font-size: .9rem; }
.ex .ar { font-size: 1.2rem; display: block; text-align: right; }
.ar-tap { cursor: pointer; border-bottom: 1px dotted color-mix(in srgb, var(--gold) 70%, transparent); font-family: var(--f-ar); font-size: 1.12em; unicode-bidi: isolate; direction: rtl; }
.ar-tap:hover { color: var(--emerald); }
abbr[title] { text-decoration: underline dotted var(--gold); cursor: help; }
.sub-entries { margin-top: 10px; }
.sub-entries details { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 6px; background: var(--surface-2); }
.sub-entries summary { cursor: pointer; font-weight: 600; }
.reliab { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--ink-2); }
.result-hw { font-family: var(--f-ar); font-size: 1.45rem; color: var(--emerald); min-width: 90px; text-align: right; direction: rtl; }

/* ---------- apprendre ---------- */
.path { position: relative; display: grid; gap: 12px; }
.level { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; }
.level-badge { width: 54px; height: 54px; display: grid; place-items: center; font-family: var(--f-title); font-weight: 700; font-size: 1.2rem; color: #fff; background: var(--emerald); -webkit-mask: var(--star8) center/contain no-repeat; mask: var(--star8) center/contain no-repeat; }
.level-badge-wrap { position: relative; width: 54px; height: 54px; display: grid; place-items: center; }
.level-badge-wrap b { position: absolute; color: #fff; font-family: var(--f-title); }
:root[data-theme="dark"] .level-badge-wrap b { color: #06140f; }
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; direction: rtl; }
.letter-cell { aspect-ratio: 1; display: grid; place-items: center; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-family: var(--f-ar); font-size: 2rem; color: var(--ink); position: relative; text-decoration: none !important; }
.letter-cell:hover { border-color: var(--emerald); color: var(--emerald); }
.letter-cell.done::after { content: "✓"; position: absolute; top: 4px; left: 8px; font-size: .75rem; color: var(--ok); font-family: var(--f-body); }
.letter-big { font-family: var(--f-ar); font-size: 6rem; line-height: 1.3; text-align: center; color: var(--emerald); }
.forms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; direction: rtl; text-align: center; }
.forms div { background: var(--surface-2); border-radius: 12px; padding: 8px 4px; }
.forms .ar { font-size: 2.2rem; display: block; line-height: 1.6; }
.forms small { color: var(--ink-3); font-size: .72rem; }
.quiz-opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quiz-opt { min-height: 64px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.05rem; padding: 8px; }
.quiz-opt.ar { font-size: 1.9rem; }
.quiz-opt.good { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.quiz-opt.bad { border-color: var(--rose); background: color-mix(in srgb, var(--rose) 12%, var(--surface)); }
.flash { text-align: center; padding: 26px 16px; min-height: 260px; display: grid; place-content: center; gap: 8px; }
.flash .q { font-size: 3rem; line-height: 1.7; color: var(--emerald); }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grades .btn { flex-direction: column; min-height: 58px; gap: 0; white-space: normal; }
.grades .btn small { font-weight: 500; font-size: .7rem; color: var(--ink-3); }
.g1 { border-color: color-mix(in srgb, var(--rose) 50%, var(--line)) !important; }
.g3 { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)) !important; }
.g4 { border-color: color-mix(in srgb, var(--emerald) 50%, var(--line)) !important; }
.g5 { border-color: color-mix(in srgb, var(--lapis) 50%, var(--line)) !important; }
.dialog-line { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.dialog-line .ar { font-size: 1.5rem; line-height: 1.9; display: block; text-align: right; }
.dialog-line .tl { color: var(--gold); font-style: italic; font-size: .9rem; }
.dialog-line .fr { color: var(--ink-2); }

/* ---------- bibliothèque ---------- */
.book-page { font-family: var(--f-read, 'Amiri', Georgia, serif); max-width: var(--measure, 760px); font-size: 1.08rem; line-height: 1.75; white-space: pre-line; }
.book-page mark { background: var(--gold-soft); color: inherit; border-radius: 4px; padding: 0 2px; }
.snippet { font-size: .88rem; color: var(--ink-2); }
.snippet mark { background: var(--gold-soft); color: var(--ink); }

/* ---------- pratique ---------- */
.prayers { display: grid; gap: 8px; }
.prayer { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.prayer.next { border-color: var(--emerald); background: var(--emerald-soft); }
.prayer .t { font-family: var(--f-title); font-size: 1.3rem; font-weight: 600; }
.prayer .ar { font-size: 1.1rem; color: var(--ink-3); margin-left: 8px; }
.adhan-bell, .adhan-bell-ph { width: 36px; height: 36px; flex: none; }
.adhan-bell { border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1rem; opacity: .55; }
.adhan-bell.on { opacity: 1; border-color: var(--gold-2); background: var(--gold-soft); }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--emerald); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.adhan-bar { position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 18px; background: var(--emerald); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.adhan-bar .ar { font-family: var(--f-cal); font-size: 1.5rem; color: #fff; }
.adhan-bar .grow { flex: 1; min-width: 0; }
.adhan-bar .btn { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.35); }
@media (min-width: 900px) { .adhan-bar { bottom: 20px; } }
/* proposition d'installer l'application (js/install.js) */
.install-bar { gap: 10px; padding: 10px 12px; }
.install-bar img { flex: none; width: 40px; height: 40px; border-radius: 11px; background: #fff; padding: 3px; }
.install-bar .btn { white-space: nowrap; }
.notif-bar .notif-ico { flex: none; width: 40px; height: 40px; border-radius: 11px; background: #fff; display: grid; place-items: center; }
.notif-bar .notif-ico svg { width: 24px; height: 24px; fill: none; stroke: var(--emerald); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
/* fermer : petit rond dans le coin, la place va au texte */
.install-bar .install-x { position: absolute; top: -9px; right: -6px; width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%;
  display: grid; place-items: center; font-size: 1rem; line-height: 1; background: var(--emerald); border: 2px solid #fff; color: #fff; }
.compass { position: relative; width: 240px; height: 240px; margin: 10px auto; border-radius: 50%; border: 1px solid var(--gold-2); background: radial-gradient(circle, var(--surface) 55%, var(--gold-soft)); }
.compass .needle { position: absolute; left: 50%; top: 50%; width: 4px; height: 100px; margin-left: -2px; margin-top: -100px; transform-origin: 50% 100%; background: linear-gradient(var(--emerald), transparent); border-radius: 4px; transition: transform .3s; }
.compass .kaaba { position: absolute; left: 50%; top: 50%; transform-origin: 0 0; font-size: 1.4rem; }
.compass .n { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); font-weight: 700; color: var(--rose); font-size: .8rem; }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.name-card { text-align: center; padding: 12px 8px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.name-card:hover { border-color: var(--gold-2); }
.name-card .ar { font-family: var(--f-cal); font-size: 1.7rem; color: var(--emerald); display: block; line-height: 1.6; }
/* ---------- tasbih : chapelet dessiné ---------- */
.tsb { max-width: 560px; margin: 8px auto 0; }
.tsb-dhikr { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 4px; }
.tsb-dhikr .icon-btn { font-size: 1.6rem; }
.tsb-dhikr-txt { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; color: var(--ink); cursor: pointer; padding: 6px; border-radius: 14px; text-align: center; min-height: 112px; justify-content: center; }
.tsb-dhikr-txt:hover { background: var(--surface-2); }
.tsb-dhikr-txt .ar { font-size: 1.9rem; line-height: 1.6; color: var(--emerald); }
.tsb-tr { font-weight: 600; font-size: .95rem; }
.tsb-dhikr-txt .ar.long { font-size: 1.3rem; line-height: 2; max-height: 34vh; overflow-y: auto; padding: 0 4px; }
.tsb-extra { margin-top: 4px; }
.tsb-frd { max-width: 100%; }
.tsb-frd summary { list-style: none; display: inline-flex; }
.tsb-frd summary::-webkit-details-marker { display: none; }
.tsb-frd[open] { flex-basis: 100%; }
.tsb-frd p { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 8px 0 0; }
.tsb-seq { color: var(--gold); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.tsb-stage {
  position: relative; margin: 8px 0 12px; border-radius: 28px; overflow: hidden; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  background: radial-gradient(120% 90% at 50% 0%, var(--surface) 0%, var(--bg-2) 100%); border: 1px solid var(--line); box-shadow: var(--shadow); outline: none;
}
.tsb-stage:focus-visible { border-color: var(--gold-2); }
.tsb-stage svg { display: block; width: 100%; height: min(58vh, 460px); }
.tsb-count { position: absolute; left: 22px; top: 18px; display: flex; flex-direction: column; pointer-events: none; }
.tsb-count b { font-family: var(--f-title); font-size: 4rem; line-height: 1; color: var(--emerald); font-variant-numeric: tabular-nums; }
.tsb-count span { font-size: 1rem; color: var(--ink-3); font-weight: 600; }
.tsb-count small { margin-top: 4px; font-size: .75rem; color: var(--gold); font-weight: 700; }
.tsb-hint { margin-top: 10px; font-style: normal; color: var(--ink-3); line-height: 1.3; }
.tsb-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tsb-tool { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .72rem; font-weight: 600; cursor: pointer; }
.tsb-tool span { font-size: 1.25rem; line-height: 1; }
.tsb-tool:hover { border-color: var(--gold-2); color: var(--ink); }
.tsb-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tsb-type { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: .8rem; font-weight: 600; text-align: center; }
.tsb-type.on { border-color: var(--emerald); background: var(--emerald-soft); }
.tsb-pick { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.tsb-pick.on { background: var(--emerald-soft); border-radius: 12px; }
.tsb-prog { display: flex; flex-direction: column; }
.tsb-prog.on { border-color: var(--emerald); }
.tsb-steps { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 2px; }
.tsb-steps li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 8px; border-bottom: 1px dashed var(--line); padding: 2px 0; }
.tsb-steps .ar { display: block; direction: rtl; text-align: right; font-size: 1.15rem; line-height: 1.7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsb-advice { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tsb-advice > .card { margin: 0; }
.tsb-rems { display: grid; gap: 0; }
.tsb-remgroup { border-top: 1px solid var(--line); }
.tsb-remgroup:first-of-type { border-top: 0; }
.tsb-remgroup > summary { cursor: pointer; padding: 12px 2px; list-style: none; display: flex; align-items: baseline; gap: 8px; }
.tsb-remgroup > summary::-webkit-details-marker { display: none; }
.tsb-remgroup > summary::before { content: "›"; color: var(--gold); font-weight: 700; transition: transform .2s; display: inline-block; }
.tsb-remgroup[open] > summary::before { transform: rotate(90deg); }
.tsb-remgroup .tsb-rems { padding-left: 4px; }
.tsb-remrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tsb-remrow:last-child { border-bottom: 0; }
.tsb-remrow .grow { flex: 1; min-width: 150px; }
.tsb-remrow select { width: auto; max-width: 220px; min-height: 38px; }
.tsb-remrow input[type=time] { width: 120px; min-height: 38px; }
.dhikr-bar { background: var(--gold); }
.dhikr-bar a.btn { text-decoration: none; }
.doua .ar { font-size: 1.55rem; line-height: 2.1; display: block; text-align: right; margin: 6px 0; }

/* ---------- progression ---------- */
.ring { --p: 0; width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto;
  background: conic-gradient(var(--emerald) calc(var(--p) * 1%), var(--bg-2) 0); }
.ring > div { width: 112px; height: 112px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.ring b { font-family: var(--f-title); font-size: 1.8rem; color: var(--emerald); line-height: 1; }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 4px; background: var(--bg-2); }
.heat i.l1 { background: color-mix(in srgb, var(--emerald) 30%, var(--bg-2)); }
.heat i.l2 { background: color-mix(in srgb, var(--emerald) 60%, var(--bg-2)); }
.heat i.l3 { background: var(--emerald); }
.milestone { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.milestone .m-ic { width: 40px; height: 40px; flex: none; background: var(--line); -webkit-mask: var(--star8) center/contain no-repeat; mask: var(--star8) center/contain no-repeat; }
.milestone.got .m-ic { background: var(--gold); }
.milestone:not(.got) { opacity: .6; }

/* ---------- divers ---------- */
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .9rem; box-shadow: var(--shadow); max-width: 90vw; }
.foot { margin-top: 36px; font-size: .78rem; color: var(--ink-3); text-align: center; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 16px 0; }
.scroll-x { overflow-x: auto; }
table.conj { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.conj td, table.conj th { border-bottom: 1px solid var(--line); padding: 6px; text-align: left; }
.occ { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.occ .q { font-size: 1.25rem; line-height: 2; display: block; text-align: right; }
.occ .q b { color: var(--emerald); font-weight: normal; background: var(--emerald-soft); border-radius: 6px; padding: 0 3px; }
.depth-block { border-left: 3px solid var(--emerald); padding-left: 12px; margin: 14px 0; }
.depth-text { white-space: pre-line; font-family: 'Amiri', Georgia, serif; font-size: 1.04rem; line-height: 1.7; max-height: 420px; overflow: auto; padding-right: 6px; }
.depth-text.open { max-height: none; }

/* ---------- tajwid ---------- */
.tj-ghunna { color: #2e8b57; }
.tj-qalqala { color: #1f6fb2; }
.tj-madd { color: #c0392b; }
.tj-iqlab { color: #8e44ad; }
.tj-muet { color: #9aa3a0; }
:root[data-theme="dark"] .tj-ghunna { color: #6fdc9a; } :root[data-theme="dark"] .tj-qalqala { color: #7fb8f0; }
:root[data-theme="dark"] .tj-madd { color: #ff8a7a; } :root[data-theme="dark"] .tj-iqlab { color: #c79bf2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tj-ghunna { color: #6fdc9a; } :root:not([data-theme="light"]) .tj-qalqala { color: #7fb8f0; }
  :root:not([data-theme="light"]) .tj-madd { color: #ff8a7a; } :root:not([data-theme="light"]) .tj-iqlab { color: #c79bf2; } }

/* ---------- mode lecture ---------- */
:root { --rsize: 1.15; }
/* ---------- mode lecture du Coran : le texte seul, comme un mushaf ---------- */
.qr-page { max-width: var(--measure, 760px); margin: 0 auto; padding: 26px clamp(16px, 5vw, 48px) 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.qr-head { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0 auto 10px; padding: 10px 18px; border: 1.5px solid var(--gold-2); border-radius: 14px; max-width: 420px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--gold) 10%, transparent), transparent); }
.qr-title { font-family: var(--f-cal); font-size: calc(1.7rem * var(--rsize)); color: var(--emerald); line-height: 1.5; }
.qr-sub { font-family: var(--f-body); font-size: .75rem; color: var(--ink-3); direction: ltr; }
.qr-basmala { font-family: var(--f-quran); text-align: center; font-size: calc(1.6rem * var(--rsize)); margin: 8px 0 4px; }
.qr-text { font-family: var(--f-quran); direction: rtl; text-align: justify; text-align-last: center; font-size: calc(1.7rem * var(--rsize)); line-height: 2.35; margin: 0; word-spacing: .06em; }
.qr-v { border-radius: 8px; transition: background .3s; }
.qr-v.on { background: color-mix(in srgb, var(--gold) 22%, transparent); }
.qr-text .vnum { font-size: .55em; margin: 0 .15em; vertical-align: middle; }
.qr-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.qr-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.qr-item:hover { border-color: var(--gold-2); }
.qr-item .ar { font-family: var(--f-quran); font-size: 1.3rem; color: var(--emerald); }
.qr-n { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--gold-soft); color: var(--gold); font-weight: 700; font-size: .8rem; }
.chip.qr-mode { border-color: var(--gold-2); color: var(--gold); font-weight: 700; }
@media (max-width: 560px) { .qr-text { font-size: calc(1.45rem * var(--rsize)); line-height: 2.25; word-spacing: 0; } .qr-page { padding: 18px 14px 22px; } }
html[data-mode="lecture"] .nav { display: none; }
html[data-mode="lecture"] body { padding-left: 0; padding-bottom: 0; }
html[data-mode="lecture"] .topbar { margin-left: 0; padding-left: 16px; }
.rd-head { position: sticky; top: 57px; z-index: 10; padding: 8px 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); }
.rd-select { margin: 6px 0 12px; }
.rd-page { max-width: var(--measure, 760px); margin: 0 auto; padding: 28px clamp(16px, 5vw, 56px); background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); font-family: 'Amiri', Georgia, serif; font-size: calc(1.08rem * var(--rsize)); line-height: 1.85; white-space: pre-line; hyphens: auto; }
.rd-page:not(.ar) { font-family: var(--f-read, inherit); }
.rd-page.ar { font-size: calc(1.45rem * var(--rsize)); line-height: 2.25; text-align: right; }
.rd-page .ar-tap { border-bottom: 0; }
.rd-page .ar-tap:hover { border-bottom: 1px dotted var(--gold); }
.rd-foot { max-width: 760px; margin: 16px auto; }
/* thèmes de lecture : appliqués seulement en mode lecture */
html[data-rtheme="sepia"] { --bg: #efe4cc; --surface: #f8efdb; --surface-2: #f1e5ca; --ink: #3d3021; --ink-2: #5c4a35; --ink-3: #8a775e; --line: #e0d0ae; }
html[data-rtheme="nuit"] { --bg: #0e1110; --surface: #151a18; --surface-2: #1b211f; --ink: #d9d3c4; --ink-2: #b3ac9c; --ink-3: #847e72; --line: #26302c;
  --emerald: #5fbf9a; --gold: #c9a868; --gold-soft: #2a2516; color-scheme: dark; }

/* chaîne de transmission d'un hadith : discrète, au-dessus du texte */
.ar.isnad { font-size: 1.02rem; line-height: 1.9; text-align: right; color: var(--ink-3); margin-top: 8px; }

/* Alfiyya : un vers = deux hémistiches côte à côte (de droite à gauche), empilés sur téléphone */
.baits { display: grid; gap: 4px; }
.bayt { display: grid; grid-template-columns: 2.2em 1fr 1fr auto; align-items: center; gap: 4px 14px; direction: rtl; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.bayt .ar { font-size: 1.35rem; line-height: 1.9; text-align: center; }
.bayt-n { color: var(--gold); font-size: .8rem; text-align: center; direction: ltr; }
.bayt-c { direction: ltr; white-space: nowrap; }
.alf-fr { margin-top: 10px; }
.alf-fr summary { cursor: pointer; }
.alf-fr p { margin: 6px 0; }
.alf-fr .ar-tap { font-size: 1.1em; }
@media (max-width: 640px) {
  .bayt { grid-template-columns: 2em 1fr; }
  .bayt .ar { text-align: right; grid-column: 2; }
  .bayt .ar + .ar { padding-right: 1.5em; }
  .bayt-c { grid-column: 2; justify-self: start; }
}

/* ---------- traductions de l'IA sous un texte arabe ---------- */
.tr-box { direction: ltr; text-align: left; unicode-bidi: isolate; font-family: var(--f-read, var(--f-body)); font-size: 1rem; line-height: 1.6;
  background: var(--surface-2); border-left: 3px solid var(--gold-2); padding: 8px 12px; border-radius: 0 12px 12px 0; margin: 4px 0 14px; }
.tr-btn { margin-top: 6px; }

/* ---------- carnet : barre de sélection, surlignages, compilation ---------- */
.sel-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; justify-content: center; max-width: calc(100vw - 16px); overflow-x: auto;
  background: var(--surface); border: 1px solid var(--gold-2); border-radius: 16px; padding: 6px 8px; box-shadow: var(--shadow); }
@media (max-width: 520px) { #sel-n { display: none; } .sel-bar .btn.sm { padding: 0 9px; } }
.carnet-flag { margin-top: 6px; }
.sel-bar > * { flex: none; }
.sel-bar > .row { flex-wrap: nowrap; }
.sel-dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); cursor: pointer; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.chip.on { background: var(--emerald-soft); border-color: var(--emerald); }
::highlight(hl-or) { background-color: rgba(232, 200, 134, .6); }
::highlight(hl-vert) { background-color: rgba(159, 216, 191, .6); }
::highlight(hl-bleu) { background-color: rgba(169, 200, 234, .6); }
::highlight(hl-rose) { background-color: rgba(240, 180, 171, .6); }
::highlight(hl-gris) { background-color: rgba(207, 200, 184, .6); }
.carnet-flag { display: inline-flex; margin-bottom: 8px; }
.citem { margin-bottom: 10px; }
.compil { max-width: var(--measure, 760px); margin: 14px auto; }
.compil blockquote { margin: .6em 0; padding: .6em 1em; border-left: 3px solid var(--gold-2); background: var(--surface-2); white-space: pre-line; border-radius: 0 10px 10px 0; }
.compil blockquote.ar { border-left: 0; border-right: 3px solid var(--gold-2); border-radius: 10px 0 0 10px; font-size: 1.4rem; line-height: 2.1; text-align: right; }
.compil-note { background: var(--gold-soft); padding: 8px 12px; border-radius: 10px; }
.compil-item { break-inside: avoid; }
@media print {
  .topbar, .nav, .no-print, .sel-bar, .carnet-flag, .toast, .sheet, .sheet-backdrop { display: none !important; }
  body { background: #fff !important; padding: 0 !important; color: #000; }
  #view { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .compil { border: 0 !important; box-shadow: none !important; margin: 0 auto; }
  a { color: #000; text-decoration: none; }
}

/* ---------- chaîne de transmission (isnâd) en arbre : js/views/isnad.js ---------- */
.isnad-wrap { overflow-x: auto; margin: 10px -4px 0; padding: 6px 4px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); -webkit-overflow-scrolling: touch; }
.isnad-tree { display: block; margin: 0 auto; stroke: none; }
.isnad-tree text { stroke: none; }
.isnad-tree .ie { fill: none; stroke: var(--line); stroke-linecap: round; }
.isnad-tree .ie.cur { stroke: var(--gold-2); }
.isnad-tree rect { fill: var(--surface); stroke: var(--line); }
.isnad-tree .cur rect { stroke: var(--gold); stroke-width: 1.6; }
.isnad-tree .pro rect { fill: var(--emerald); stroke: var(--emerald); }
.isnad-tree .pro text { fill: #fff; }
.isnad-tree .leaf rect { fill: var(--gold-soft); }
.isnad-tree text { fill: var(--ink); text-anchor: middle; font-size: 15px; }
.isnad-tree text.ar { font-family: var(--f-ar, serif); direction: rtl; }
.isnad-tree text.ref { font-size: 11px; fill: var(--ink-2); }
.isnad-tree text.cnt { font-size: 10px; fill: var(--ink-3); text-anchor: start; }
.isnad-tree a:hover rect { stroke: var(--emerald); }
.isnad-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0; }
.isnad-line .chip.pro { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.isnad-arrow { color: var(--ink-3); font-size: .9rem; }

/* ---------- explorer le Coran : js/views/explorer.js ---------- */
.rootmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 3px; margin-top: 10px; direction: rtl; }
.rootmap .rc { aspect-ratio: 1; border-radius: 6px; display: grid; place-items: center; font-size: .62rem; text-decoration: none;
  background: color-mix(in srgb, var(--emerald) var(--p), var(--surface-2)); color: var(--ink); border: 1px solid var(--line); }
.rootmap .rc.z { opacity: .45; }
.rootmap .rc span { mix-blend-mode: normal; }
.split-bar { height: 8px; border-radius: 6px; background: var(--gold-soft); overflow: hidden; }
.split-bar i { display: block; height: 100%; background: var(--emerald); }
.bar { display: inline-block; height: 6px; border-radius: 4px; background: var(--emerald); opacity: .7; }
.q.sim { font-size: 1.35rem; line-height: 2.1; text-align: right; }
.q.sim mark, .occ mark { background: var(--gold-soft); color: var(--ink); border-radius: 4px; padding: 0 2px; }
.cmp mark { background: var(--gold-soft); color: var(--ink); border-radius: 3px; }
.cmp { margin: 8px 0; gap: 12px; }

/* ---------- guides et outils de la pratique : js/views/guides.js, js/views/outils.js ---------- */
.formula { border-left: 3px solid var(--gold-2); padding: 6px 10px; margin: 8px 0; background: var(--bg-2); border-radius: 0 10px 10px 0; }
.formula .ar { font-size: 1.35rem; line-height: 2; }
.pstep { display: flex; gap: 14px; align-items: flex-start; }
.pfig { width: 64px; height: 64px; flex: none; fill: none; stroke: var(--emerald); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; background: var(--emerald-soft); border-radius: 14px; padding: 4px; }
.pfig circle { fill: var(--emerald); stroke: none; }
.hmap { width: 100%; height: auto; display: block; stroke: none; }
.hmap .hroute { fill: none; stroke: var(--gold-2); stroke-width: 3; stroke-dasharray: 6 6; }
.hmap .hpt { fill: var(--emerald); }
.hmap text { text-anchor: middle; fill: var(--ink); stroke: none; }
.hmap .har { font-family: var(--f-ar); font-size: 13px; }
.hmap .hfr { font-size: 11px; font-weight: 700; }
.hmap .hnote { font-size: 9px; fill: var(--ink-3); }
.fiqh-term { border-bottom: 1px dotted var(--gold); cursor: help; }
.fiqh-term:hover { color: var(--emerald); }
.ramgrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.ramgrid .rd { aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .8rem; background: var(--surface); }
.ramgrid .rd.ok { background: var(--emerald-soft); border-color: var(--emerald); }
.ramgrid .rd.miss { background: color-mix(in srgb, #e57373 22%, var(--surface)); }
.ramgrid .rd.odd { box-shadow: inset 0 0 0 2px var(--gold-2); }
.ramgrid .rd.sel { outline: 2px solid var(--ink); }
@media (max-width: 520px) { .ramgrid { grid-template-columns: repeat(6, 1fr); } .pstep { flex-direction: column; } }

/* ---------- mémorisation par pages et lecture en assemblée : js/views/hifz-pages.js, lecture-coran.js ---------- */
.pagemap { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 2px; direction: rtl; }
.pc { aspect-ratio: 1; border-radius: 4px; font-size: .5rem; display: grid; place-items: center; text-decoration: none; color: var(--ink-3); border: 1px solid var(--line); }
.pc.s0 { background: var(--surface); }
.pc.s1 { background: #e8a39b; color: #3b1712; }
.pc.s2 { background: var(--gold-soft); color: var(--ink); }
.pc.s3 { background: color-mix(in srgb, var(--emerald) 40%, var(--surface)); color: var(--ink); }
.pc.s4 { background: var(--emerald); color: #fff; }
.hzv { color: var(--ink-3); letter-spacing: .2em; }
.hzpv { cursor: pointer; }
.qr-page.firstword .qr-v .rest { color: transparent; background: var(--bg-2); border-radius: 8px; cursor: pointer; }
.qr-page.firstword .qr-v.shown .rest { color: inherit; background: none; }
html[data-rtheme="mosquee"] { --bg: #050807; --surface: #0b100e; --surface-2: #111816; --ink: #f3e7c6; --ink-2: #d8cba6; --ink-3: #9a917a; --line: #1d2a25; --emerald: #e8c886; }
html[data-rtheme="mosquee"] .qr-text { line-height: 2.6; }
html[data-rtheme="mosquee"] .nav, html[data-rtheme="mosquee"] .topbar { opacity: .25; }
.scrollbar-ctl { position: sticky; top: 64px; z-index: 5; background: color-mix(in srgb, var(--bg) 85%, transparent); padding: 6px; border-radius: 12px; }

/* ---------- l'arabe vivant : js/views/lire.js ---------- */
.lt-w.alt { border-bottom: 1px dotted var(--gold); }
.lt-w.unk { color: #c0702a; }
.arkb { margin-top: 8px; display: grid; gap: 4px; direction: rtl; }
.arkb .row { gap: 4px; justify-content: center; flex-wrap: nowrap; }
.kbk { flex: 1; min-width: 0; max-width: 46px; height: 42px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 1.25rem var(--f-ar); cursor: pointer; }
.kbk.wide { max-width: 220px; flex: 4; font: .85rem var(--f-body); }
.kbk:active { background: var(--emerald-soft); }

.qr-cmp { font-size: 1.35rem; line-height: 2.2; text-align: right; }
.qr-cmp mark { background: var(--gold-soft); color: var(--ink); border-radius: 4px; padding: 0 2px; }

/* ---------- études : js/views/etudes.js ---------- */
.sira-grid { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 14px; align-items: start; }
.sira-mapbox { position: sticky; top: 72px; }
@media (max-width: 760px) { .sira-grid { grid-template-columns: 1fr; } .sira-mapbox { position: static; } .smap { max-height: 360px; } }
.smap { width: 100%; height: auto; display: block; stroke: none; }
.smap .sea { fill: color-mix(in srgb, #4a90b8 22%, var(--surface)); stroke: color-mix(in srgb, #4a90b8 45%, var(--surface)); stroke-width: 1; }
.smap .sea-l { font-size: 10px; fill: #4a90b8; font-style: italic; transform-origin: center; }
.smap .spt circle { fill: var(--gold); stroke: var(--surface); stroke-width: 1.5; }
.smap .spt.on circle { fill: var(--emerald); }
.smap .spt text { font-size: 9.5px; fill: var(--ink); }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--gold-2); }
.tl-item { display: grid; grid-template-columns: 78px 1fr; gap: 8px; margin: 0 0 10px; position: relative; padding-left: 10px; }
.tl-item::before { content: ""; position: absolute; left: -7px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); }
.tl-date { padding-top: 6px; font-size: .9rem; }

/* ---------- qibla en réalité augmentée : js/views/qibla-ar.js ---------- */
.qar { position: relative; margin-top: 10px; border-radius: 20px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 70vh; }
.qar video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qar-hud { position: absolute; inset: 0; pointer-events: none; }
.qar-kaaba { position: absolute; top: 38%; transform: translateX(-50%); font-size: 3rem; text-align: center; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.qar-kaaba span { display: block; font-size: .8rem; color: #fff; font-weight: 700; }
.qar-arrow { position: absolute; top: 40%; left: 50%; margin-left: -1.5rem; font-size: 3rem; color: #e8c886; text-shadow: 0 2px 6px rgba(0,0,0,.7); transition: transform .2s; }
.qar-info { position: absolute; bottom: 12px; left: 12px; right: 12px; text-align: center; color: #fff; background: rgba(0,0,0,.55); border-radius: 12px; padding: 8px; font-weight: 600; }
.qar-info.ok { background: rgba(15,95,74,.85); }

/* ---------- accueil : invocation du moment et petites cartes (js/views/outils.js) ---------- */
#h-extras { align-items: start; margin-top: 12px; }
#h-extras .hx-wide { grid-column: 1 / -1; display: block; text-decoration: none; color: inherit; }
#h-extras .hx { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: inherit; text-align: left; }
#h-extras .hx > span:first-child { min-width: 0; }
#h-extras .hx-ar { flex: none; font-size: 1.5rem; white-space: nowrap; }
#h-extras .hx:last-child:nth-child(even) { grid-column: 1 / -1; }

.verse-meditate { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.verse-meditate:hover b { color: var(--emerald); }
.verse-meditate > span:first-child { min-width: 0; }
.verse-meditate .hx-ar { flex: none; font-size: 1.5rem; white-space: nowrap; }

/* ---------- jugement d'Ibn Ḥajar sur les rapporteurs (Taqrîb) ---------- */
:root { --r-ok: #1f7a54; --r-good: #2f7fa8; --r-mid: #b58a1b; --r-weak: #c0702a; --r-bad: #b33a3a; }
.isnad-tree .in.r-ok rect { stroke: var(--r-ok); stroke-width: 2.2; }
.isnad-tree .in.r-good rect { stroke: var(--r-good); stroke-width: 2.2; }
.isnad-tree .in.r-mid rect { stroke: var(--r-mid); stroke-width: 2.2; }
.isnad-tree .in.r-weak rect { stroke: var(--r-weak); stroke-width: 2.2; }
.isnad-tree .in.r-bad rect { stroke: var(--r-bad); stroke-width: 2.2; }
.isnad-line .chip.r-ok { border-color: var(--r-ok); } .isnad-line .chip.r-good { border-color: var(--r-good); }
.isnad-line .chip.r-mid { border-color: var(--r-mid); } .isnad-line .chip.r-weak { border-color: var(--r-weak); } .isnad-line .chip.r-bad { border-color: var(--r-bad); }
.rank-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; }
.rank-legend span { display: inline-flex; align-items: center; gap: 4px; }
.rank-legend i { width: 12px; height: 12px; border-radius: 3px; border: 2px solid; display: inline-block; }
.rank-legend i.r-ok { border-color: var(--r-ok); } .rank-legend i.r-good { border-color: var(--r-good); } .rank-legend i.r-mid { border-color: var(--r-mid); }
.rank-legend i.r-weak { border-color: var(--r-weak); } .rank-legend i.r-bad { border-color: var(--r-bad); }
.badge.rank.r-ok { background: color-mix(in srgb, var(--r-ok) 18%, transparent); } .badge.rank.r-good { background: color-mix(in srgb, var(--r-good) 18%, transparent); }
.badge.rank.r-mid { background: color-mix(in srgb, var(--r-mid) 22%, transparent); } .badge.rank.r-weak { background: color-mix(in srgb, var(--r-weak) 22%, transparent); }
.badge.rank.r-bad { background: color-mix(in srgb, var(--r-bad) 22%, transparent); }

.hd-he { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; }
.hd-he summary { cursor: pointer; color: var(--emerald); font-weight: 600; font-size: .92rem; }
.hd-he ul { margin: 4px 0; padding-left: 1.2em; }

/* L’arabe de tous les jours : séries repliables */
.dlg-serie { padding: 10px 14px; }
.dlg-serie > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.dlg-serie > summary::-webkit-details-marker { display: none; }
.dlg-serie > summary::before { content: '›'; color: var(--gold); transition: transform .15s; display: inline-block; }
.dlg-serie[open] > summary::before { transform: rotate(90deg); }
.dlg-serie[open] > summary { margin-bottom: 6px; }
