/* =====================================================================
   الشامل — feuille de style
   Thème inspiré de l'art islamique : émeraude des mosquées, or de
   l'enluminure (تذهيب), ivoire du parchemin ; mode nuit indigo/or.
   Motifs géométriques (étoile à huit branches), arcs de mihrab,
   cadres enluminés et cartouches de sourates.
   Toutes les classes utilisées par les scripts sont conservées.
   ===================================================================== */

@font-face {
    font-family: "KFGQPC Warsh";
    src: url("/fonts/warsh.10.woff2") format("woff2");
    font-display: swap;
}

/* ---------- Jetons : thème « نهار » (clair, parchemin) ---------- */
:root {
    color-scheme: light;
    --bg: #f3ecdc;
    --bg-2: #ebe2cc;
    --surface: #fffcf4;
    --surface-2: #f4ecd9;
    --border: #d9c9a3;
    --border-2: #c9b27c;
    --text: #1d2a25;
    --text-2: #46534d;
    --muted: #6f7a72;
    --accent: #0f5f4a;
    --accent-2: #167a5f;
    --accent-3: #0a4636;
    --accent-ink: #fbf6e6;
    --accent-soft: #e2efe8;
    --gold: #b6892c;
    --gold-2: #d4ae59;
    --gold-3: #ecd28e;
    --gold-4: #f8ecc7;
    --gold-ink: #3c2a05;
    --link: #0f5f4a;
    --hl: #fbf0c6;
    --mark: #e8c75f;
    --series-1: #167a5f;
    --series-1-hover: #b6892c;
    --grid: #e6dcc2;
    --page: #fffaea;
    --frame: #c9a85c;
    --pattern-ink: #0f5f4a;
    --pattern-alpha: .07;
    --ink-title: #0a4636;      /* cartouches, basmala, en-têtes de tableau */
    --ink-num: #0f5f4a;        /* numéros de versets */
    --hero-grad: linear-gradient(100deg, #0a4636 0%, #0f5f4a 45%, #b6892c 100%);
    --topbar-grad: linear-gradient(115deg, #0a4636 0%, #0f5f4a 45%, #124f43 100%);
    --shadow: 0 1px 2px rgb(60 40 0 / .06), 0 6px 20px -8px rgb(60 40 0 / .18);
    --shadow-lg: 0 2px 4px rgb(60 40 0 / .06), 0 20px 45px -18px rgb(30 60 40 / .35);
    --glow: 0 0 0 4px color-mix(in srgb, var(--gold) 22%, transparent);
    --qsize: 1.9rem;
    --radius: 14px;
    --radius-sm: 9px;
    --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
    --font-title: "Reem Kufi", "Amiri", "Noto Naskh Arabic", "Segoe UI", serif;
    --font-quran: "KFGQPC Warsh", "Amiri", "Traditional Arabic", serif;
    /* Arabe courant (hadith, adhkar, noms) : Amiri (Google Fonts), repli sur la police système. */
    --font-arabic: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", "Arabic Typesetting", "Segoe UI", "Geeza Pro", serif;
    --ok: #0f5f4a; --err: #b53a2b; --miss: #b26f00; --hint-c: #4f4fc9;
    /* Motifs SVG (encre remplaçable par mask) */
    --pat-star: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2264%22 height=%2264%22 viewBox=%220 0 64 64%22%3E%3Cpath fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.1%22 d=%22M22.63 0.00 L16.00 6.63 L16.00 16.00 L6.63 16.00 L0.00 22.63 L-6.63 16.00 L-16.00 16.00 L-16.00 6.63 L-22.63 0.00 L-16.00 -6.63 L-16.00 -16.00 L-6.63 -16.00 L-0.00 -22.63 L6.63 -16.00 L16.00 -16.00 L16.00 -6.63Z M86.63 0.00 L80.00 6.63 L80.00 16.00 L70.63 16.00 L64.00 22.63 L57.37 16.00 L48.00 16.00 L48.00 6.63 L41.37 0.00 L48.00 -6.63 L48.00 -16.00 L57.37 -16.00 L64.00 -22.63 L70.63 -16.00 L80.00 -16.00 L80.00 -6.63Z M22.63 64.00 L16.00 70.63 L16.00 80.00 L6.63 80.00 L0.00 86.63 L-6.63 80.00 L-16.00 80.00 L-16.00 70.63 L-22.63 64.00 L-16.00 57.37 L-16.00 48.00 L-6.63 48.00 L-0.00 41.37 L6.63 48.00 L16.00 48.00 L16.00 57.37Z M86.63 64.00 L80.00 70.63 L80.00 80.00 L70.63 80.00 L64.00 86.63 L57.37 80.00 L48.00 80.00 L48.00 70.63 L41.37 64.00 L48.00 57.37 L48.00 48.00 L57.37 48.00 L64.00 41.37 L70.63 48.00 L80.00 48.00 L80.00 57.37Z M54.63 32.00 L48.00 38.63 L48.00 48.00 L38.63 48.00 L32.00 54.63 L25.37 48.00 L16.00 48.00 L16.00 38.63 L9.37 32.00 L16.00 25.37 L16.00 16.00 L25.37 16.00 L32.00 9.37 L38.63 16.00 L48.00 16.00 L48.00 25.37Z%22/%3E%3C/svg%3E");
    --pat-rosette: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22%3E%3Cpath fill=%22%23000%22 d=%22M16 16 Q24.45 12.91 29.00 16.00 Q24.45 19.09 16 16ZM16 16 Q24.16 19.80 25.19 25.19 Q19.80 24.16 16 16ZM16 16 Q19.09 24.45 16.00 29.00 Q12.91 24.45 16 16ZM16 16 Q12.20 24.16 6.81 25.19 Q7.84 19.80 16 16ZM16 16 Q7.55 19.09 3.00 16.00 Q7.55 12.91 16 16ZM16 16 Q7.84 12.20 6.81 6.81 Q12.20 7.84 16 16ZM16 16 Q12.91 7.55 16.00 3.00 Q19.09 7.55 16 16ZM16 16 Q19.80 7.84 25.19 6.81 Q24.16 12.20 16 16Z%22/%3E%3Ccircle cx=%2216%22 cy=%2216%22 r=%223.2%22 fill=%22%23000%22/%3E%3C/svg%3E");
    --pat-star8: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22%3E%3Cpolygon fill=%22%23000%22 points=%2216.00,1.00 20.39,5.39 26.61,5.39 26.61,11.61 31.00,16.00 26.61,20.39 26.61,26.61 20.39,26.61 16.00,31.00 11.61,26.61 5.39,26.61 5.39,20.39 1.00,16.00 5.39,11.61 5.39,5.39 11.61,5.39%22/%3E%3C/svg%3E");
}

/* ---------- Thème « ليل » (nuit) : émeraude profond et or ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0b1512; --bg-2: #0e1b17;
        --surface: #12211c; --surface-2: #182d26;
        --border: #2a3f37; --border-2: #3f5a4c;
        --text: #f0e8d4; --text-2: #cbc2ab; --muted: #948f7c;
        --accent: #2fa284; --accent-2: #3fb896; --accent-3: #1f8a6c; --accent-ink: #07130f; --accent-soft: #163329;
        --gold: #d4ae59; --gold-2: #e5c677; --gold-3: #f1dca2; --gold-4: #3a2f14; --gold-ink: #1a1204;
        --link: #6ed0b2;
        --hl: #3b3216; --mark: #8f6f1f;
        --series-1: #3fb896; --series-1-hover: #e5c677;
        --grid: #24352e;
        --page: #131f1b; --frame: #7a6432;
        --pattern-ink: #d4ae59; --pattern-alpha: .05;
        --ink-title: #f1dca2; --ink-num: #e5c677;
        --hero-grad: linear-gradient(100deg, #f4dc9a, #d4ae59 50%, #6ed0b2);
        --topbar-grad: linear-gradient(115deg, #07110e 0%, #0d2019 55%, #0b1a15 100%);
        --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -8px rgb(0 0 0 / .6);
        --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 24px 50px -18px rgb(0 0 0 / .8);
        --ok: #6ed0b2; --err: #ff8574; --miss: #f0b04a; --hint-c: #a3a3ff;
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1512; --bg-2: #0e1b17;
    --surface: #12211c; --surface-2: #182d26;
    --border: #2a3f37; --border-2: #3f5a4c;
    --text: #f0e8d4; --text-2: #cbc2ab; --muted: #948f7c;
    --accent: #2fa284; --accent-2: #3fb896; --accent-3: #1f8a6c; --accent-ink: #07130f; --accent-soft: #163329;
    --gold: #d4ae59; --gold-2: #e5c677; --gold-3: #f1dca2; --gold-4: #3a2f14; --gold-ink: #1a1204;
    --link: #6ed0b2;
    --hl: #3b3216; --mark: #8f6f1f;
    --series-1: #3fb896; --series-1-hover: #e5c677;
    --grid: #24352e;
    --page: #131f1b; --frame: #7a6432;
    --pattern-ink: #d4ae59; --pattern-alpha: .05;
    --ink-title: #f1dca2; --ink-num: #e5c677;
    --hero-grad: linear-gradient(100deg, #f4dc9a, #d4ae59 50%, #6ed0b2);
    --topbar-grad: linear-gradient(115deg, #07110e 0%, #0d2019 55%, #0b1a15 100%);
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -8px rgb(0 0 0 / .6);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 24px 50px -18px rgb(0 0 0 / .8);
    --ok: #6ed0b2; --err: #ff8574; --miss: #f0b04a; --hint-c: #a3a3ff;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
/* L'attribut hidden l'emporte sur les display des composants (boutons en inline-flex…). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

body {
    margin: 0; min-height: 100vh;
    background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 16px; line-height: 1.55;
    position: relative;
}
/* Motif géométrique en filigrane, coloré par le thème. */
body::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-color: var(--pattern-ink); opacity: var(--pattern-alpha);
    -webkit-mask-image: var(--pat-star); mask-image: var(--pat-star);
    -webkit-mask-size: 64px 64px; mask-size: 64px 64px;
}

a { color: var(--link); text-decoration: none; transition: color .15s; }
a:hover { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-title); font-weight: 600; letter-spacing: .01em; color: var(--text); }
h1 { font-size: 1.75rem; margin: 0 0 .3rem; line-height: 1.25; }
h2 { font-size: 1.25rem; margin: 2rem 0 .6rem; display: flex; align-items: center; gap: .6rem; }
/* Filet doré après les titres de section */
h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(to var(--h2-dir, right), var(--border-2), transparent); opacity: .8; }
[dir=rtl] h2::after { --h2-dir: left; }
h2 > * { flex: none; }

.muted { color: var(--muted); margin: .25rem 0; }
.ar { font-family: var(--font-arabic); font-size: 1.15em; }
.quran { font-family: var(--font-quran); }

/* Séparateur enluminé : ligne ─◆─ */
.ornament { display: flex; align-items: center; justify-content: center; gap: .6rem; margin: .9rem auto; color: var(--gold); max-width: 20rem; }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(to right, transparent, var(--gold), transparent); }
.ornament span { width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--pat-star8) center/contain no-repeat; mask: var(--pat-star8) center/contain no-repeat; }

/* ---------- En-tête ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: .55rem 1.1rem;
    color: var(--gold-4);
    background: var(--topbar-grad);
    border-bottom: 1px solid var(--gold);
    box-shadow: inset 0 -4px 0 #0a4636, inset 0 -5px 0 color-mix(in srgb, var(--gold) 65%, transparent), 0 6px 24px -10px rgb(0 0 0 / .5);
    position: sticky; top: 0; z-index: 10;
}
/* Filigrane doré dans la barre */
.topbar::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .16;
    background-color: var(--gold-3);
    -webkit-mask-image: var(--pat-star); mask-image: var(--pat-star); -webkit-mask-size: 48px 48px; mask-size: 48px 48px;
}
.topbar > * { position: relative; }
.brand { display: flex; align-items: center; gap: .7rem; color: inherit; line-height: 1.1; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 46px; height: 46px; flex-shrink: 0; filter: drop-shadow(0 2px 4px rgb(0 0 0 / .35)); transition: transform .3s; }
.brand:hover .brand-logo { transform: rotate(-6deg) scale(1.05); }
.brand-text { display: flex; flex-direction: column; }
/* Nom de l'application : Reem Kufi, doré */
.brand-ar {
    font-family: var(--font-title); font-weight: 600; font-size: 1.7rem; line-height: 1.15;
    background: linear-gradient(100deg, #f4dc9a 0%, #d4ae59 40%, #f8ecc7 60%, #c99a3a 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: sheen 9s linear infinite;
}
@keyframes sheen { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
.brand-sub { font-size: .74rem; color: color-mix(in srgb, var(--gold-3) 80%, #fff); letter-spacing: .06em; opacity: .9; }
.nav { display: flex; gap: .2rem; align-items: center; margin-inline-start: auto; }
.nav-extra { display: flex; gap: .3rem; align-items: center; }
.nav a {
    padding: .45rem .95rem; border-radius: 999px; color: #f3ead2; font-weight: 500;
    border: 1px solid transparent; transition: background .2s, border-color .2s, color .2s;
}
.nav a:hover { text-decoration: none; background: rgb(255 255 255 / .09); border-color: rgb(255 255 255 / .12); }
.nav a.active { background: color-mix(in srgb, var(--gold) 92%, #fff); color: var(--gold-ink); border-color: var(--gold-3); box-shadow: 0 2px 10px -2px rgb(0 0 0 / .4), inset 0 1px 0 rgb(255 255 255 / .35); }
.nav a.active:hover { background: var(--gold-2); }
.lang-menu { display: inline-flex; gap: .25rem; margin-inline-start: .4rem; }
.lang-menu .lang-switch { margin: 0; padding: .35rem .6rem; font-size: .85rem; font-family: var(--font-ui); letter-spacing: .04em; }
.lang-switch { padding: .4rem .9rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--gold-2) 70%, transparent); margin-inline-start: .4rem; color: var(--gold-3); font-weight: 500; }
.lang-switch:hover { text-decoration: none; background: color-mix(in srgb, var(--gold) 25%, transparent); }

/* Bascule clair / nuit */
.theme-btn {
    width: 2.35rem; height: 2.35rem; min-height: 0; padding: 0; border-radius: 50%; justify-content: center;
    background: rgb(255 255 255 / .08); border: 1px solid color-mix(in srgb, var(--gold-2) 55%, transparent); color: var(--gold-3);
    font-size: 1.05rem; line-height: 1; margin-inline-start: .3rem;
}
.theme-btn:hover { background: color-mix(in srgb, var(--gold) 25%, transparent); border-color: var(--gold-2); }
.theme-btn .ico-moon { display: none; }
:root[data-theme="dark"] .theme-btn .ico-moon { display: inline; }
:root[data-theme="dark"] .theme-btn .ico-sun { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-btn .ico-moon { display: inline; }
    :root:not([data-theme="light"]) .theme-btn .ico-sun { display: none; }
}

.container { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 2rem; animation: rise .5s ease-out both; }
/* Fondu seulement : un transform ferait du <main> le bloc conteneur des éléments fixes (lecteur, tiroir). */
@keyframes rise { from { opacity: 0; } to { opacity: 1; } }

.footer {
    text-align: center; color: var(--muted); font-size: .82rem; padding: 1.2rem 1rem 2.4rem; position: relative;
    border-top: 1px solid var(--border);
    background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--accent) 6%, transparent));
}

/* ---------- Contrôles ---------- */
.toolbar {
    display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: .8rem .9rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.picker { display: flex; gap: .4rem; align-items: flex-end; margin: 0; }
.picker label, .search-options label { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); gap: .2rem; letter-spacing: .02em; }
.picker.inline { flex-wrap: wrap; margin-bottom: .5rem; }
select, input, textarea, button {
    font: inherit; font-size: .95rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    padding: .4rem .6rem; min-height: 2.35rem;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: var(--glow); }
select { max-width: 17rem; }
input[type=number] { width: 6rem; }
button, .btn {
    cursor: pointer; display: inline-flex; align-items: center; gap: .35rem;
    background: linear-gradient(to bottom, var(--surface), var(--surface-2)); color: var(--text); border: 1px solid var(--border-2);
    border-radius: var(--radius-sm); padding: .4rem .85rem; min-height: 2.35rem; font-weight: 500;
    box-shadow: 0 1px 0 rgb(255 255 255 / .5) inset, 0 1px 2px rgb(60 40 0 / .08);
    transition: border-color .15s, box-shadow .15s, transform .15s, background .15s;
}
.btn:hover, button:hover { text-decoration: none; border-color: var(--gold); box-shadow: var(--glow); }
.btn:active, button:active { transform: translateY(1px); }
button.primary, .btn.primary {
    background: linear-gradient(to bottom, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: var(--accent-3);
    box-shadow: 0 1px 0 rgb(255 255 255 / .18) inset, 0 3px 10px -3px color-mix(in srgb, var(--accent) 70%, transparent);
}
button.primary:hover, .btn.primary:hover { border-color: var(--gold); box-shadow: var(--glow), 0 3px 10px -3px color-mix(in srgb, var(--accent) 70%, transparent); }
/* Sélecteur d'état enfoncé (partagé par les lecteurs, la récitation, la traduction…) */
button[aria-pressed=true], .btn[aria-pressed=true] { background: linear-gradient(to bottom, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: var(--accent-3); }

.alert { background: var(--hl); border: 1px solid var(--mark); border-inline-start: 4px solid var(--gold); padding: .6rem .9rem; border-radius: var(--radius-sm); }
.empty { color: var(--muted); padding: 1rem 0; text-align: center; font-style: italic; }
.hint { font-size: .85rem; color: var(--muted); margin: .5rem 0 0; }

/* Cartes génériques (fond parchemin, filet doré) */
.card, .reader, .th-rec, .plan-form, .plan-today, .plan-strip, .mk-panel, .adhan-set, .search-form, .rd-nav, .chart, .table-wrap, .extremes > div, .results li, .hd, .adk, .tile, .time-card, .next-prayer {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------- Lecture ---------- */
.reader-head, .stats-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.reader-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.size-ctl { display: inline-flex; gap: .25rem; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: .9rem 0; }

.reader { padding: 1.4rem 1.6rem; position: relative; }
.surah-head { text-align: center; margin: 1rem 0 1.25rem; }
.surah-head:first-child { margin-top: 0; }
/* Cartouche de sourate, à la manière des en-têtes enluminés du mushaf */
.surah-title {
    font-size: calc(var(--qsize) * .95);
    color: var(--ink-title);
    background: linear-gradient(to bottom, var(--gold-4), color-mix(in srgb, var(--gold-3) 45%, var(--surface)));
    border: 1px solid var(--gold); border-radius: 999px;
    box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px var(--gold-2), 0 2px 8px -3px rgb(60 40 0 / .3);
    padding: .25rem 2.4rem; display: inline-block; min-width: 60%; position: relative;
}
.surah-title::before, .surah-title::after {
    content: ""; position: absolute; top: 50%; width: 16px; height: 16px; transform: translateY(-50%);
    background: var(--gold); -webkit-mask: var(--pat-rosette) center/contain no-repeat; mask: var(--pat-rosette) center/contain no-repeat;
}
.surah-title::before { inset-inline-start: .8rem; }
.surah-title::after { inset-inline-end: .8rem; }
.surah-meta { color: var(--muted); font-size: .8rem; margin-top: .35rem; }
.basmala { font-size: var(--qsize); margin-top: .5rem; color: var(--ink-title); }
.surah-cont { color: var(--muted); font-size: .85rem; text-align: center; margin: .25rem 0 .75rem; }

.verses { font-size: var(--qsize); line-height: 2.25; }
.reader-flow .verses { text-align: justify; text-align-last: center; }
.aya { border-radius: 6px; padding: 0 .1em; scroll-margin-top: 6rem; transition: background .25s; }
.aya.hl { background: var(--hl); box-shadow: 0 0 0 2px var(--mark); }
.aya.sajda .num { color: var(--gold); }
.num { color: var(--ink-num); white-space: nowrap; }

.reader-list .aya { display: block; padding: .5rem .25rem; border-bottom: 1px solid var(--grid); }
.reader-list .aya:last-child { border-bottom: 0; }
.reader-list .ref { float: left; font-family: var(--font-ui); font-size: .78rem; line-height: 2; color: var(--muted); }

/* ---------- Recherche ---------- */
.search-form { padding: 1rem; margin-bottom: 1rem; }
.search-main { display: flex; gap: .5rem; }
.search-main input { flex: 1; min-width: 0; }
.quran-input { font-family: var(--font-quran); font-size: 1.5rem; }
.search-options { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .75rem; }

.results { list-style: none; padding: 0; margin: 0; }
.results li { padding: .7rem 1rem; margin-bottom: .7rem; border-inline-start: 3px solid var(--gold-2); }
.result-ref { display: flex; gap: .75rem; flex-wrap: wrap; align-items: baseline; font-size: .9rem; }
.result-ref a { font-weight: 600; }
.result-text { font-size: calc(var(--qsize) * .8); line-height: 2.1; margin: .25rem 0 0; }
mark { background: var(--mark); color: inherit; border-radius: 4px; padding: 0 .08em; }

/* ---------- Tuiles (chiffres clés) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin: .75rem 0 1rem; }
.tile { padding: .75rem 1rem; display: flex; flex-direction: column; color: var(--text); position: relative; overflow: hidden; }
.tile-value { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--accent); font-family: var(--font-title); }
.tile-value.ar { font-family: var(--font-arabic); font-weight: 500; }
.tile-label { font-size: .78rem; color: var(--muted); letter-spacing: .02em; }

/* ---------- Graphiques ---------- */
.chart { padding: .9rem 1rem; margin: 0 0 1rem; }
.chart figcaption { display: flex; flex-direction: column; margin-bottom: .4rem; }
.chart-title { font-weight: 600; font-family: var(--font-title); }
.chart-sub { font-size: .8rem; color: var(--muted); }
.chart-scroll { overflow-x: auto; }
.chart-svg { display: block; width: 100%; height: auto; }
.chart-columns { min-width: 640px; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .baseline { stroke: var(--muted); stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 12px; font-family: var(--font-ui); }
.chart-svg .mark { fill: var(--series-1); }
.chart-svg .hit { fill: transparent; }
.chart-svg .bar:hover .mark { fill: var(--series-1-hover); }
.chart-svg .bar:hover .hit { fill: var(--surface-2); }
.chart-svg .bar-link.nolink { pointer-events: auto; cursor: default; }
.chart-svg .value { fill: var(--text-2); font-size: 12px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.chart-svg .row-label { fill: var(--text); font-size: 13px; font-family: var(--font-ui); }
.chart-svg .row-label.ar { font-family: var(--font-arabic); font-size: 16px; }
.chart-rows { max-width: 480px; }

/* ---------- Tableaux ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.two-col h2 { margin-top: 0; }
.table-wrap { overflow-x: auto; max-height: 34rem; overflow-y: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .4rem .65rem; border-bottom: 1px solid var(--grid); text-align: start; }
table.data th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; white-space: nowrap; color: var(--ink-title); box-shadow: inset 0 -1px 0 var(--border-2); }
table.data tbody tr:hover { background: color-mix(in srgb, var(--gold) 7%, transparent); }
table.sortable th { cursor: pointer; user-select: none; }
table.sortable th[aria-sort=ascending]::after { content: " ▲"; font-size: .7em; color: var(--gold); }
table.sortable th[aria-sort=descending]::after { content: " ▼"; font-size: .7em; color: var(--gold); }
table.data .num { text-align: end; font-variant-numeric: tabular-nums; }
table.data td.ar { font-size: 1.2rem; }

.extremes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }
.extremes > div { padding: .7rem .9rem; display: flex; flex-direction: column; }
.exports { display: flex; flex-wrap: wrap; gap: .5rem; }

@media (max-width: 760px) {
    .container { padding: .8rem .75rem 1.5rem; }
    .two-col { grid-template-columns: 1fr; }
    .reader { padding: 1rem .8rem; }
    :root { --qsize: 1.6rem; }
    select { max-width: 100%; }
    .toolbar .picker { flex: 1 1 45%; }
    .toolbar .picker label { flex: 1; }
    .toolbar select, .toolbar input[type=text] { width: 100%; }
}

/* ---------- Lecteur audio ---------- */
.num[role=button] { cursor: pointer; border-radius: 50%; transition: background .15s, box-shadow .15s; }
.num[role=button]:hover, .num[role=button]:focus-visible { background: color-mix(in srgb, var(--gold) 22%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 45%, transparent); outline: none; }
.aya.playing { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 55%, transparent); }
body:has(.player:not([hidden])) .footer { padding-bottom: 6.5rem; }
.player {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem 1rem;
    padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--gold);
    box-shadow: 0 -8px 30px rgb(0 0 0 / .12), inset 0 1px 0 color-mix(in srgb, var(--gold-3) 60%, transparent);
}
.player[hidden] { display: none; }
.pl-buttons { display: flex; gap: .35rem; align-items: center; }
.pl-buttons button { min-width: 2.6rem; justify-content: center; font-size: 1.05rem; }
#pl-play { min-width: 3.4rem; border-radius: 999px; }
.pl-status { font-size: .85rem; color: var(--muted); min-width: 12rem; text-align: center; font-variant-numeric: tabular-nums; }
#pl-reciter { max-width: 21rem; }
@media (max-width: 760px) {
    .player { gap: .4rem; padding: .45rem .5rem calc(.45rem + env(safe-area-inset-bottom)); }
    #pl-reciter { flex: 1 1 100%; max-width: none; }
    .pl-status { flex: 1 1 100%; min-width: 0; }
}

/* ---------- Arabe / droite à gauche ---------- */
html[lang=ar] body { font-family: "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, system-ui, sans-serif; font-size: 17px; }
html[lang=ar] .brand-sub { font-size: .8rem; letter-spacing: 0; }
/* Les graphiques et les commandes de lecture restent orientés de gauche à droite. */
.chart-scroll, .chart-svg, .pl-buttons { direction: ltr; }
.chart figcaption { text-align: start; }
[dir=rtl] .reader-list .ref { float: left; }

/* ---------- Récitation (تسميع) ---------- */
.rec-bar {
    position: sticky; top: var(--topbar-h, 68px); z-index: 5;
    display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; align-items: center;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: .6rem .8rem; margin-bottom: 1rem;
}
.rec-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
#rec-start.recording { background: linear-gradient(to bottom, #d0463a, #b53a2b); border-color: #8f2a1f; color: #fff; animation: rec-pulse 1.6s ease-in-out infinite; }
@keyframes rec-pulse { 50% { box-shadow: 0 0 0 8px rgb(181 58 43 / .18); } }
.rec-meter { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.rec-progress, .adk-bar, .th-meter, .plan-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgb(0 0 0 / .08); }
.rec-progress span, .adk-bar span, .th-meter span, .plan-bar span { display: block; height: 100%; width: 0; background: linear-gradient(to right, var(--accent), var(--gold-2)); transition: width .3s; }
.rec-counts { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .85rem; color: var(--text-2); }
.rec-counts b { font-variant-numeric: tabular-nums; }
.rec-status { grid-column: 1 / -1; font-size: .9rem; min-height: 1.4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-heard { font-family: var(--font-arabic); color: var(--text-2); }

.rec-text .w { border-radius: 4px; transition: color .25s, background .25s; }
/* Texte masqué : le mot garde sa largeur réelle mais reste invisible. */
.rec-text.masked .w:not(.ok):not(.wrong):not(.missed):not(.hint) { color: transparent; background: var(--surface-2); }
.rec-text.masked.peek .w:not(.ok):not(.wrong):not(.missed):not(.hint) { color: var(--muted); background: transparent; opacity: .45; }
.rec-text .w.cur { box-shadow: 0 0 0 2px var(--gold); }
.rec-text .w.ok { color: var(--text); }
.rec-text .w.wrong { color: var(--err); text-decoration: underline wavy var(--err); text-underline-offset: .35em; }
.rec-text .w.missed { color: var(--miss); text-decoration: underline dotted var(--miss); text-underline-offset: .35em; }
.rec-text .w.hint { color: var(--hint-c); }
.c-ok b { color: var(--ok); } .c-wrong b { color: var(--err); } .c-missed b { color: var(--miss); } .c-hint b { color: var(--hint-c); }
.rec-summary h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.rec-summary td.quran { font-size: 1.4rem; }
@media (max-width: 760px) { .rec-bar { grid-template-columns: 1fr; } }

/* Menu : 4 entrées + langue + thème, doit tenir sur mobile (marque et extras sur la 1re ligne, menu sur la 2e). */
.nav { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
    .topbar { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: .45rem .6rem .35rem; gap: .3rem .5rem; }
    .brand-logo { width: 38px; height: 38px; }
    .brand-ar { font-size: 1.45rem; }
    .brand { grid-row: 1; grid-column: 1; }
    .nav-extra { grid-row: 1; grid-column: 2; justify-content: flex-end; }
    .nav { grid-row: 2; grid-column: 1 / -1; gap: .15rem; width: 100%; justify-content: space-between; flex-wrap: nowrap; margin: 0; }
    .nav a { padding: .4rem .5rem; font-size: .92rem; flex: 1; text-align: center; }
    .lang-switch { margin-inline-start: 0; padding: .35rem .7rem; font-size: .9rem; }
    .theme-btn { width: 2.1rem; height: 2.1rem; }
}

/* ---------- Mushaf : pages ligne par ligne, cadre enluminé ---------- */
.mushaf {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 1.4rem;
    direction: rtl;               /* page impaire à droite, comme un mushaf ouvert */
}
.mp {
    flex: 0 1 calc(var(--qsize) * 17.5); min-width: 0;   /* A− / A+ changent la taille des pages */
    background: var(--page); color: var(--text);
    border: 1px solid var(--frame); border-radius: 8px;
    box-shadow:
        inset 0 0 0 5px var(--page),
        inset 0 0 0 6px var(--frame),
        inset 0 0 0 9px var(--page),
        inset 0 0 0 10px color-mix(in srgb, var(--frame) 55%, transparent),
        var(--shadow-lg);
    padding: 1.25rem 1.6rem .8rem;
    scroll-margin-top: 5rem; position: relative;
}
/* Rosettes d'angle */
.mp::before, .mp::after, .mp .mp-body::before, .mp .mp-body::after {
    content: ""; position: absolute; width: 22px; height: 22px; background: var(--frame); opacity: .9;
    -webkit-mask: var(--pat-rosette) center/contain no-repeat; mask: var(--pat-rosette) center/contain no-repeat; pointer-events: none;
}
.mp::before { top: 2px; left: 2px; } .mp::after { top: 2px; right: 2px; }
.mp .mp-body { position: static; }
.mp .mp-body::before { bottom: 2px; left: 2px; } .mp .mp-body::after { bottom: 2px; right: 2px; }
.mp-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
    font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--frame); padding-bottom: .2rem; margin-bottom: .4rem; }
.mp-head .quran { font-size: 1.05rem; color: var(--ink-title); }
.mp-meta { color: var(--muted); }
.mp-body { container-type: inline-size; }
.ml {
    /* Taille calculée pour qu'une ligne pleine occupe toute la largeur de la page. */
    font-size: calc(100cqi / var(--mw) * var(--k, 1) * .975);
    line-height: 2.05; height: calc(100cqi / var(--mw) * 2.05);
    white-space: nowrap; overflow: visible;
    text-align: justify; text-align-last: justify;
}
.ml-center { text-align: center; text-align-last: center; }
.ml-title, .ml-basmala { text-align: center; text-align-last: center; display: flex; align-items: center; justify-content: center; }
/* Cartouche de sourate dans la page du mushaf */
.ml-title span {
    display: block; width: 100%;
    font-size: calc(100cqi / var(--mw) * .9); line-height: 1.6;
    color: var(--ink-title);
    border: 1px solid var(--frame); border-radius: 999px;
    background: linear-gradient(to bottom, color-mix(in srgb, var(--frame) 30%, var(--page)), color-mix(in srgb, var(--frame) 14%, var(--page)));
    box-shadow: inset 0 0 0 2px var(--page), inset 0 0 0 3px var(--frame);
}
.ml-basmala { font-size: calc(100cqi / var(--mw)); }
/* Pages 1 et 2 : encadrement d'ouverture (الفاتحة et début البقرة) */
.mp-opening .mp-body { padding: 8% 12%; }
.mp-opening .ml { text-align: center; text-align-last: center; }
.mp-opening .ml:not(.ml-title) { font-size: calc(100cqi / var(--mw) * 1.3); height: calc(100cqi / var(--mw) * 2.6); }
.mp-opening {
    background:
        radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--frame) 22%, transparent), transparent 55%),
        radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--frame) 22%, transparent), transparent 55%),
        var(--page);
}
.mp-foot { text-align: center; font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.mushaf .aya { padding: 0; border-radius: 3px; }
.mushaf .aya.out { opacity: .38; }
.mushaf .num { color: var(--ink-num); }
@media (max-width: 760px) {
    .mp { padding: .8rem .7rem .5rem; box-shadow: inset 0 0 0 3px var(--page), inset 0 0 0 4px var(--frame); }
    .mp::before, .mp::after, .mp .mp-body::before, .mp .mp-body::after { display: none; }
    .mushaf { gap: .75rem; }
}
.mushaf .aya.hl { box-shadow: none; }
.mushaf .aya.playing { box-shadow: none; }

/* ---------- Rubriques (onglets de la section Coran) ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: .2rem; margin: -.25rem 0 1.1rem; border-bottom: 1px solid var(--border-2); }
.subnav a { padding: .55rem .9rem; color: var(--text-2); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; transition: color .15s, border-color .15s; }
.subnav a:hover { text-decoration: none; color: var(--accent); border-bottom-color: var(--border-2); }
.subnav a.active { color: var(--accent); border-bottom-color: var(--gold); font-weight: 600; }
@media (max-width: 600px) {
    .subnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .subnav::-webkit-scrollbar { display: none; }
    .subnav a { white-space: nowrap; padding: .5rem .7rem; }
}

/* ---------- Accueil ---------- */
.home-hero { text-align: center; padding: 1.2rem 0 .4rem; position: relative; }
/* Halo doré derrière le médaillon */
.home-hero::before {
    content: ""; position: absolute; left: 50%; top: 1.2rem; width: 360px; height: 360px; transform: translate(-50%, -25%); z-index: -1; pointer-events: none;
    background: radial-gradient(circle, color-mix(in srgb, var(--gold-3) 55%, transparent) 0%, color-mix(in srgb, var(--gold-2) 18%, transparent) 35%, transparent 70%);
}
.home-hero .hero-logo { width: 132px; height: 132px; filter: drop-shadow(0 10px 22px rgb(15 95 74 / .35)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.home-bismillah { font-family: var(--font-quran); font-size: 1.7rem; color: var(--ink-title); margin: 0 0 .4rem; letter-spacing: .01em; }
.home-title {
    font-family: var(--font-title); font-weight: 600; font-size: 3.4rem; line-height: 1.2; margin: .3rem 0 0;
    background: var(--hero-grad);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.home-hero .muted { font-size: 1.05rem; }
/* Cartes en arc de mihrab */
.home-tiles { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.2rem; margin: 1.6rem 0 1rem; }
/* Tuiles de navigation (liens) : plus hautes que les tuiles de chiffres */
.tiles:has(a.tile) { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin: 1.5rem 0 1rem; }
a.tile { gap: .45rem; min-height: 9.5rem; padding: 1.1rem 1.2rem; transition: transform .25s, box-shadow .25s, border-color .25s; }
a.tile:hover { text-decoration: none; border-color: var(--gold); transform: translateY(-3px); box-shadow: var(--shadow-lg), var(--glow); }
.tile-title { display: flex; align-items: center; gap: .55rem; font-size: 1.3rem; font-weight: 600; font-family: var(--font-title); color: var(--accent); }
.tile-icon { width: 28px; height: 28px; flex-shrink: 0; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile-text { color: var(--text-2); font-size: .95rem; }
.tile-extra { margin-top: auto; padding-top: .45rem; border-top: 1px dashed var(--border-2); font-size: .9rem; color: var(--text); }
.badge { font-size: .75rem; font-weight: 400; padding: .05rem .55rem; border-radius: 999px; background: var(--gold-4); color: var(--gold-ink); border: 1px solid var(--gold-2); }
/* Accueil : tuile en arc (mihrab) */
.home-tiles .tile {
    align-items: center; text-align: center; padding: 2.2rem 1.3rem 1.2rem; min-height: 15rem;
    border-radius: 999px 999px var(--radius) var(--radius);
    border: 1px solid var(--border-2);
    background:
        radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--gold-3) 35%, transparent), transparent 60%),
        var(--surface);
    box-shadow: inset 0 0 0 5px var(--surface), inset 0 0 0 6px color-mix(in srgb, var(--gold-2) 80%, transparent), var(--shadow);
    position: relative; overflow: visible;
}
.home-tiles .tile::before {
    content: ""; position: absolute; top: -9px; left: 50%; width: 18px; height: 18px; transform: translateX(-50%);
    background: var(--gold); -webkit-mask: var(--pat-star8) center/contain no-repeat; mask: var(--pat-star8) center/contain no-repeat;
    filter: drop-shadow(0 1px 1px rgb(0 0 0 / .3));
}
.home-tiles .tile:hover { box-shadow: inset 0 0 0 5px var(--surface), inset 0 0 0 6px var(--gold), var(--shadow-lg), var(--glow); }
.home-tiles .tile-title { flex-direction: column; gap: .7rem; font-size: 1.55rem; }
.home-tiles .tile-icon {
    width: 64px; height: 64px; padding: 14px; border-radius: 50%; stroke-width: 1.6;
    background: linear-gradient(145deg, var(--accent-2), var(--accent-3)); stroke: var(--gold-3);
    box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold-2), 0 8px 18px -8px rgb(0 0 0 / .5);
    transition: transform .3s;
}
.home-tiles .tile:hover .tile-icon { transform: scale(1.06) rotate(-4deg); }
.home-tiles .tile-extra { width: 100%; }
/* Bandeau « prochaine prière » de l'accueil */
.home-next {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem 1rem; margin: 1.25rem auto 0; max-width: 46rem;
    padding: .7rem 1.2rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 9%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); color: var(--text-2); font-size: .98rem;
}
.home-next b { color: var(--accent); font-family: var(--font-title); font-size: 1.15rem; }
.home-next .clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--gold); }

/* ---------- Horaires des prières ---------- */
.day-header { text-align: center; margin: .5rem 0 1rem; }
.day-header .date { color: var(--muted); margin: .2rem 0 0; }
.day-header .hijri { font-family: var(--font-arabic); font-size: 1.25rem; margin: .1rem 0 0; color: var(--accent); }
.next-prayer {
    text-align: center; padding: 1.2rem 1rem 1.3rem; margin-bottom: 1.2rem; position: relative; overflow: hidden;
    background:
        radial-gradient(60% 120% at 50% 0%, color-mix(in srgb, var(--gold-3) 40%, transparent), transparent 70%),
        linear-gradient(to bottom, var(--surface), var(--surface-2));
    border-color: var(--border-2);
    box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 5px color-mix(in srgb, var(--gold-2) 70%, transparent), var(--shadow);
}
.next-prayer::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .07; background-color: var(--accent);
    -webkit-mask-image: var(--pat-star); mask-image: var(--pat-star); -webkit-mask-size: 48px 48px; mask-size: 48px 48px;
}
.next-prayer > * { position: relative; }
.next-prayer strong { color: var(--accent); font-family: var(--font-title); font-size: 1.15em; }
.next-prayer .countdown {
    font-size: 2.8rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: .25rem; letter-spacing: .04em;
    background: linear-gradient(to bottom, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.times { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .9rem; }
.time-card {
    padding: 1.4rem .8rem 1rem; text-align: center; position: relative;
    border-radius: 999px 999px var(--radius) var(--radius);
    box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 5px color-mix(in srgb, var(--border-2) 70%, transparent), var(--shadow);
    transition: transform .25s, box-shadow .25s;
}
.time-card:hover { transform: translateY(-2px); }
.time-card .name { font-weight: 600; font-size: 1.15rem; font-family: var(--font-title); color: var(--accent); }
.time-card .alt { color: var(--muted); font-size: .82rem; }
.time-card .clock { font-size: 1.9rem; font-weight: 700; margin-top: .35rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.time-card.active {
    border-color: var(--gold);
    background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--gold-3) 45%, transparent), transparent 60%), linear-gradient(to bottom, var(--accent-2), var(--accent-3));
    color: var(--accent-ink);
    box-shadow: inset 0 0 0 4px var(--accent-3), inset 0 0 0 5px var(--gold-2), var(--shadow-lg), var(--glow);
}
.time-card.active .name { color: var(--gold-3); }
.time-card.active .alt { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
.time-card.active .clock { color: #fff; }
.time-card.muted .clock { color: var(--muted); font-weight: 500; }
.adan-links { text-align: center; margin-top: 1.5rem; }
.adan-method { text-align: center; font-size: .85rem; }
.month-nav { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.month-nav h1 { font-size: 1.2rem; margin: 0; text-align: center; }
.month-wrap { max-height: none; }
table.month th, table.month td { text-align: center; white-space: nowrap; }
table.month tr.today { background: var(--hl); font-weight: 700; box-shadow: inset 3px 0 0 var(--gold); }
table.month td.t { font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
    .home-title { font-size: 2.6rem; }
    .home-hero .hero-logo { width: 104px; height: 104px; }
    .home-bismillah { font-size: 1.4rem; }
    .home-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
    .home-tiles .tile { min-height: 0; padding: 1.7rem .7rem .9rem; border-radius: 120px 120px var(--radius) var(--radius); }
    .home-tiles .tile-title { font-size: 1.25rem; gap: .5rem; }
    .home-tiles .tile-icon { width: 52px; height: 52px; padding: 11px; }
    .home-tiles .tile-text { font-size: .85rem; }
    .home-tiles .tile-extra { font-size: .8rem; }
    .home-next { font-size: .9rem; padding: .6rem 1rem; border-radius: var(--radius); }
    .month-nav { flex-wrap: wrap; justify-content: center; }
    .month-nav h1 { order: -1; flex-basis: 100%; }
}

/* ---------- Adhkar ---------- */
.adk-suggest {
    display: inline-block; margin: .75rem 0 .25rem; padding: .7rem 1.3rem; border-radius: 999px;
    background: linear-gradient(to bottom, var(--accent-2), var(--accent)); color: var(--accent-ink); font-weight: 600;
    border: 1px solid var(--accent-3); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold-2), 0 6px 16px -6px rgb(0 0 0 / .4);
    transition: transform .2s, box-shadow .2s;
}
.adk-suggest:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold), 0 10px 22px -8px rgb(0 0 0 / .45); }
.adk-tiles { margin-top: .5rem; }
.adk-tiles .tile { min-height: 7rem; border-inline-start: 4px solid var(--gold-2); }
.adk-filter { width: 100%; max-width: 26rem; margin-bottom: .75rem; }
.adk-cats { columns: 3 16rem; column-gap: 2rem; padding: 0; margin: 0; list-style: none; font-family: var(--font-arabic); font-size: 1.1rem; }
.adk-cats li { break-inside: avoid; padding: .22rem 0; }
.adk-cats li::before { content: "◆"; font-size: .5em; color: var(--gold); margin-inline-end: .5em; vertical-align: middle; }
.adk-back { margin: 0 0 .25rem; }
.adk-status { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: .75rem 0 1rem; color: var(--text-2); }
.adk-bar { flex: 1 1 8rem; height: 6px; }
.adk-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1rem; counter-reset: adk; }
.adk { padding: 1.1rem 1.2rem .8rem; transition: opacity .3s, border-color .3s; border-inline-start: 4px solid var(--gold-2); }
.adk.done { opacity: .55; border-color: var(--accent); border-inline-start-color: var(--accent); }
.adk-text { font-family: var(--font-arabic); font-size: 1.45rem; line-height: 2.1; margin: 0; white-space: pre-line; text-align: justify; }
.adk-quran { font-size: var(--qsize); line-height: 2.2; margin: 0; text-align: justify; text-align-last: center; }
.adk .basmala { text-align: center; margin: 0; }
.adk-preface { font-family: var(--font-arabic); font-size: 1.15rem; color: var(--text-2); margin: 0 0 .25rem; }
.adk-note, .adk-virtue { font-family: var(--font-arabic); font-size: 1.05rem; color: var(--text-2); margin: .5rem 0 0; }
.adk-virtue { border-inline-start: 3px solid var(--gold); padding-inline-start: .7rem; background: color-mix(in srgb, var(--gold-3) 18%, transparent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding-block: .3rem; }
[dir=rtl] .adk-virtue { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.adk-foot { display: flex; align-items: center; gap: .75rem; margin-top: .6rem; }
.adk-ref { color: var(--muted); font-size: .9rem; }
.adk-times { color: var(--muted); font-size: .9rem; }
/* Compteur : perle de tasbih */
.adk-btn {
    margin-inline-start: auto; min-width: 3.6rem; height: 3.6rem; border-radius: 50%; justify-content: center;
    background: radial-gradient(circle at 35% 30%, var(--accent-2), var(--accent-3) 70%); color: var(--gold-3); border: 1px solid var(--accent-3);
    box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold-2), 0 6px 14px -6px rgb(0 0 0 / .5), inset 0 -3px 6px rgb(0 0 0 / .25);
    font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; transition: transform .12s, box-shadow .2s;
}
.adk-btn:hover { border-color: var(--accent-3); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold), 0 8px 18px -6px rgb(0 0 0 / .5), inset 0 -3px 6px rgb(0 0 0 / .25); }
.adk-btn:active { transform: scale(.92); }
.adk.done .adk-btn { background: radial-gradient(circle at 35% 30%, var(--gold-3), var(--gold) 75%); color: var(--gold-ink); border-color: var(--gold); }
.adk-finish { text-align: center; font-family: var(--font-arabic); font-size: 1.4rem; margin: 1.5rem 0; color: var(--accent); }
.adk-source { margin-top: 2rem; font-size: .85rem; }
@media (max-width: 760px) {
    .adk { padding: .85rem .8rem .65rem; }
    .adk-text { font-size: 1.3rem; }
}

/* ---------- Hadiths ---------- */
.hd-search .picker { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .5rem; align-items: end; width: 100%; flex: 1 1 100%; }
.hd-search .grow input { width: 100%; }
@media (max-width: 760px) {
    .hd-search .picker { grid-template-columns: minmax(0, 1fr) auto; }
    .hd-search .grow { grid-column: 1 / -1; }
    .hd-search select { max-width: none; width: 100%; }
}
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--text-2); margin-top: .25rem; }
.check input { min-height: 0; accent-color: var(--accent); }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--accent); }
.hd-tools { margin: .25rem 0 .75rem; }
.hd { padding: 1.1rem 1.25rem .8rem; margin-bottom: .9rem; scroll-margin-top: 6rem; position: relative; border-inline-start: 4px solid var(--gold-2); }
.hd::before {
    content: ""; position: absolute; top: .7rem; inset-inline-end: .8rem; width: 18px; height: 18px; opacity: .35;
    background: var(--gold); -webkit-mask: var(--pat-rosette) center/contain no-repeat; mask: var(--pat-rosette) center/contain no-repeat;
}
.hd:target { border-color: var(--gold); box-shadow: var(--glow), var(--shadow); }
.hd-isnad, .hd-post { font-family: var(--font-arabic); font-size: 1.05rem; line-height: 1.95; color: var(--text-2); margin: 0 0 .35rem; }
.hd-post { margin: .35rem 0 0; }
.hd-matn { font-family: var(--font-arabic); font-size: 1.4rem; line-height: 2.15; margin: 0; }
body.hide-isnad .hd-isnad, body.hide-isnad .hd-post { display: none; }
.hd-foot { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .7rem; padding-top: .5rem; border-top: 1px dashed var(--border); font-size: .88rem; color: var(--muted); }
.hd-today .hd { border-color: var(--gold); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px color-mix(in srgb, var(--gold-2) 60%, transparent), var(--shadow); }
.hd-chapter { font-family: var(--font-arabic); font-size: 1.25rem; line-height: 1.8; color: var(--accent); margin: 1.6rem 0 .5rem; }
.hd-chapter::after { display: none; }
.hd-chapter-intro { font-family: var(--font-arabic); color: var(--text-2); line-height: 1.9; margin: 0 0 .6rem; }
.hd-books { list-style: none; padding: 0; margin: 0; columns: 2 18rem; column-gap: 2rem; font-family: var(--font-arabic); font-size: 1.1rem; }
.hd-books li { break-inside: avoid; padding: .25rem 0; }
.hd-bn { display: inline-block; min-width: 2.2em; color: var(--gold); font-variant-numeric: tabular-nums; font-family: var(--font-ui); font-size: .85rem; }
.hd-booknav { margin-top: 1.5rem; }

/* ---------- Traduction : en-tête enluminé, versets en trois lignes, colonne latérale (rd-layout) ---------- */
.tr-main { max-width: 56rem; margin: 0 auto; width: 100%; }
.tr-head {
    text-align: center; padding: 1.3rem 1.6rem 1rem; margin: 0 0 1.25rem; position: relative;
    background: var(--page); border: 1px solid var(--frame); border-radius: 8px;
    box-shadow: inset 0 0 0 5px var(--page), inset 0 0 0 6px var(--frame), inset 0 0 0 9px var(--page), inset 0 0 0 10px color-mix(in srgb, var(--frame) 55%, transparent), var(--shadow-lg);
}
.tr-head::before, .tr-head::after { content: ""; position: absolute; top: 2px; width: 22px; height: 22px; background: var(--frame); opacity: .9; -webkit-mask: var(--pat-rosette) center/contain no-repeat; mask: var(--pat-rosette) center/contain no-repeat; }
.tr-head::before { left: 2px; } .tr-head::after { right: 2px; }
.tr-head .surah-title { min-width: 50%; font-size: calc(var(--qsize) * .8); }
.tr-head-fr { font-family: var(--font-title); font-size: 1.35rem; margin: .7rem 0 0; color: var(--ink-title); }
.tr-head-meta { margin: .1rem 0 0; font-size: .88rem; color: var(--muted); }
.tr-list { padding: .5rem 1.5rem; border-inline-start: 4px solid var(--gold-2); }
.tr-item { display: flex; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--grid); scroll-margin-top: 6rem; }
.tr-item:last-child { border-bottom: 0; }
.tr-item:target { background: var(--hl); margin: 0 -1rem; padding-inline: 1rem; border-radius: var(--radius-sm); }
/* Numéro du verset : médaillon doré */
.tr-n { flex-shrink: 0; min-width: 2.2rem; height: 2.2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(to bottom, var(--gold-4), color-mix(in srgb, var(--gold-3) 45%, var(--surface))); color: var(--gold-ink); border: 1px solid var(--gold-2);
    box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3px color-mix(in srgb, var(--gold-2) 70%, transparent); font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: .3rem; }
.tr-body { flex: 1; min-width: 0; }
.tr-list .ar-text { font-size: calc(var(--qsize) * .9); line-height: 2.1; margin: 0 0 .4rem; text-align: right; }
.tr-list .tl { color: var(--accent); font-style: italic; margin: 0 0 .35rem; font-size: .98rem; }
.tr-text { margin: 0; font-size: calc(var(--qsize) * .58); line-height: 1.7; }
.tr-basmala { text-align: center; margin: .5rem 0 1rem; padding-bottom: .8rem; border-bottom: 1px dashed var(--border-2); }
.tr-basmala .ar-text { display: block; text-align: center; color: var(--ink-title); font-size: var(--qsize); }
.tr-basmala .tr-fr, .tr-basmala .tr-en { display: block; }
.tr-list.hide-tl .tl { display: none; }
.tr-list.hide-fr .tr-fr { display: none; }
.tr-list.hide-en .tr-en { display: none; }
.tr-text + .tr-text { margin-top: .35rem; padding-top: .35rem; border-top: 1px dotted var(--border); }
.tr-list.hide-fr .tr-en, .tr-list.hide-en .tr-fr { border-top: 0; padding-top: 0; margin-top: 0; }

/* Colonne : boutons d'affichage (texte arabe, translittération) */
.rd-panel .rd-tools.tr-show { grid-template-columns: 1fr; }
.rd-panel .tr-show .btn[aria-pressed=true]::before { content: "✓ "; }
.rd-panel .tr-show .btn[aria-pressed=false] { opacity: .75; }
@media (max-width: 760px) {
    .tr-head { padding: 1rem .8rem .7rem; box-shadow: inset 0 0 0 3px var(--page), inset 0 0 0 4px var(--frame); }
    .tr-head::before, .tr-head::after { display: none; }
    .tr-list { padding: .4rem .8rem; }
    .tr-item { gap: .6rem; }
}
.tf-pick .picker { flex-wrap: wrap; }

/* ---------- Tafsir : verset enluminé + commentaire, colonne latérale (rd-layout) ---------- */
.tf-main { max-width: 56rem; margin: 0 auto; width: 100%; }
.tf-pick { display: grid; gap: .4rem; }
.tf-pick select { width: 100%; max-width: none; }
.tf-pick .rd-goto { margin-top: 0; }
.tf-pick input[type=number] { flex: 1; width: auto; min-width: 0; }
.rd-panel .rd-prevnext { margin-top: .45rem; }
/* Le verset : cadre enluminé comme une page du mushaf */
.tf-verse {
    text-align: center; padding: 1.4rem 1.6rem 1rem; margin: 0 0 1.25rem; position: relative;
    background: var(--page); border: 1px solid var(--frame); border-radius: 8px;
    box-shadow: inset 0 0 0 5px var(--page), inset 0 0 0 6px var(--frame), inset 0 0 0 9px var(--page), inset 0 0 0 10px color-mix(in srgb, var(--frame) 55%, transparent), var(--shadow-lg);
}
.tf-verse::before, .tf-verse::after, .tf-verse .tf-ref::before, .tf-verse .tf-ref::after {
    content: ""; position: absolute; width: 22px; height: 22px; background: var(--frame); opacity: .9; pointer-events: none;
    -webkit-mask: var(--pat-rosette) center/contain no-repeat; mask: var(--pat-rosette) center/contain no-repeat;
}
.tf-verse::before { top: 2px; left: 2px; } .tf-verse::after { top: 2px; right: 2px; }
.tf-verse .tf-ref { position: static; }
.tf-verse .tf-ref::before { bottom: 2px; left: 2px; } .tf-verse .tf-ref::after { bottom: 2px; right: 2px; }
.tf-verse .surah-title { min-width: 50%; font-size: calc(var(--qsize) * .8); margin-bottom: .8rem; }
.tf-aya { font-size: calc(var(--qsize) * 1.15); line-height: 2.2; margin: 0 0 .4rem; text-align: center; }
.tf-ref { margin: .2rem 0 0; font-size: .9rem; color: var(--muted); }
/* Le commentaire */
.tf-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.6rem 1.4rem; border-inline-start: 4px solid var(--gold-2); }
.tf-head { text-align: center; margin: 0 0 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--border); }
.tf-head h2 { font-family: var(--font-arabic); font-size: 1.6rem; margin: 0; display: block; color: var(--ink-title); }
.tf-head h2::after { display: none; }
.tf-author { font-family: var(--font-arabic); font-size: 1rem; color: var(--muted); margin: .15rem 0 0; }
.tf-h { font-family: var(--font-arabic); font-size: 1.15rem; color: var(--accent); margin: 1.25rem 0 .25rem; }
.tf-text p { font-family: var(--font-arabic); font-size: calc(var(--qsize) * .66); line-height: 2; margin: 0 0 .9rem; text-align: justify; }
.tf-text p:first-of-type::first-letter { color: var(--gold); }
.tf-q { font-family: var(--font-quran); color: var(--accent); }
.tf-note { font-size: .78em; color: var(--muted); }
.tf-note::before { content: " ["; }
.tf-note::after { content: "] "; }
/* Choix du livre : cartes empilées */
.tf-sources { display: grid; gap: .35rem; }
.tf-sources a { display: flex; flex-direction: column; gap: .05rem; padding: .45rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--border-2); color: var(--text-2); font-family: var(--font-arabic); background: var(--surface); transition: all .15s; }
.tf-src-name { font-size: 1.05rem; }
.tf-src-author { font-size: .8rem; opacity: .75; }
.tf-sources a.active { background: linear-gradient(to bottom, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: var(--accent-3); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--gold-2); }
.tf-sources a:hover { text-decoration: none; border-color: var(--gold); }
.tf-main .pager .btn { gap: .35rem; }
@media (max-width: 760px) {
    .tf-verse { padding: 1rem .8rem .7rem; box-shadow: inset 0 0 0 3px var(--page), inset 0 0 0 4px var(--frame); }
    .tf-verse::before, .tf-verse::after, .tf-verse .tf-ref::before, .tf-verse .tf-ref::after { display: none; }
    .tf-body { padding: .9rem .9rem 1rem; }
}

/* ---------- Athmān (division marocaine : ḥizb, niṣf, rubʿ, thumn) ---------- */
.thumn-mark { font-family: var(--font-arabic); font-size: .95rem; color: var(--gold); text-align: center; margin: .5rem 0 .1rem; padding-top: .35rem; border-top: 1px dashed var(--frame); }
.ml[data-thumn]:not([data-thumn=""]) { position: relative; }
.ml[data-thumn]:not([data-thumn=""])::after {
    content: attr(data-thumn); position: absolute; top: 50%; left: 0; transform: translate(-100%, -50%);
    padding-inline-end: .2em; font-family: var(--font-arabic); font-size: max(.55rem, calc(100cqi / var(--mw) * .32));
    line-height: 1.2; color: var(--gold); white-space: nowrap; writing-mode: vertical-rl;
}

/* ---------- التحفيظ : enregistrement et correction ---------- */
.th-rec { padding: 1.1rem 1.3rem; margin: 1rem 0 1.5rem; border-inline-start: 4px solid var(--gold-2); }
.th-rec h2 { margin-top: 0; }
.th-rec.recording { border-color: var(--err); box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 25%, transparent); }
.th-cue { font-size: 1.05rem; margin: .5rem 0 .9rem; }
.th-cue .quran { font-size: 1.5rem; }
.th-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.th-big { font-size: 1.1rem; padding: .6rem 1.3rem; min-height: 2.8rem; border-radius: 999px; }
.th-timer { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 4.5rem; color: var(--accent); }
.th-meter { flex: 1 1 8rem; max-width: 16rem; }
.th-meter span { transition: width .15s; }
.th-status { margin: .75rem 0 0; min-height: 1.5em; }
.th-whisper { font-size: .85rem; }
.th-history tr.current { background: var(--hl); }
.th-cor-head { display: flex; flex-direction: column; gap: .6rem; margin: 1rem 0; }
.th-cor-head audio { width: 100%; max-width: 40rem; }
.th-counts { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: baseline; }
.th-score b { font-size: 1.7rem; color: var(--accent); font-family: var(--font-title); }
.th-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.th-text .verses { font-size: var(--qsize); line-height: 2.3; }
.th-text .w, .th-legend .w { border-radius: 4px; padding: 0 .08em; cursor: pointer; transition: background .2s; }
.th-text .w.ok { color: var(--text); }
.th-text .w.wrong, .th-legend .w.wrong { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); text-decoration: underline wavy var(--err); text-underline-offset: .35em; }
.th-text .w.missed, .th-legend .w.missed { color: var(--miss); background: color-mix(in srgb, var(--miss) 14%, transparent); text-decoration: underline dotted var(--miss); text-underline-offset: .35em; }
.th-legend .w.ok { color: var(--accent); }
.th-text .w.cur { box-shadow: 0 2px 0 var(--gold); }
.th-text.editing .w { outline: 1px dashed var(--border); }
.th-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; font-family: var(--font-arabic); margin-top: .75rem; }

/* ---------- جدول التحفيظ ---------- */
.th-tabs { display: inline-flex; gap: .2rem; padding: .25rem; margin: 0 0 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; box-shadow: inset 0 1px 2px rgb(0 0 0 / .06); }
.th-tabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem 1.05rem; border-radius: 999px; color: var(--text-2); font-weight: 500; transition: all .15s; }
.th-tabs a:hover { text-decoration: none; color: var(--accent); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.th-tabs a.active { background: linear-gradient(to bottom, var(--accent-2), var(--accent)); color: var(--accent-ink); font-weight: 600; box-shadow: 0 0 0 1px var(--accent-3), 0 2px 8px -3px rgb(0 0 0 / .4); }
.th-tab-ico { font-size: .8em; opacity: .9; }
@media (max-width: 600px) { .th-tabs { display: flex; } .th-tabs a { flex: 1; justify-content: center; padding: .4rem .5rem; font-size: .9rem; } }
.plan-strip { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .7rem 1rem; }
.plan-form { display: grid; gap: .9rem; max-width: 40rem; padding: 1.1rem 1.3rem; }
.plan-form > label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); }
.plan-form > label > * { color: var(--text); }
.plan-form input[type=date], .plan-form input[type=number], .plan-form select { max-width: 100%; padding: .35rem .5rem; font: inherit; }
.plan-form fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .8rem; display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.plan-form legend { font-size: .9rem; color: var(--muted); padding: 0 .3rem; }
.plan-form label.inline { display: inline-flex; gap: .35rem; align-items: center; }
.plan-summary { margin: .5rem 0 1rem; }
.plan-progress { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; font-size: 1.05rem; }
.plan-bar { flex: 1 1 10rem; max-width: 24rem; height: 10px; }
.plan-bar span { background: linear-gradient(to right, var(--ok), var(--gold-2)); }
.late-text { color: var(--err); }
.plan-today { padding: .9rem 1.2rem; margin: 1rem 0; border-inline-start: 4px solid var(--gold-2); }
.plan-today h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.plan-items { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.plan-items li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; }
.plan-items li.ok b { color: var(--ok); }
.plan-kind { font-size: .75rem; padding: .1rem .55rem; border-radius: 999px; background: var(--gold-4); color: var(--gold-ink); border: 1px solid var(--gold-2); }
.plan-score { font-variant-numeric: tabular-nums; color: var(--ok); min-width: 3.5rem; }
.plan-cal-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.plan-cal-head h2 { margin: 0; min-width: 10rem; text-align: center; font-size: 1.2rem; }
.plan-cal-head h2::after { display: none; }
.plan-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin: .75rem 0; }
.plan-wd { font-size: .8rem; color: var(--gold); text-align: center; padding: .2rem 0; font-weight: 600; }
.plan-cell { min-height: 4.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .3rem .4rem; display: flex; flex-direction: column; gap: .15rem; color: var(--text); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.plan-cell:hover { text-decoration: none; border-color: var(--gold); box-shadow: var(--glow); }
.plan-cell.empty { background: transparent; border: 0; }
.plan-dn { font-size: .8rem; font-weight: 600; color: var(--muted); }
.plan-tag { font-size: .75rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-cell.st-done { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.plan-cell.st-partial { background: color-mix(in srgb, var(--miss) 16%, var(--surface)); border-color: color-mix(in srgb, var(--miss) 45%, var(--border)); }
.plan-cell.st-late { background: color-mix(in srgb, var(--err) 12%, var(--surface)); border-color: color-mix(in srgb, var(--err) 45%, var(--border)); }
.plan-cell.st-rest, .plan-cell.st-none { background: var(--surface-2); }
.plan-cell.is-today { outline: 2px solid var(--gold); outline-offset: -1px; }
.plan-cell.is-today .plan-dn { color: var(--gold); }
.plan-cell.selected { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.plan-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; font-size: .85rem; color: var(--muted); }
.plan-key { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; border: 1px solid var(--border); background: var(--surface); }
.plan-key.st-done { background: color-mix(in srgb, var(--ok) 35%, var(--surface)); }
.plan-key.st-partial { background: color-mix(in srgb, var(--miss) 35%, var(--surface)); }
.plan-key.st-late { background: color-mix(in srgb, var(--err) 30%, var(--surface)); }
.plan-key.st-rest { background: var(--surface-2); }
.plan-actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin: 1.5rem 0; }
.plan-actions form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
@media (max-width: 560px) {
    .plan-cell { min-height: 3.4rem; padding: .15rem .2rem; }
    .plan-tag { font-size: .65rem; white-space: normal; }
}
.plan-error { color: var(--err); }
p.plan-error { background: color-mix(in srgb, var(--err) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--err) 40%, var(--border)); border-radius: var(--radius-sm); padding: .5rem .8rem; }

/* ---------- Lecture : sens des mots (غريب) et marques ---------- */
.aya[data-s] { cursor: pointer; }
.gh-on .wd.gh { text-decoration: underline dotted color-mix(in srgb, var(--gold) 80%, transparent); text-decoration-thickness: 2px; text-underline-offset: .35em; }
.gh-on .wd.gh:hover { background: var(--hl); border-radius: 4px; }
.rd-pop { position: absolute; z-index: 60; background: var(--surface); color: var(--text); border: 1px solid var(--border-2); border-radius: var(--radius);
    box-shadow: var(--shadow-lg), inset 0 0 0 3px var(--surface), inset 0 0 0 4px color-mix(in srgb, var(--gold-2) 60%, transparent);
    padding: 1rem 1.1rem 1.1rem; max-height: min(70vh, 32rem); overflow: auto; font-family: var(--font-ui); line-height: 1.5; }
.rd-pop h2 { font-size: 1.05rem; margin: 0 1.6rem .5rem 0; }
.rd-pop h2::after { display: none; }
[dir="rtl"] .rd-pop h2 { margin: 0 0 .5rem 1.6rem; }
.rd-pop h3 { font-size: .95rem; margin: .8rem 0 .3rem; color: var(--gold); }
.rd-pop-close { position: absolute; top: .45rem; inset-inline-end: .5rem; border: 0; background: transparent; font-size: 1.4rem; line-height: 1; padding: .2rem .45rem; min-height: 0; box-shadow: none; }
.rd-gh { margin: 0; }
.rd-gh dt { font-size: 1.35rem; margin-top: .35rem; }
.rd-gh dd { margin: 0 0 .4rem; font-family: var(--font-arabic); font-size: 1.1rem; }
.rd-src { font-size: .75rem; color: var(--muted); margin: .6rem 0 0; }
.rd-links { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.rd-markform { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .3rem 0 .4rem; }
.rd-markform input[type=text] { flex: 1 1 10rem; padding: .35rem .5rem; font: inherit; }
.rd-marked { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .3rem 0; }
.mk-colors { display: inline-flex; gap: .3rem; }
.mk-dot { display: inline-flex; cursor: pointer; }
.mk-dot input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mk-dot span { width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--mk); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-2); }
.mk-dot input:checked + span { box-shadow: 0 0 0 2px var(--gold); }
.mk-dot input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.mk-green { --mk: #2e8b57; } .mk-gold { --mk: #c9962b; } .mk-red { --mk: #c0392b; } .mk-blue { --mk: #2f6fb3; }
.aya.marked .num { background: color-mix(in srgb, var(--mk) 28%, transparent); border-radius: 50%; box-shadow: 0 0 0 2px var(--mk); }
.reader-list .aya.marked { box-shadow: inset 3px 0 0 var(--mk); }
[dir="rtl"] .reader-list .aya.marked { box-shadow: inset -3px 0 0 var(--mk); }
.mk-panel { padding: .9rem 1.2rem; margin: .5rem 0 1rem; border-inline-start: 4px solid var(--gold-2); }
.mk-panel h2 { margin: 0 0 .5rem; font-size: 1.1rem; }
.mk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.mk-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.mk-list li .btn { padding: .1rem .5rem; min-height: 0; }
.mk-note { color: var(--muted); }
.mk-help { font-size: .85rem; margin-bottom: 0; }
.rd-resume { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .25rem 0 .75rem; }
@media (max-width: 600px) {
    .rd-pop { position: fixed; left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto !important; max-height: 60vh;
        border-radius: var(--radius) var(--radius) 0 0; }
}
.rd-pop > .rd-gh:nth-child(2) { margin-top: 1.3rem; }

/* ---------- Lecture : choix du type d'affichage et barre du verset ---------- */
.rd-nav { padding: .8rem 1rem; margin-bottom: 1rem; display: grid; gap: .7rem; }
.rd-types { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.rd-types-label { font-size: .85rem; color: var(--muted); margin-inline-end: .3rem; }
.rd-type { padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--border-2); color: var(--text); background: var(--surface); font-size: .95rem; transition: all .15s; }
.rd-type:hover { text-decoration: none; border-color: var(--gold); }
.rd-type.active { background: linear-gradient(to bottom, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: var(--accent-3); font-weight: 600; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--gold-2); }
.rd-pick { display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; align-items: flex-end; }
.rd-pick .picker:first-child { flex: 1 1 18rem; }
.rd-pick .picker:first-child label { flex: 1; }
.rd-pick select { width: 100%; max-width: 32rem; }
.rd-pos { position: sticky; top: var(--topbar-h, 68px); z-index: 6;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-2); border-radius: var(--radius);
    padding: .5rem .9rem; margin: 0 0 .75rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem;
    box-shadow: var(--shadow); }
.rd-pos-where { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .7rem; font-size: .92rem; }
.rd-pos-label { color: var(--muted); font-size: .85rem; }
.rd-pos-where a { color: var(--text); }
.rd-pos-where a.cur { color: var(--accent); font-weight: 700; }
.rd-pos-item { color: var(--muted); }
.rd-pos-item + .rd-pos-item::before { content: "◆"; font-size: .55em; margin-inline-end: .7rem; color: var(--gold); vertical-align: middle; }
.rd-pos-act { display: flex; flex-wrap: wrap; gap: .35rem; }
.rd-pos-act .btn, .rd-pos-act button { padding: .25rem .7rem; font-size: .9rem; min-height: 2rem; }
#pos-mark.is-marked { border-color: var(--gold); color: var(--accent); }
.rd-pos .rd-markform { flex-basis: 100%; margin: .2rem 0 .1rem; }
.aya.sel { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 6px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 55%, transparent); }
@media (max-width: 600px) {
    .rd-type { padding: .3rem .6rem; font-size: .88rem; }
    .rd-pos { font-size: .85rem; padding: .4rem .55rem; }
    .rd-pos-where { font-size: .82rem; gap: .1rem .5rem; }
    .rd-pos-item + .rd-pos-item::before { margin-inline-end: .5rem; }
}

/* ---------- Page de lecture : texte + colonne latérale repliable ---------- */
.container.wide { max-width: 1680px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Colonne sur le bord extérieur (droite en arabe, gauche en français), texte à côté */
.rd-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.rd-layout.collapsed { grid-template-columns: 3.4rem minmax(0, 1fr); }
.rd-main { min-width: 0; grid-column: 2; grid-row: 1; }
.rd-panel { grid-column: 1; grid-row: 1; }
/* La colonne : collante et défilante */
.rd-panel {
    position: sticky; top: calc(var(--topbar-h, 68px) + .75rem); overflow: visible;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    display: flex; flex-direction: column;
}
/* Trop haute pour la fenêtre (mesuré par reader-panel.js) : elle défile avec la page */
.rd-panel.tall { position: static; }
.rd-panel-head { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .3rem .5rem; padding: .6rem .7rem .5rem; border-bottom: 1px solid var(--border); }
.rd-panel-toggle, .rd-panel-close, .rd-fab { font: inherit; }
.rd-panel-toggle { width: 2.1rem; height: 2.1rem; min-height: 0; padding: 0; border-radius: 50%; justify-content: center; font-size: 1.1rem; color: var(--accent); }
.rd-panel-toggle .ico-expand { display: none; }
.collapsed .rd-panel-toggle .ico-expand { display: inline; }
.collapsed .rd-panel-toggle .ico-collapse { display: none; }
.rd-panel-close { display: none; }
.rd-title { min-width: 0; }
.rd-title h1 { font-size: 1.2rem; margin: 0; color: var(--ink-title); line-height: 1.3; }
.rd-title .muted { margin: .1rem 0 0; font-size: .8rem; }
.rd-panel-body { padding: .1rem .75rem .7rem; display: flex; flex-direction: column; gap: 0; }
.rd-panel-h { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); margin: .7rem 0 .4rem; font-family: var(--font-ui); font-weight: 600; }
.rd-panel-h::after { background: linear-gradient(to var(--h2-dir, right), var(--gold-2), transparent); opacity: .5; }
html[lang=ar] .rd-panel-h { text-transform: none; letter-spacing: 0; font-size: .82rem; }
/* Sections dans la colonne : plus de cartes imbriquées */
.rd-panel .rd-nav, .rd-panel .rd-pos, .rd-panel .rd-tools { background: none; border: 0; box-shadow: none; border-radius: 0; padding: 0; margin: 0; position: static; display: block; backdrop-filter: none; }
.rd-panel .rd-types { gap: .25rem; margin-bottom: .45rem; }
.rd-panel .rd-type { padding: .2rem .6rem; font-size: .84rem; }
.rd-unit { display: block; }
.rd-unit label { display: block; }
.rd-unit select { width: 100%; max-width: none; }
/* Précédent / suivant : icône + libellé */
.rd-prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin-top: .45rem; }
.rd-prevnext .btn { justify-content: center; padding: .3rem .4rem; font-size: .86rem; min-height: 2.1rem; gap: .25rem; }
.rd-prevnext .btn.off { opacity: .35; pointer-events: none; }
.ico { flex: none; }
[dir=rtl] .ico-start, [dir=rtl] .ico-end { transform: scaleX(-1); }
.pager .btn { gap: .35rem; }
.rd-arrow {
    flex: none; width: 2.2rem; height: 2.2rem; min-height: 0; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.3rem; line-height: 1; color: var(--accent); background: var(--surface); border: 1px solid var(--border-2);
    box-shadow: 0 1px 2px rgb(60 40 0 / .08); transition: all .15s;
}
a.rd-arrow:hover, button.rd-arrow:hover { text-decoration: none; background: var(--accent); color: var(--accent-ink); border-color: var(--gold); box-shadow: var(--glow); }
.rd-arrow.off { opacity: .3; }
.rd-goto { display: flex; gap: .35rem; margin-top: .5rem; min-width: 0; }
.rd-goto input { flex: 1 1 0; min-width: 0; width: 0; }
.rd-goto button { flex: none; }
/* Les éléments de la colonne ne débordent jamais (largeur intrinsèque des champs ignorée) */
.rd-panel-body > section, .tf-pick > *, .rd-panel .tf-field, .rd-panel select, .rd-panel input { min-width: 0; max-width: 100%; }
.rd-panel .rd-resume { flex-direction: column; align-items: stretch; gap: .15rem; margin: .5rem 0 0; }
.rd-panel .rd-resume .btn { justify-content: center; }
.rd-panel .rd-resume .muted { font-size: .8rem; text-align: center; }
/* Verset courant : position en liste, actions en grille */
/* Bandeau du verset courant, juste au-dessus du texte */
.rd-strip {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .15rem .8rem; min-height: 2.2rem;
    margin: 0 0 .8rem; padding: .4rem 1.2rem; font-size: .92rem;
    background: var(--surface); border: 1px solid var(--border-2); border-radius: 999px; box-shadow: var(--shadow);
}
.rd-strip .rd-pos-label { color: var(--muted); font-size: .85rem; }
.rd-strip b { color: var(--ink-title); }
.rd-strip .rd-pos-item + .rd-pos-item::before, .rd-strip b + .rd-pos-item::before { content: "◆"; font-size: .5em; margin-inline-end: .8rem; color: var(--gold); vertical-align: middle; }
@media (max-width: 760px) { .rd-strip { font-size: .85rem; padding: .35rem .8rem; gap: .1rem .55rem; border-radius: var(--radius); } }
.rd-panel .rd-pos-act { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.rd-panel .rd-pos-act .btn, .rd-panel .rd-pos-act button { justify-content: center; padding: .3rem .4rem; font-size: .86rem; min-height: 2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-panel .rd-pos-act #pos-mark { grid-column: 1 / -1; }
.rd-panel .rd-markform { margin: .5rem 0 0; }
/* Outils */
.rd-panel .rd-tools { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.rd-panel .rd-tools > .rd-panel-h, .rd-panel .rd-tools > #listen-btn, .rd-panel .rd-tools > .mk-panel { grid-column: 1 / -1; }
.rd-panel .rd-tools .btn, .rd-panel .rd-tools button { justify-content: center; padding: .3rem .4rem; font-size: .86rem; min-height: 2rem; }
.rd-panel .rd-tools .size-ctl { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; grid-column: 1 / -1; }
.rd-panel .mk-panel { margin: .5rem 0 0; padding: .6rem .7rem; }
.rd-panel .mk-panel h2 { font-size: .95rem; }
/* Rail d'icônes (colonne repliée) */
.rd-rail { display: none; flex-direction: column; align-items: center; gap: .45rem; padding: .6rem 0; }
.rd-rail .rd-arrow { font-size: 1rem; }
.collapsed .rd-panel { overflow: visible; }
.collapsed .rd-panel-head { padding: .5rem 0; justify-items: center; grid-template-columns: 1fr; border-bottom-color: var(--border); }
.collapsed .rd-title, .collapsed .rd-panel-body { display: none; }
.collapsed .rd-rail { display: flex; }
/* Mushaf : deux pages qui tiennent dans la hauteur de l'écran (A− / A+ restent prioritaires) */
.rd-layout .mushaf { gap: 1.1rem; }
/* Interrupteur « page entière à l'écran » : la largeur est déduite de la hauteur disponible, pour que les 15 lignes
   (hauteur de ligne = 2.05 × largeur / --mw) plus l'en-tête, le pied et les marges (~5.6rem) tiennent dans la fenêtre.
   Décoché : largeur d'après A− / A+. */
.rd-layout .mp { flex-basis: calc(var(--qsize) * 17.5); }
.rd-layout.fit .mp { flex-basis: calc((100vh - var(--topbar-h, 68px) - 13.5rem) * var(--mw, 30) / 30.75); }
/* Sous-menu : extras (interrupteur) sur le bord opposé */
.subnav { align-items: center; }
.subnav-extra { margin-inline-start: auto; display: flex; align-items: center; padding: .2rem 0; }
/* Interrupteur */
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 2.6rem; height: 1.45rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-2); transition: background .2s, border-color .2s; flex: none; }
.switch-knob { position: absolute; top: 2px; inset-inline-start: 2px; width: calc(1.45rem - 6px); height: calc(1.45rem - 6px); border-radius: 50%; background: var(--surface); border: 1px solid var(--border-2); box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .2s, background .2s; }
.switch input:checked + .switch-track { background: linear-gradient(to bottom, var(--accent-2), var(--accent)); border-color: var(--accent-3); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(1.15rem); background: var(--gold-3); border-color: var(--gold); }
[dir=rtl] .switch input:checked + .switch-track .switch-knob { transform: translateX(-1.15rem); }
.switch input:focus-visible + .switch-track { box-shadow: var(--glow); }
.switch:hover .switch-label { color: var(--accent); }
.rd-layout .pager { margin: .75rem 0 0; }
/* Mushaf ouvert : ombre de reliure entre les deux pages (page impaire à droite) */
.mushaf .mp:nth-child(odd) { background-image: linear-gradient(to left, transparent 90%, rgb(60 40 0 / .07)); }
.mushaf .mp:nth-child(even) { background-image: linear-gradient(to right, transparent 90%, rgb(60 40 0 / .07)); }
.mushaf .mp.mp-opening { background-image:
        radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--frame) 22%, transparent), transparent 55%),
        radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--frame) 22%, transparent), transparent 55%); }
/* Bouton flottant et tiroir (mobile) */
.rd-fab { display: none; }
.rd-backdrop { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / .45); backdrop-filter: blur(2px); }
body.rd-noscroll { overflow: hidden; }
@media (max-width: 960px) {
    .rd-layout, .rd-layout.collapsed { display: block; }
    .rd-panel {
        position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 31; width: min(86vw, 330px); max-height: none; border-radius: 0; border: 0;
        transform: translateX(-100%); transition: transform .25s ease; box-shadow: none;
    }
    [dir=rtl] .rd-panel { transform: translateX(100%); }
    .rd-layout.open .rd-panel { transform: none; box-shadow: var(--shadow-lg); }
    .rd-panel-toggle, .rd-rail { display: none !important; }
    .rd-panel-close { display: inline-flex; width: 2.1rem; height: 2.1rem; min-height: 0; padding: 0; border-radius: 50%; justify-content: center; }
    .rd-panel-head { grid-template-columns: auto 1fr; }
    .rd-title, .rd-panel-body { display: block !important; }
    .rd-fab {
        display: inline-flex; align-items: center; gap: .4rem; position: fixed; bottom: calc(1rem + env(safe-area-inset-bottom)); inset-inline-start: 1rem; z-index: 25;
        padding: .6rem 1.1rem; border-radius: 999px; background: linear-gradient(to bottom, var(--accent-2), var(--accent)); color: var(--accent-ink); border: 1px solid var(--accent-3);
        box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold-2), var(--shadow-lg); font-weight: 600;
    }
    body:has(.player:not([hidden])) .rd-fab { bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
    .rd-layout.fit .mp { flex-basis: calc(var(--qsize) * 17.5); }
    .subnav-extra { padding-inline-start: .5rem; }
    .switch-label { display: none; }
}

/* ---------- التحفيظ : disposition à colonne (rd-layout), enregistrement, تسميع, calendrier ---------- */
.th-main { max-width: 56rem; margin: 0 auto; width: 100%; }
.rd-field-label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .2rem; }
.tf-field { display: block; }
.tf-field select, .tf-field input { width: 100%; max-width: none; }
.rd-two { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.tf-pick + .tf-pick { margin-top: .5rem; }
.tf-pick > button { width: 100%; justify-content: center; margin-top: .1rem; }
/* Bouton d'enregistrement : rouge profond, point qui bat pendant l'enregistrement */
.th-record, button.primary.th-record, .btn.primary.th-record { background: linear-gradient(to bottom, #c9463a, #a8352a); border-color: #7f261d; color: #fff; }
.th-record:hover, button.primary.th-record:hover { border-color: var(--gold); }
.th-dot { width: .7em; height: .7em; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgb(255 255 255 / .35); }
.recording .th-dot, #rec-start.recording .th-dot { animation: th-blink 1s ease-in-out infinite; }
@keyframes th-blink { 50% { opacity: .25; } }
/* Carte d'enregistrement : cadre enluminé */
.th-rec {
    text-align: center; padding: 1.6rem 1.6rem 1.2rem; margin: 0 0 1.5rem; position: relative; border-inline-start: 0;
    background: var(--page); border: 1px solid var(--frame); border-radius: 8px;
    box-shadow: inset 0 0 0 5px var(--page), inset 0 0 0 6px var(--frame), inset 0 0 0 9px var(--page), inset 0 0 0 10px color-mix(in srgb, var(--frame) 55%, transparent), var(--shadow-lg);
}
.th-rec h2 { justify-content: center; font-size: 1.5rem; color: var(--ink-title); margin: 0 0 .2rem; }
.th-rec h2::after { display: none; }
.th-rec .th-cue { font-size: 1.1rem; margin: .8rem 0 1.2rem; }
.th-rec .th-cue .quran { font-size: calc(var(--qsize) * 1.05); display: block; margin-top: .3rem; line-height: 2; }
.th-rec .th-controls { justify-content: center; }
.th-rec.recording { border-color: #b53a2b; box-shadow: inset 0 0 0 5px var(--page), inset 0 0 0 6px #b53a2b, var(--shadow-lg), 0 0 0 4px rgb(181 58 43 / .18); }
.th-rec .th-meter { max-width: 12rem; }
.th-rec .th-status { font-weight: 600; }
/* Texte à réciter / à corriger : cadre enluminé */
.th-page {
    background: var(--page); border: 1px solid var(--frame); border-radius: 8px; padding: 1.6rem 1.8rem 1.2rem; position: relative;
    box-shadow: inset 0 0 0 5px var(--page), inset 0 0 0 6px var(--frame), inset 0 0 0 9px var(--page), inset 0 0 0 10px color-mix(in srgb, var(--frame) 55%, transparent), var(--shadow-lg);
}
.th-page::before, .th-page::after { content: ""; position: absolute; top: 2px; width: 22px; height: 22px; background: var(--frame); opacity: .9; pointer-events: none; -webkit-mask: var(--pat-rosette) center/contain no-repeat; mask: var(--pat-rosette) center/contain no-repeat; }
.th-page::before { left: 2px; } .th-page::after { right: 2px; }
.rec-text.masked .w:not(.ok):not(.wrong):not(.missed):not(.hint) { background: color-mix(in srgb, var(--frame) 22%, transparent); }
/* Barre de récitation collante dans la colonne principale */
.rec-bar { top: calc(var(--topbar-h, 68px) + .5rem); }
/* Plan du jour dans la colonne */
.th-plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.th-plan-list .btn { width: 100%; justify-content: flex-start; gap: .5rem; padding: .35rem .6rem; font-size: .88rem; }
.th-plan-list .plan-kind { flex: none; }
.th-plan-link, .th-plan-none { font-size: .85rem; margin: .5rem 0 0; }
.th-plan-link .btn { width: 100%; justify-content: center; }
/* Colonne : résultats de la correction */
.rd-panel .th-counts { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .6rem; font-size: .9rem; }
.rd-panel .th-counts .th-score { grid-column: 1 / -1; text-align: center; }
.rd-panel .th-counts .th-score b { font-size: 2.2rem; }
.rd-panel .rd-tools.th-tools, .rd-panel .rd-tools.plan-actions { grid-template-columns: 1fr; margin: 0; }
.rd-panel .rd-tools form { display: contents; }
.rd-panel .rd-tools form button { width: 100%; justify-content: center; }
.th-danger { color: var(--err); }
.th-danger:hover { border-color: var(--err); box-shadow: 0 0 0 4px color-mix(in srgb, var(--err) 18%, transparent); }
/* Calendrier */
.plan-create { padding: 0; }
.plan-create h2 { margin-top: 0; }
.plan-create .plan-form { max-width: none; }
.plan-form .rd-two { gap: .9rem; }
.plan-month-name { text-align: center; font-family: var(--font-title); font-size: 1.15rem; color: var(--ink-title); margin: 0 0 .4rem; }
.plan-legend-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; font-size: .88rem; }
.plan-legend-list li { display: flex; align-items: center; gap: .5rem; }
.plan-cal-head { justify-content: center; }
.plan-cal-head .btn { padding: .3rem .6rem; }
.plan-cell { min-height: 5rem; }
.th-main .plan-cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem; margin: 1rem 0; }
.th-main .plan-cal h2 { margin: 0; }

/* ---------- Recherche et statistiques (rd-layout) ---------- */
.sr-main, .st-main { min-width: 0; }
.sr-main .search-form { padding: 1.2rem 1.4rem 1rem; border-inline-start: 4px solid var(--gold-2); }
.sr-main .search-main input { font-size: 1.7rem; padding: .5rem .9rem; min-height: 3.2rem; }
.sr-main .search-main .primary { min-height: 3.2rem; padding: .5rem 1.4rem; font-size: 1.05rem; }
.sr-empty { text-align: center; padding: 3rem 1rem; }
.sr-empty .ornament { max-width: 14rem; }
.rd-panel .rd-nav .rd-panel-h + .tf-field + .rd-panel-h { margin-top: .9rem; }
.rd-panel .rd-nav .th-plan-link .btn { width: 100%; justify-content: center; }
.st-tiles { margin-top: 0; }
.st-main .chart { margin-bottom: 1.1rem; }
.st-main .two-col { gap: 1.1rem; }
.rd-panel .rd-tools .btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Adhan (rd-layout) ---------- */
.ad-main { max-width: 60rem; margin: 0 auto; width: 100%; }
.ad-main .day-header {
    padding: 1.2rem 1.4rem 1rem; margin: 0 0 1.2rem; position: relative;
    background: var(--page); border: 1px solid var(--frame); border-radius: 8px;
    box-shadow: inset 0 0 0 5px var(--page), inset 0 0 0 6px var(--frame), inset 0 0 0 9px var(--page), inset 0 0 0 10px color-mix(in srgb, var(--frame) 55%, transparent), var(--shadow-lg);
}
.ad-main .day-header::before, .ad-main .day-header::after { content: ""; position: absolute; top: 2px; width: 22px; height: 22px; background: var(--frame); opacity: .9; -webkit-mask: var(--pat-rosette) center/contain no-repeat; mask: var(--pat-rosette) center/contain no-repeat; }
.ad-main .day-header::before { left: 2px; } .ad-main .day-header::after { right: 2px; }
.ad-main .day-header h1 { font-size: 2rem; color: var(--ink-title); }
.ad-main .day-header .hijri { font-size: 1.35rem; }
.ad-main .next-prayer .countdown { font-size: 3.4rem; }
/* Les six moments (Fajr → Icha, chourouq compris) sur une seule ligne ; 3 puis 2 colonnes sur petits écrans */
.ad-main .times { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .7rem; }
.ad-main .time-card { padding: 1.2rem .4rem .9rem; }
.ad-main .time-card .name { font-size: clamp(.95rem, 1.4vw, 1.15rem); }
.ad-main .time-card .clock { font-size: clamp(1.25rem, 2.1vw, 1.9rem); }
@media (max-width: 900px) { .ad-main .times { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) { .ad-main .times { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ad-main .adan-method { margin-top: 1.5rem; }
.ad-main .month-wrap { margin-top: 0; }
/* Réglages de l'adhan dans la colonne */
.rd-panel .adhan-set { background: none; border: 0; box-shadow: none; padding: 0; margin: 0; }
.rd-panel .adhan-set .rd-panel-h { margin-top: .9rem; }
.rd-panel .adhan-row { margin: 0 0 .3rem; }
.rd-panel .adhan-switch .switch-label { font-size: .88rem; line-height: 1.3; }
.rd-panel .adhan-state { margin: 0 0 .6rem; font-size: .85rem; }
.rd-panel .adhan-grid { grid-template-columns: 1fr; gap: .45rem; }
.rd-panel .adhan-grid label { display: block; }
.rd-panel .adhan-grid input[type=range] { width: 100%; padding: 0; min-height: 1.6rem; }
.rd-panel .adhan-prayers { margin: .6rem 0 0; gap: .25rem .7rem; }
.rd-panel .adhan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin: .6rem 0 .3rem; }
.rd-panel .adhan-actions .btn { justify-content: center; padding: .3rem .4rem; font-size: .84rem; min-height: 2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-panel .adhan-actions #adhan-import-label { grid-column: 1 / -1; }
.rd-panel .adhan-help, .rd-panel .adhan-credit { font-size: .78rem; }

/* Bouton unique dans une section d'outils : pleine largeur */
.rd-panel .rd-tools > a:only-of-type, .rd-panel .rd-tools > button:only-of-type { grid-column: 1 / -1; }
/* Fil de la journée : bande ciel (nuit → aube → jour → crépuscule → nuit) avec les six moments et l'aiguille « maintenant » */
.ad-timeline { margin: 1.6rem 0 0; padding: 1rem 1.2rem 3.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.ad-timeline-h { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); margin: 0 0 1.6rem; font-family: var(--font-ui); font-weight: 600; }
html[lang=ar] .ad-timeline-h { text-transform: none; letter-spacing: 0; font-size: .9rem; }
.ad-track {
    position: relative; height: 12px; border-radius: 999px; margin: 0 1.5rem;
    background: linear-gradient(to right,
        #1b2a4a 0, #1b2a4a calc(var(--fajr) - 3%), #b97a45 var(--fajr), #e9c46a var(--sunrise), #f6ecc8 calc(var(--sunrise) + 6%), #f6ecc8 calc(var(--maghrib) - 6%),
        #e07a3a var(--maghrib), #3b2f5a var(--isha), #1b2a4a calc(var(--isha) + 3%), #1b2a4a 100%);
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15), 0 1px 2px rgb(0 0 0 / .1);
}
.ad-mark { position: absolute; top: 50%; inset-inline-start: var(--p); transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.ad-mark-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--gold-3); border: 2px solid var(--gold); box-shadow: 0 0 0 2px var(--surface); }
.ad-mark.next .ad-mark-dot { background: var(--accent); border-color: var(--gold-2); width: 18px; height: 18px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }
.ad-mark.muted .ad-mark-dot { width: 10px; height: 10px; background: var(--surface-2); border-color: var(--border-2); }
.ad-mark-name { position: absolute; top: 100%; margin-top: .35rem; font-family: var(--font-title); font-size: .85rem; color: var(--accent); white-space: nowrap; }
.ad-mark-time { position: absolute; top: 100%; margin-top: 1.5rem; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ad-mark.muted .ad-mark-name { color: var(--muted); }
.ad-now { position: absolute; top: -12px; bottom: -12px; inset-inline-start: var(--p, 50%); width: 2px; background: var(--err); transform: translateX(-50%); border-radius: 2px; box-shadow: 0 0 0 1px var(--surface); transition: inset-inline-start 1s; }
/* En arabe, le temps s'écoule de droite à gauche : Fajr à droite, Icha à gauche */
[dir=rtl] .ad-track { background: linear-gradient(to left,
        #1b2a4a 0, #1b2a4a calc(var(--fajr) - 3%), #b97a45 var(--fajr), #e9c46a var(--sunrise), #f6ecc8 calc(var(--sunrise) + 6%), #f6ecc8 calc(var(--maghrib) - 6%),
        #e07a3a var(--maghrib), #3b2f5a var(--isha), #1b2a4a calc(var(--isha) + 3%), #1b2a4a 100%); }
[dir=rtl] .ad-mark { transform: translate(50%, -50%); }
[dir=rtl] .ad-now { transform: translateX(50%); }
.ad-now::before { content: ""; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); width: 12px; height: 12px; background: var(--err); -webkit-mask: var(--pat-star8) center/contain no-repeat; mask: var(--pat-star8) center/contain no-repeat; }
.ad-now-time { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: .6rem; font-size: .75rem; font-weight: 700; color: var(--err); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 760px) { .ad-mark-name { font-size: .7rem; } .ad-mark-time { display: none; } .ad-timeline { padding-bottom: 2.4rem; } }
/* Verset sur les temps de la prière */
.ad-verse { margin: 1.2rem 0 0; text-align: center; padding: 1.2rem 1.6rem .9rem; background: var(--page); border: 1px solid var(--frame); border-radius: 8px;
    box-shadow: inset 0 0 0 4px var(--page), inset 0 0 0 5px color-mix(in srgb, var(--frame) 70%, transparent), var(--shadow); }
.ad-verse-text { font-size: calc(var(--qsize) * .9); line-height: 2.1; margin: 0; color: var(--text); }
.ad-verse-ref { margin: .4rem 0 0; font-size: .85rem; }

/* ---------- Adhkar (rd-layout) ---------- */
.ak-main { max-width: 56rem; margin: 0 auto; width: 100%; }
.ak-main h2:first-of-type { margin-top: 1.4rem; }
.ak-head { text-align: center; margin: 0 0 1rem; }
.ak-head h1 { font-size: 1.9rem; color: var(--ink-title); margin: 0; }
/* Rubrique du moment : grande carte enluminée */
.ak-suggest {
    display: grid; gap: .15rem; text-align: center; padding: 1.4rem 1.6rem 1.2rem; margin: 0 0 .5rem; color: var(--text); position: relative;
    background: var(--page); border: 1px solid var(--frame); border-radius: 8px;
    box-shadow: inset 0 0 0 5px var(--page), inset 0 0 0 6px var(--frame), inset 0 0 0 9px var(--page), inset 0 0 0 10px color-mix(in srgb, var(--frame) 55%, transparent), var(--shadow-lg);
    transition: transform .2s, box-shadow .2s;
}
.ak-suggest:hover { text-decoration: none; transform: translateY(-2px); box-shadow: inset 0 0 0 5px var(--page), inset 0 0 0 6px var(--gold), inset 0 0 0 9px var(--page), inset 0 0 0 10px color-mix(in srgb, var(--frame) 55%, transparent), var(--shadow-lg), var(--glow); }
.ak-suggest::before, .ak-suggest::after { content: ""; position: absolute; top: 2px; width: 22px; height: 22px; background: var(--frame); opacity: .9; -webkit-mask: var(--pat-rosette) center/contain no-repeat; mask: var(--pat-rosette) center/contain no-repeat; }
.ak-suggest::before { left: 2px; } .ak-suggest::after { right: 2px; }
.ak-suggest-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); font-weight: 600; }
html[lang=ar] .ak-suggest-label { text-transform: none; letter-spacing: 0; font-size: .95rem; }
.ak-suggest-title { font-family: var(--font-title); font-size: 2rem; color: var(--ink-title); line-height: 1.3; }
.ak-suggest-count { font-size: .9rem; color: var(--muted); }
.ak-main .adk-cats { columns: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .4rem; }
.ak-main .adk-cats li { padding: 0; }
.ak-main .adk-cats li::before { display: none; }
.ak-main .adk-cats li a { display: block; padding: .5rem .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.ak-main .adk-cats li a:hover { text-decoration: none; border-color: var(--gold); box-shadow: var(--glow); }
.ak-main .adk-cats li .muted { font-family: var(--font-ui); font-size: .8rem; margin-inline-start: .3rem; }
/* Colonne : progression, rubriques rapides */
.rd-panel .adk-status { display: grid; gap: .4rem; margin: 0; }
.rd-panel .adk-status-n { font-size: 1.6rem; font-family: var(--font-title); color: var(--accent); }
.rd-panel .adk-status-n b { font-size: 2.2rem; }
.rd-panel .adk-status .adk-bar { width: 100%; }
.rd-panel .adk-status button { width: 100%; justify-content: center; margin-top: .2rem; }
.ak-quick { display: grid; gap: .3rem; }
.ak-quick a { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .4rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: var(--font-arabic); font-size: 1rem; transition: all .15s; }
.ak-quick a:hover { text-decoration: none; border-color: var(--gold); }
.ak-quick a.active { background: linear-gradient(to bottom, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: var(--accent-3); }
.ak-quick a.active .muted { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
.ak-quick .muted { font-family: var(--font-ui); font-size: .8rem; }
.rd-panel .adk-filter { max-width: none; margin: 0; font-family: var(--font-arabic); }

/* ---------- Médaillons des rubriques (wwwroot/img/sections) ---------- */
.nav-ico { width: 22px; height: 22px; margin-inline-end: .4rem; vertical-align: -5px; border-radius: 50%; box-shadow: 0 0 0 1px rgb(255 255 255 / .25); }
.nav a { display: inline-flex; align-items: center; }
.home-tiles .tile-img { width: 84px; height: 84px; border-radius: 50%; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold-2), 0 8px 18px -8px rgb(0 0 0 / .5); transition: transform .3s; }
.home-tiles .tile:hover .tile-img { transform: scale(1.06) rotate(-4deg); }
/* En-tête de la colonne latérale : médaillon de la section devant le titre */
main[data-section] .rd-title h1::before { content: ""; display: inline-block; width: 30px; height: 30px; margin-inline-end: .45rem; vertical-align: -8px; border-radius: 50%; background: var(--sec-img) center/contain no-repeat; box-shadow: 0 0 0 2px var(--gold-2); }
main[data-section=quran] { --sec-img: url("/img/sections/quran.png"); }
main[data-section=hadith] { --sec-img: url("/img/sections/hadith.png"); }
main[data-section=adan] { --sec-img: url("/img/sections/adan.png"); }
main[data-section=adkar] { --sec-img: url("/img/sections/adkar.png"); }
main:not([data-section=quran]):not([data-section=hadith]):not([data-section=adan]):not([data-section=adkar]) .rd-title h1::before { display: none; }
@media (max-width: 760px) { .nav-ico { width: 18px; height: 18px; margin-inline-end: .25rem; } .home-tiles .tile-img { width: 64px; height: 64px; } }

/* ---------- Tajwīd (rd-layout) ---------- */
.tj-main { max-width: 52rem; margin: 0 auto; width: 100%; font-family: var(--font-arabic); font-size: 1.15rem; line-height: 2; }
.tj-head { text-align: center; padding: 1.3rem 1.6rem 1rem; margin: 0 0 1.4rem; position: relative;
    background: var(--page); border: 1px solid var(--frame); border-radius: 8px;
    box-shadow: inset 0 0 0 5px var(--page), inset 0 0 0 6px var(--frame), inset 0 0 0 9px var(--page), inset 0 0 0 10px color-mix(in srgb, var(--frame) 55%, transparent), var(--shadow-lg); }
.tj-head::before, .tj-head::after { content: ""; position: absolute; top: 2px; width: 22px; height: 22px; background: var(--frame); opacity: .9; -webkit-mask: var(--pat-rosette) center/contain no-repeat; mask: var(--pat-rosette) center/contain no-repeat; }
.tj-head::before { left: 2px; } .tj-head::after { right: 2px; }
.tj-head .surah-title { min-width: 50%; font-size: calc(var(--qsize) * .85); }
.tj-head-sub { font-family: var(--font-title); font-size: 1.35rem; color: var(--ink-title); margin: .6rem 0 0; }
.tj-head .muted { font-size: 1rem; line-height: 1.8; margin: .3rem 0 0; }
.tj-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.4rem 1.1rem; margin: 0 0 1rem; border-inline-start: 4px solid var(--gold-2); scroll-margin-top: calc(var(--topbar-h, 68px) + 1rem); }
.tj-sec h2 { font-family: var(--font-arabic); font-size: 1.5rem; margin: 0 0 .6rem; color: var(--ink-title); }
.tj-sec h3 { font-family: var(--font-arabic); font-size: 1.2rem; color: var(--accent); margin: .9rem 0 .3rem; }
.tj-sec p { margin: 0 0 .6rem; text-align: justify; }
.tj-list { margin: 0 0 .6rem; padding-inline-start: 1.3rem; }
.tj-list li { margin: 0 0 .3rem; text-align: justify; }
.tj-list li::marker { color: var(--gold); }
.tj-k { color: var(--accent); font-weight: 700; }
.tj-note { font-size: 1rem; color: var(--text-2); border-inline-start: 3px solid var(--gold); padding-inline-start: .7rem; background: color-mix(in srgb, var(--gold-3) 18%, transparent); border-radius: var(--radius-sm); padding-block: .3rem; }
.tj-refs a { white-space: nowrap; }
.tj-toc { margin: 0; padding: 0 0 0 0; list-style: none; counter-reset: tj; display: grid; gap: .15rem; }
.tj-toc li { counter-increment: tj; }
.tj-toc a { display: flex; align-items: baseline; gap: .5rem; padding: .3rem .6rem; border-radius: var(--radius-sm); color: var(--text); font-family: var(--font-arabic); font-size: 1rem; border: 1px solid transparent; transition: all .15s; }
.tj-toc a::before { content: counter(tj); font-family: var(--font-ui); font-size: .75rem; color: var(--gold); min-width: 1.3em; }
.tj-toc a:hover { text-decoration: none; background: var(--surface-2); }
.tj-toc a.active { background: linear-gradient(to bottom, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: var(--accent-3); }
.tj-toc a.active::before { color: var(--gold-3); }
@media (max-width: 760px) { .tj-main { font-size: 1.05rem; } .tj-sec { padding: .8rem .9rem .9rem; } }

/* ---------- Hadiths (rd-layout) ---------- */
.hd-main { max-width: 56rem; margin: 0 auto; width: 100%; }
.hd-colhead { margin: 0 0 1rem; text-align: center; }
.hd-colhead h1 { font-size: 1.7rem; margin: 0; color: var(--ink-title); }
.hd-colhead h1.ar { font-family: var(--font-arabic); font-size: 1.9rem; }
.hd-colhead .muted { margin: .2rem 0 0; }
.hd-results-h { margin-top: 0; }
.hd-q { font-family: var(--font-arabic); font-weight: 400; font-size: 1rem; }
/* Hadith mis en avant (du jour, page d'un hadith) : cadre enluminé */
.hd-featured .hd {
    background: var(--page); border: 1px solid var(--frame); border-radius: 8px; padding: 1.6rem 1.8rem 1.1rem; border-inline-start-width: 1px;
    box-shadow: inset 0 0 0 5px var(--page), inset 0 0 0 6px var(--frame), inset 0 0 0 9px var(--page), inset 0 0 0 10px color-mix(in srgb, var(--frame) 55%, transparent), var(--shadow-lg);
}
.hd-featured .hd::before { top: 12px; inset-inline-end: 12px; opacity: .6; }
.hd-featured .hd-matn { font-size: 1.55rem; }
.hd-today .hd { border-color: var(--frame); }
/* Liste des livres d'un recueil : cartes sur deux colonnes */
.hd-books { columns: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: .5rem; }
.hd-books li { padding: 0; }
.hd-books li a { display: flex; align-items: baseline; gap: .5rem; padding: .55rem .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s; }
.hd-books li a:hover { text-decoration: none; border-color: var(--gold); box-shadow: var(--glow); transform: translateY(-1px); }
.hd-books .hd-bn { min-width: 1.8em; }
.hd-books .hd-bt { flex: 1; }
.hd-books .hd-bc { font-family: var(--font-ui); font-size: .8rem; }
.hd-panel-book { font-size: 1.05rem; margin: 0 0 .5rem; color: var(--ink-title); line-height: 1.6; }
.rd-panel .hd-form .check { margin: .1rem 0 .4rem; }
.rd-panel .hd-form input[type=search] { font-family: var(--font-arabic); font-size: 1.05rem; }
.hd-booknav .btn .ar { font-size: 1em; }
@media (max-width: 760px) {
    .hd-featured .hd { padding: 1rem .9rem .8rem; box-shadow: inset 0 0 0 3px var(--page), inset 0 0 0 4px var(--frame); }
    .hd-featured .hd-matn { font-size: 1.35rem; }
}

/* ---------- Adhan : son à l'heure de la prière ---------- */
.adhan-now { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin: 1rem 0;
    padding: .9rem 1.2rem; border-radius: var(--radius); background: linear-gradient(to bottom, var(--accent-2), var(--accent-3)); color: var(--accent-ink);
    border: 1px solid var(--accent-3); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold-2), var(--shadow-lg); animation: adhan-glow 2s ease-in-out infinite; }
@keyframes adhan-glow { 50% { box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold), 0 0 30px color-mix(in srgb, var(--gold) 45%, transparent); } }
.adhan-now-text { font-size: 1.2rem; font-weight: 700; font-family: var(--font-title); color: var(--gold-3); }
.adhan-set { padding: 1rem 1.3rem; margin: 1.5rem 0 1rem; border-inline-start: 4px solid var(--gold-2); }
.adhan-set h2 { margin: 0 0 .7rem; font-size: 1.15rem; }
.adhan-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin-bottom: .8rem; }
.adhan-switch { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; }
.adhan-switch input { width: 1.2rem; height: 1.2rem; }
.adhan-state { font-size: .9rem; color: var(--ok); }
.adhan-state.warn { color: var(--miss); font-weight: 600; }
.adhan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .7rem 1rem; }
.adhan-grid label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.adhan-grid select { font: inherit; padding: .35rem .5rem; color: var(--text); }
.adhan-prayers { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: .8rem 0 0; padding: .4rem .8rem; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
.adhan-prayers legend { font-size: .85rem; color: var(--muted); padding: 0 .3rem; }
.adhan-prayers label.inline { display: inline-flex; gap: .35rem; align-items: center; }
.adhan-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0 .4rem; }
.adhan-help, .adhan-credit { font-size: .85rem; margin: .3rem 0 0; }

/* ---------- Hadiths : favoris et copie ---------- */
.hd-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.hd-act { display: inline-flex; gap: .35rem; margin-inline-end: auto; order: 9; }
.hd-act button { padding: .15rem .6rem; font-size: .82rem; min-height: 0; }
.hd-fav[aria-pressed="true"] { color: var(--gold-ink); border-color: var(--gold); background: linear-gradient(to bottom, var(--gold-3), var(--gold-2)); }
.hd-favitem { margin-bottom: 1.2rem; }
.hd-favitem .hd { margin-bottom: .3rem; }
.hd-note { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); }
.hd-note textarea { font: inherit; font-size: .95rem; color: var(--text); padding: .4rem .6rem; resize: vertical; }

/* ---------- Impression ---------- */
@media print {
    body::before, .topbar, .footer, .player, .rd-pos, .toolbar, .pager, .reader-tools, .subnav { display: none !important; }
    body { background: #fff; color: #000; }
    .mp { box-shadow: none; break-inside: avoid; }
}
