/* ===== CHIFFRES : police claire (Roboto/Arial du téléphone) ===== */
@font-face {
  font-family: 'Chiffres';
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'), local('Arial'), local('Helvetica'), local('Noto Sans');
  unicode-range: U+0030-003A, U+0025;
}
@font-face {
  font-family: 'Chiffres';
  font-weight: 700;
  src: local('Roboto Bold'), local('Roboto-Bold'), local('Arial Bold'), local('Arial-BoldMT'), local('Noto Sans Bold');
  unicode-range: U+0030-003A, U+0025;
}

/* ===== POLICE : changer ici si besoin ===== */
:root {
  --font: 'Chiffres', 'Iceland', 'Segoe UI', Arial, sans-serif;
  --bg: #0a0d12;
  --card: #131a22;
  --gold: #d4af37;
  --txt: #f2f2f2;
  --muted: #9aa4af;
  --red: #8b2a2e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 20px;
  -webkit-tap-highlight-color: transparent;
}

body { padding-bottom: 150px; }

h1, h2, h3 { margin: 0 0 8px; font-weight: 700; }
h1 { color: var(--gold); font-size: 2rem; padding: 14px 16px 4px; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.4rem; }
a { color: var(--gold); }
hr { border: 0; border-top: 1px solid #2a3440; margin: 14px 0; }

.muted { color: var(--muted); }
.small { font-size: .85rem; margin-top: 4px; }
.gold-text { color: var(--gold); }
.label { color: #b8962f; letter-spacing: 2px; font-size: .8rem; }
.right { text-align: end; }

main { padding: 0 16px; }
.panel { display: none; }
.panel.active { display: block; }

/* Onglets */
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 3px solid #2a3440; margin-bottom: 14px; }
#radioTabs { padding: 0; }
.tab {
  flex: 1; background: none; border: 0; color: var(--muted);
  font: inherit; font-weight: 700; padding: 12px 4px; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -3px;
}
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* Cartes */
.card {
  background: var(--card); border: 1px solid #263140; border-radius: 22px;
  padding: 18px; margin-bottom: 16px;
}
.card.gold { border-color: var(--gold); }

/* Boutons */
.row { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.btn {
  font: inherit; font-weight: 700; padding: 12px 18px; border-radius: 16px;
  border: 1px solid var(--gold); background: transparent; color: var(--gold); cursor: pointer;
}
.btn.icon { padding: 12px 14px; margin-inline-start: auto; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; flex: 1; }
.btn.yellow { background: var(--gold); color: #111; flex: 1; }

select {
  font: inherit; background: #0f151c; color: var(--txt);
  border: 1px solid #2f3b4a; border-radius: 12px; padding: 10px; flex: 1;
}

.status { margin-top: 8px; color: var(--muted); font-size: .9rem; min-height: 1.2em; }

/* Prochaine prière */
.next { display: flex; justify-content: space-between; align-items: center; }
.next-name { color: var(--gold); font-size: 2.4rem; font-weight: 700; }
.next-time { font-size: 2.4rem; font-weight: 700; }

/* Horaires */
.time-row { display: flex; justify-content: space-between; padding: 14px 0; border-top: 1px solid #2a3440; font-size: 1.4rem; }
.time-row.info { color: var(--muted); }
.time-row.next-on { color: var(--gold); font-weight: 700; }

/* Listes (mosquées, radios) */
.list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.item {
  border: 1px solid var(--gold); border-radius: 18px; padding: 14px 16px;
  background: #0d1117; text-align: start; font: inherit; color: var(--txt); cursor: pointer; width: 100%;
}
.item.playing { background: #1f2630; }
.item .sub { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }
.item a.go { display: inline-block; margin-top: 8px; font-weight: 700; }

/* Pastilles pays */
.chips { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 8px; }
.chip {
  flex: none; font: inherit; font-weight: 700; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--gold); background: transparent; color: var(--txt); cursor: pointer;
}
.chip.active { background: var(--gold); color: #111; }

/* Lecteur fixe en bas */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--bg); border-top: 1px solid #263140; padding: 10px 16px 16px;
}
.pstatus { min-height: 1.4em; }

footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 18px 16px; }

/* Pages À propos / Confidentialité */
.page { max-width: 720px; margin: 0 auto; padding: 16px; line-height: 1.5; }
.social a {
  display: block; text-align: center; text-decoration: none; font-weight: 700;
  padding: 14px; border-radius: 16px; margin-bottom: 12px; color: #fff;
}
.yt { background: #ff0000; } .ig { background: linear-gradient(45deg,#f09433,#dc2743,#bc1888); }
.tt { background: #111; border: 1px solid #333; } .fb { background: #1877f2; }
.sc { background: #fffc00; color: #000 !important; } .xx { background: #000; border: 1px solid #333; }

/* corrige : l'attribut hidden doit vraiment cacher */
[hidden] { display: none !important; }
.btn { text-decoration: none; }
body { padding-bottom: 170px; }


/* ================= NOUVEAUX ONGLETS ================= */
#mainTabs { overflow-x: auto; scrollbar-width: none; }
#mainTabs::-webkit-scrollbar { display: none; }
#mainTabs .tab { flex: none; padding: 12px 14px; white-space: nowrap; }

body.mushaf-on #player { display: none !important; }
body.mushaf-on footer { display: none; }
body.mushaf-on { padding-bottom: 130px; }

/* Mushaf */
.m-head { display: flex; gap: 10px; margin-bottom: 10px; }
.m-pick { flex: 1; font: inherit; font-weight: 700; padding: 10px; border-radius: 12px; border: 1px solid #6b8f5a; background: #b8d4a0; color: #15361f; cursor: pointer; }
.m-paper {
  background: #f7f6e8; color: #111; border-radius: 16px; padding: 18px 14px; min-height: 60vh;
  font-family: 'Amiri Quran', 'Scheherazade New', 'Traditional Arabic', serif;
  font-size: var(--mfs, 30px); line-height: 2.3; direction: rtl; text-align: justify;
}
.m-paper.night { background: #10161d; color: #eaeaea; }
.m-title { text-align: center; font-size: 1.3em; color: #1d6b43; margin-bottom: 2px; }
.m-paper.night .m-title { color: var(--gold); }
.m-sub { text-align: center; direction: ltr; font-family: var(--font); font-size: 16px; color: #6a6a5a; line-height: 1.4; margin-bottom: 8px; }
.m-bism { text-align: center; margin: 8px 0 10px; }
.m-note { direction: ltr; font-family: var(--font); font-size: 16px; color: #8a4b00; line-height: 1.4; }
.m-flow { margin: 0; }
.m-flow .v { cursor: pointer; border-radius: 8px; padding: 0 2px; }
.m-num { color: #1d6b43; font-size: .8em; }
.m-paper.night .m-num { color: var(--gold); }
.sel { background: #fff3b0; }
.m-paper.night .sel { background: #3a3513; }
.now { background: #c8f0cf !important; }
.m-paper.night .now { background: #1c4a2a !important; }
.m-row { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid #0002; border-radius: 8px; cursor: pointer; }
.m-ar { flex: 1.25; }
.m-trt { flex: 1; direction: ltr; text-align: left; font-family: Georgia, 'Times New Roman', serif; font-size: 17px; line-height: 1.5; color: #333; }
.m-paper.night .m-trt { color: #cfd6dd; }

.m-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: none; justify-content: space-around;
  background: #cfe3bf; padding: 8px 4px 10px; border-top: 1px solid #8fae78;
}
body.mushaf-on .m-bar { display: flex; }
.m-bar button { flex: 1; background: none; border: 0; font: inherit; font-size: .72rem; color: #15361f; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.m-bar .ic { width: 42px; height: 42px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; box-shadow: 0 1px 4px #0004; }

.m-auto { position: fixed; left: 10px; right: 10px; bottom: 96px; z-index: 31; display: none; align-items: center; gap: 10px; justify-content: space-between; background: #cfe3bf; color: #15361f; border-radius: 14px; padding: 8px 12px; box-shadow: 0 2px 8px #0006; }
.m-auto.on { display: flex; }
body:not(.mushaf-on) .m-auto { display: none !important; }
.m-auto button { font: inherit; font-weight: 700; font-size: 1.3rem; min-width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; color: #15361f; cursor: pointer; }

.sheet { position: fixed; inset: 0; z-index: 60; background: #000b; display: none; align-items: flex-end; }
.sheet.on { display: flex; }
.sheet-in { background: var(--card); width: 100%; max-height: 82vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 16px; }
.sheet-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sheet-top h3 { margin: 0; }
.m-search { width: 100%; font: inherit; padding: 12px; border-radius: 12px; border: 1px solid #2f3b4a; background: #0f151c; color: var(--txt); margin-bottom: 10px; }
.bk-row { display: flex; gap: 8px; align-items: stretch; }
.bk-row .item { flex: 1; }
.m-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #2a3440; }
.m-line select { flex: 0 1 55%; }
.m-fz { display: flex; align-items: center; gap: 10px; }
.toast { pointer-events: none; position: fixed; left: 16px; right: 16px; bottom: 170px; z-index: 80; background: #222; color: #fff; padding: 12px 14px; border-radius: 12px; text-align: center; }

/* Adhkar */
.adh-prog { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.adh-bar { flex: 1; min-width: 80px; height: 8px; background: #2a3440; border-radius: 8px; overflow: hidden; }
.adh-fill { height: 100%; background: var(--gold); }
.adh-card { background: var(--card); border: 1px solid #263140; border-radius: 20px; padding: 16px; margin-bottom: 14px; }
.adh-card.done { opacity: .55; border-color: #2d6a3d; }
.adh-ar { font-family: 'Amiri Quran', 'Traditional Arabic', serif; font-size: 1.7rem; line-height: 2.1; direction: rtl; text-align: center; }
.adh-fr { color: var(--muted); font-size: .95rem; margin: 8px 0 12px; line-height: 1.4; }
.cnt-btn { width: 100%; font: inherit; font-weight: 700; padding: 14px; border-radius: 16px; border: 0; background: var(--gold); color: #111; cursor: pointer; }
.adh-card.done .cnt-btn { background: #2d6a3d; color: #fff; }
.tasbih-n { text-align: center; font-size: 4.5rem; color: var(--gold); font-weight: 700; }
.tasbih-goals { display: flex; gap: 10px; justify-content: center; margin: 10px 0; }
.tasbih-go { font-size: 2.4rem; padding: 22px; margin-bottom: 12px; }

/* TV */
#tvVideo { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; }
.tv-links { display: flex; gap: 10px; flex-wrap: wrap; }

/* barre du Mushaf : 6 boutons qui tiennent sur 360 px */
.m-bar button { min-width: 0; font-size: .62rem; padding: 0 1px; }
.m-bar .ic { width: 38px; height: 38px; font-size: 1.15rem; }

/* ===== Extensions Riamo Quran ===== */
.brand-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.brand-row h1{flex:1}
.lang-control{display:flex;align-items:center;gap:5px;margin:0 16px 4px;color:var(--gold);font-size:.9rem}
.lang-control select{width:auto;min-width:66px;padding:8px 10px;border:1px solid #655629;border-radius:12px;background:#131a22;color:var(--txt);font:inherit;font-size:.85rem}
.tv-wrap{position:relative;width:100%;background:#000;border-radius:16px;overflow:hidden;aspect-ratio:16/9}
.tv-wrap video{display:block;width:100%;height:100%;object-fit:contain;background:#000}
.tv-wrap video.tv-cover{object-fit:cover}
.tv-overlay{position:absolute;inset-inline-end:10px;top:10px;display:flex;gap:8px;opacity:0;transition:opacity .2s}
.tv-wrap:hover .tv-overlay,.tv-wrap:focus-within .tv-overlay{opacity:1}
.tv-overlay .btn{background:#10151dcc;padding:7px 10px;font-size:.8rem}
.tv-controls{margin:10px 0 4px}
.tv-controls .btn{flex:1}
.tv-wrap:fullscreen{width:100vw;height:100vh;aspect-ratio:auto;border-radius:0;display:grid;place-items:center}
.tv-wrap:fullscreen video{width:100%;height:100%;max-height:100vh}
@media(max-width:520px){
  .brand-row h1{font-size:1.65rem;padding-left:12px}
  .lang-control{margin-right:12px}
  .tabs{overflow-x:auto;justify-content:flex-start}
  .tabs .tab{min-width:76px;flex:0 0 auto}
  .tv-overlay{opacity:1}
}

/* ===== Arabe : interface de droite à gauche ===== */
html[lang="ar"] { --font: 'Chiffres', 'Tajawal', 'Segoe UI', Arial, sans-serif; }
html[dir="rtl"] .m-sub, html[dir="rtl"] .m-note { direction: rtl; }
html[dir="rtl"] .label { letter-spacing: 0; }
html[dir="rtl"] .tabs { direction: rtl; }
html[dir="rtl"] .adh-fr, html[dir="rtl"] .item, html[dir="rtl"] .m-line { text-align: start; }

/* =====================================================================
   v2 — PWA plein écran, icônes, Adhan, Qibla, crédit propre
   ===================================================================== */
:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); }
html { -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }
html.standalone body { -webkit-user-select: none; user-select: none; }
html.standalone .m-paper, html.standalone .adh-ar, html.standalone .adh-tr, html.standalone .adh-fr, html.standalone .m-trt { -webkit-user-select: text; user-select: text; }

/* Encoche / barre d'état en mode installé */
.top { padding-top: var(--sat); background: var(--bg); }
@media (display-mode: standalone) { .top { position: sticky; top: 0; z-index: 20; } }
footer { padding-bottom: calc(18px + var(--sab)); }
body { padding-bottom: calc(170px + var(--sab)); }
body.mushaf-on { padding-bottom: calc(130px + var(--sab)); }

/* Barres fixes du bas : respect de la zone sûre (jamais masquées ni chevauchées) */
.player { padding-bottom: calc(16px + var(--sab)); }
.m-bar { padding-bottom: calc(10px + var(--sab)); }
.m-auto { bottom: calc(96px + var(--sab)); }
.toast { bottom: calc(170px + var(--sab)); }
body.mushaf-on .toast { bottom: calc(150px + var(--sab)); }
.sheet-in { padding-bottom: calc(16px + var(--sab)); }

/* Icônes SVG */
.ico { width: 1.2em; height: 1.2em; flex: none; vertical-align: -.2em; }
.with-ico { display: flex; align-items: center; gap: 10px; }
.m-bar .ic .ico { width: 22px; height: 22px; color: #15361f; }

/* Onglets : icône au-dessus du libellé */
#mainTabs .tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .78rem; }
#mainTabs .tab .ico { width: 1.7em; height: 1.7em; }
#mainTabs .tab span { line-height: 1.1; }

/* Horaires + bouton Adhan par prière */
.time-row { align-items: center; }
.t-end { display: flex; align-items: center; gap: 12px; }
.adh-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; cursor: pointer;
  background: #0f151c; border: 1px solid #2f3b4a; color: var(--muted); padding: 0; font-size: 1.15rem;
}
.adh-btn[data-mode="adhan"] { color: var(--gold); border-color: var(--gold); background: #1a2230; }
.adh-btn[data-mode="notify"] { color: #9ad0ff; border-color: #3d6b94; }
.adh-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.time-row.next-on .adh-btn[data-mode="off"] { color: #7d8794; }

/* Carte réglages Adhan */
#adhanCard .adh-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
#adhanCard .adh-set select { flex: 0 1 58%; min-width: 0; }
#adhanCard input[type=range] { flex: 0 1 58%; min-width: 0; accent-color: var(--gold); }
#adhanCard .ok { color: #55d68a; }
.adhan-banner {
  position: fixed; left: 10px; right: 10px; top: calc(10px + var(--sat)); z-index: 70; display: flex; align-items: center; gap: 12px;
  background: #1f2a1f; border: 1px solid var(--gold); color: var(--txt); border-radius: 16px; padding: 10px 12px; box-shadow: 0 4px 18px #000a;
}
.adhan-banner span { flex: 1; font-weight: 700; }
.adhan-banner .btn { flex: none; padding: 8px 14px; }

/* Adhkar : options + translittération */
.adh-opts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0 4px; }
.adh-opt { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); min-width: 0; }
.adh-opt select { flex: 0 1 auto; min-width: 0; max-width: 170px; padding: 8px 10px; font-size: .9rem; }
.adh-check input { width: 20px; height: 20px; accent-color: var(--gold); }
.adh-tr { direction: ltr; text-align: center; font-style: italic; color: #d9c98a; font-size: .95rem; line-height: 1.5; margin: 6px 0 2px; font-family: 'Segoe UI', Arial, sans-serif; }
html[dir="rtl"] .adh-opts { direction: rtl; }

/* Qibla */
.q-card { text-align: center; }
.q-top { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.q-deg { font-size: 1.7rem; font-weight: 700; color: var(--gold); }
.q-dial {
  --qf: #0f2e24; --qr: #2ecc85; --qt: #cfeee0; --qx: #e8fff5; --qn: #2ecc85; --qn2: #1f7a54; --qm: #123f2f;
  width: min(100%, 340px); margin: 8px auto 4px; aspect-ratio: 320 / 348; transition: filter .25s;
}
.q-dial svg { width: 100%; height: 100%; display: block; overflow: visible; }
.q-dial.skin-2 { --qf: #f4f1e8; --qr: #8b2a2e; --qt: #333; --qx: #222; --qn: #c0392b; --qn2: #333; --qm: #fff; }
.q-dial.skin-3 { --qf: #14110a; --qr: #d4af37; --qt: #d4af37; --qx: #f3e3a5; --qn: #d4af37; --qn2: #7a6420; --qm: #241d0c; }
.q-dial.skin-4 { --qf: #ffffff; --qr: #2e7d5b; --qt: #444; --qx: #222; --qn: #00c875; --qn2: #6de8b8; --qm: #e9fff5; }
.q-face { fill: var(--qf); }
.q-ring { stroke: var(--qr); stroke-width: 4; }
.q-tick { stroke: var(--qt); stroke-width: 1.4; }
.q-tick.maj { stroke-width: 2.4; }
.q-tick.card { stroke-width: 3.4; }
.q-num { fill: var(--qt); font: 700 9px Arial, sans-serif; opacity: .8; }
.q-dir { fill: var(--qx); font: 700 22px Arial, 'Tajawal', sans-serif; }
.q-dir.n { fill: #e5484d; }
.q-needle { fill: var(--qn); } .q-needle2 { fill: var(--qn2); }
.q-hub { fill: var(--qf); stroke: var(--qr); stroke-width: 2; }
.q-mark { fill: var(--qm); stroke: var(--qr); stroke-width: 3; }
.q-kaaba { fill: #111; } .q-band { fill: #d4af37; }
.q-pointer { fill: var(--gold); }
.q-dial.facing .q-ring { stroke: #2ecc85; filter: drop-shadow(0 0 7px #2ecc85); }
.q-msg { min-height: 1.5em; font-weight: 700; margin-top: 6px; }
.q-msg.ok { color: #55d68a; }
.q-head { min-height: 1.2em; }
.q-start { width: 100%; margin-top: 10px; }
.q-skins { display: flex; gap: 12px; justify-content: center; margin: 12px 0 4px; }
.q-skin { width: 42px; height: 42px; border-radius: 50%; border: 3px solid #2a3440; cursor: pointer; padding: 0; }
.q-skin.on { border-color: var(--gold); box-shadow: 0 0 0 2px #d4af3744; }
.q-skin.s1 { background: radial-gradient(circle, #0f2e24 55%, #2ecc85 58%); }
.q-skin.s2 { background: radial-gradient(circle, #f4f1e8 55%, #8b2a2e 58%); }
.q-skin.s3 { background: radial-gradient(circle, #14110a 55%, #d4af37 58%); }
.q-skin.s4 { background: radial-gradient(circle, #fff 55%, #2e7d5b 58%); }

/* Crédit : texte normal dans le flux (footer + menu Plus), jamais fixe */
.credit { margin-top: 10px; }
.credit-box { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 10px; }
.credit-link { color: var(--muted); font-size: .8rem; text-decoration: none; }
.credit-link:hover { color: var(--gold); }
.credit-install { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.m-more .credit-box { margin-top: 14px; }

/* Au cas où un élément Netlify injecté échapperait au script : jamais au-dessus de la navigation */
html:not(.nl-preview) #netlify-drawer, html:not(.nl-preview) netlify-drawer, html:not(.nl-preview) iframe[src*="netlify"] { display: none !important; }

@media (max-width: 380px) {
  #mainTabs .tab { min-width: 68px; padding: 10px 8px; }
  .time-row { font-size: 1.2rem; }
  .adh-btn { width: 40px; height: 40px; }
}

.time-row { gap: 10px; }
.time-row > span:first-child { flex: 1; min-width: 0; }
#mPlayIc { font-size: 1rem; line-height: 1; }
