/* Ihsan — design « Bleu & Or » (converti depuis Stitch, offline, sans CDN). */
@import url("../fonts/fonts.css");

:root {
  --bg: #fdfcf0;
  --surface-lowest: #ffffff;
  --surface-low: #f2f8f6;
  --surface: #efeee0;
  --surface-high: #e7e6d8;
  --primary: #0d9488;
  --primary-container: #3b82f6;
  --on-primary: #ffffff;
  --secondary: #b45309;
  --secondary-container: #f59e0b;
  --on-surface: #1e293b;
  --on-surface-variant: #475569;
  --outline: #94a3b8;
  --outline-variant: #d8d6c4;
  --error: #ba1a1a;
  --shadow: 0 4px 20px rgba(13, 148, 136, .1);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ar: "Noto Sans Arabic", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--on-surface);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain; padding-bottom: 84px;
}

/* En-tête */
.topbar {
  position: sticky; top: 0; z-index: 40; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.avatar { width: 44px; height: 44px; border-radius: 999px; background: var(--surface-low); border: 2px solid var(--primary); display: grid; place-items: center; font-size: 1.5rem; }
.brand-fr { font-size: 1.6rem; color: var(--primary); }
.brand-ar { display: none; }
.hud { display: flex; gap: 8px; }
.hud-pill { display: flex; align-items: center; gap: 5px; background: var(--surface-lowest); border: 2px solid var(--surface-high); color: var(--on-surface); font-weight: 800; padding: 7px 14px; border-radius: 999px; white-space: nowrap; font-size: .95rem; }
.hud-pill.streak { background: #fbecc9; border-color: #f5d98c; color: #b45309; }
.hud-pill.streak b { color: #b45309; }
.hud-pill.star { background: #e6f3f0; border-color: #b9e2da; }
.hud-pill.star .s { color: var(--primary); font-size: 1.05rem; }

.reciter-row { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .85rem; color: var(--on-surface-variant); }
.reciter-row select { font: inherit; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--outline-variant); background: var(--surface-lowest); color: var(--on-surface); max-width: 220px; }
.reciter-mode { margin: 8px 0 0; font-size: .78rem; color: var(--on-surface-variant); text-align: center; line-height: 1.4; }

main { max-width: 760px; margin: 0 auto; padding: 20px; }
.tab-title { font-size: 1.5rem; font-weight: 800; margin: 4px 0 12px; }

/* Accueil — masqué pour coller à la maquette (série dans le bandeau, stats onglet Progrès) */
.welcome { display: none; }
.tab .bento { display: none; }
.welcome h2 { font-size: 1.9rem; font-weight: 800; margin: 8px 0 6px; letter-spacing: -.02em; }
.welcome p { color: var(--on-surface-variant); font-size: 1.05rem; margin: 0; }

.bento { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 24px; }
.stat-card {
  background: var(--surface-lowest); border: 1px solid var(--outline-variant);
  border-radius: 18px; padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px; min-height: 148px; justify-content: space-between;
}
.stat-top { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .85rem; }
.stat-top.primary { color: var(--primary); }
.stat-top.gold { color: var(--secondary); }
.stat-big { font-size: 2.2rem; font-weight: 800; }
.stat-big span { font-size: 1.1rem; font-weight: 500; color: var(--outline); }
.stat-sub { font-size: .75rem; color: var(--outline); }
.mini-track { height: 6px; background: rgba(13,148,136,.12); border-radius: 999px; overflow: hidden; }
.mini-fill { height: 100%; width: 0%; background: var(--primary); border-radius: 999px; transition: width .4s ease; }

/* Session en cours (carte blanche + bouton Commencer azur) */
.quest {
  margin-top: 20px; position: relative; overflow: hidden;
  background: var(--surface-lowest); color: var(--on-surface); border: 2px solid var(--outline-variant);
  border-radius: 24px; padding: 24px;
}
.quest-tag { background: #dbe8ff; color: #1d4ed8; padding: 6px 14px; border-radius: 999px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; display: inline-block; }
.quest h3 { font-size: 1.5rem; font-weight: 800; margin: 14px 0 16px; }
.quest p { display: none; }
.quest-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.quest-track { flex: 1; height: 16px; background: var(--surface); border-radius: 999px; overflow: hidden; }
.quest-fill { height: 100%; width: 0%; background: var(--primary-container); border-radius: 999px; transition: width .4s ease; }
.btn-commencer { width: 100%; background: var(--primary-container); color: #fff; border: none; padding: 17px; border-radius: 18px; font-family: var(--font); font-weight: 800; font-size: 1.15rem; cursor: pointer; box-shadow: 0 4px 0 0 #2563eb; transition: transform .12s, box-shadow .12s; }
.btn-commencer:active { transform: translateY(3px); box-shadow: 0 1px 0 0 #2563eb; }

/* Section head */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 28px 0 14px; }
.section-head h2 { font-size: 1.3rem; font-weight: 800; margin: 0; }
.section-head p { color: var(--on-surface-variant); font-size: .85rem; margin: 2px 0 0; }
.link-btn { background: none; border: none; color: var(--primary); font-weight: 700; cursor: pointer; font-size: .9rem; }

/* Parcours (cartes horizontales) */
.journey { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.journey::-webkit-scrollbar { display: none; }
.jcard { flex: 0 0 160px; cursor: pointer; }
.jcard.locked { opacity: .55; cursor: not-allowed; }
.jcard-art {
  aspect-ratio: 3/4; border-radius: 16px; position: relative; overflow: hidden;
  border: 1px solid var(--outline-variant); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; font-size: 3rem; color: #fff;
}
.jcard-badge { position: absolute; top: 8px; right: 8px; background: var(--secondary-container); color: #fff; width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; font-size: .8rem; }
.jcard-bar { position: absolute; bottom: 0; left: 0; width: 100%; height: 6px; background: rgba(0,0,0,.15); }
.jcard-bar > div { height: 100%; background: var(--primary); }
.jcard-name { font-weight: 700; margin: 10px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jcard-sub { color: var(--outline); font-size: .8rem; }

/* Sagesse */
.wisdom { margin: 28px 0 10px; background: var(--surface-low); border: 1px solid rgba(13,148,136,.12); border-radius: 20px; padding: 20px; display: flex; gap: 18px; align-items: center; }
.wisdom-icon { flex: 0 0 56px; height: 56px; background: #fff; border-radius: 999px; display: grid; place-items: center; font-size: 1.6rem; box-shadow: var(--shadow); }
.wisdom-label { color: var(--primary); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 4px; font-weight: 700; }
.wisdom-quote { font-style: italic; margin: 0; }
.wisdom-src { color: var(--outline); font-size: .8rem; margin: 6px 0 0; }

/* Bandeau */
.banner { color: var(--on-surface-variant); font-size: .9rem; margin: 0 0 16px; }

/* Sourates (onglet Apprendre) */
.surahs { display: flex; flex-direction: column; gap: 12px; }
.surah { background: var(--surface-lowest); border: 1px solid var(--outline-variant); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.surah.locked { opacity: .6; }
.surah.complete { border-color: var(--secondary-container); }
.surah-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; background: none; border: none; cursor: pointer; text-align: left; color: var(--on-surface); }
.surah-head:disabled { cursor: not-allowed; }
.surah-title { display: flex; flex-direction: column; gap: 2px; }
.surah-num { font-size: .7rem; color: var(--outline); }
.surah-name { font-size: 1.15rem; font-weight: 700; }
.surah-meaning { font-size: .8rem; color: var(--outline); }
.surah-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 92px; }
.surah-count { font-weight: 700; color: var(--primary); }

/* Versets */
.verses { list-style: none; margin: 0; padding: 0; }
.verse { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 14px 12px; border-top: 1px solid var(--outline-variant); cursor: pointer; min-height: 48px; }
.verse.locked { cursor: not-allowed; color: var(--outline); }
.v-num { font-weight: 700; font-size: .85rem; white-space: nowrap; }
.v-meaning { color: var(--on-surface-variant); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-status { font-size: .78rem; white-space: nowrap; }
.verse.due .v-status { color: var(--primary); font-weight: 700; }
.verse.mastered .v-status { color: var(--secondary); }

/* Vidéos */
.videos { display: flex; flex-direction: column; gap: 18px; }

/* Carte « Prochain déblocage » */
.next-unlock { background: var(--surface-lowest); border: 2px solid var(--outline-variant); border-radius: 24px; padding: 22px; }
.nu-kicker { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--outline); }
.nu-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 8px 0 14px; }
.nu-name { font-size: 1.5rem; font-weight: 800; }
.nu-count { font-weight: 800; color: var(--primary); white-space: nowrap; }
.nu-count .s { color: var(--secondary-container); }
.nu-track { height: 16px; background: #d6efe9; border-radius: 999px; overflow: hidden; }
.nu-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s ease; }
.nu-info { display: flex; align-items: center; gap: 8px; color: var(--on-surface-variant); font-size: .95rem; margin-top: 14px; }
.nu-info .i { color: var(--outline); font-weight: 800; }

/* Cartes vidéo (vignette + pied) */
.vcard { background: var(--surface-lowest); border: 2px solid var(--outline-variant); border-radius: 24px; overflow: hidden; }
.vthumb { position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; }
.vbadge { position: absolute; top: 12px; left: 12px; background: var(--outline); color: #fff; font-weight: 800; font-size: .78rem; padding: 6px 12px; border-radius: 999px; }
.vbadge.on { background: var(--primary); }
.vemoji { font-size: 3.6rem; filter: drop-shadow(0 2px 8px rgba(0,0,0,.3)); }
.vplay { position: absolute; width: 66px; height: 66px; border-radius: 999px; border: none; background: var(--primary-container); color: #fff; font-size: 1.6rem; cursor: pointer; box-shadow: 0 4px 0 0 #2563eb; display: grid; place-items: center; padding-left: 4px; }
.vplay:active { transform: translateY(2px); box-shadow: 0 2px 0 0 #2563eb; }
.vcard.locked .vthumb { filter: grayscale(.55) brightness(.92); }
.vfoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; }
.vname { font-size: 1.25rem; font-weight: 800; }
.vaction { color: var(--primary-container); font-weight: 800; font-size: .9rem; white-space: nowrap; }
.vcard.locked .vaction { color: var(--outline); }

/* Stats / Parents */
.stats-panel { display: flex; flex-direction: column; gap: 14px; }
.panel-card { background: var(--surface-lowest); border: 1px solid var(--outline-variant); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.panel-card h3 { margin: 0 0 10px; font-size: 1rem; }
.panel-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--surface); }
.panel-row b { color: var(--primary); }

/* Bottom nav */
.bottomnav {
  position: fixed; bottom: 0; left: 0; width: 100%; z-index: 40;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--surface-lowest); border-top: 1px solid var(--outline-variant);
  box-shadow: 0 -4px 20px rgba(13,148,136,.08);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: none; color: var(--outline); font-size: .72rem; font-weight: 600; cursor: pointer; padding: 6px 14px; border-radius: 999px; }
.nav-item span { font-size: 1.3rem; }
.nav-item.active { background: var(--primary-container); color: #fff; box-shadow: 0 3px 0 0 #2563eb; }

.icon-btn { background: none; border: none; color: var(--outline); font-size: 1.1rem; cursor: pointer; }

/* Feuille sourate */
.sheet { border: none; border-radius: 22px 22px 0 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; background: var(--surface-lowest); color: var(--on-surface); }
.sheet::backdrop { background: rgba(30,41,59,.45); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 12px; }
.sheet-name { font-size: 1.2rem; font-weight: 800; }
.sheet-meaning { color: var(--outline); font-size: .85rem; }
.sheet .verses { padding: 0 8px 20px; }

/* Pratique (plein écran) */
.practice { border: none; padding: 0; width: 100%; max-width: 560px; height: 100dvh; max-height: 100dvh; margin: 0 auto; background: var(--bg); color: var(--on-surface); }
.practice::backdrop { background: rgba(30,41,59,.45); }
.practice-top { display: flex; align-items: center; gap: 14px; padding: calc(14px + env(safe-area-inset-top)) 18px 10px; }
.practice-top .icon-btn { font-size: 1.4rem; color: var(--on-surface); }
.mprog { flex: 1; height: 14px; background: var(--surface); border-radius: 999px; overflow: hidden; }
.mprog-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s ease; }
.mstar { display: flex; align-items: center; gap: 6px; background: var(--surface-lowest); border: 2px solid var(--surface-high); border-radius: 999px; padding: 7px 16px; font-weight: 800; color: var(--on-surface); }
.mstar .s { color: var(--secondary-container); font-size: 1.05rem; }

/* Bulle d'encouragement + avatar */
.speech { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 22px; }
.speech-avatar { flex: none; width: 56px; height: 56px; border-radius: 999px; background: var(--surface-low); display: grid; place-items: center; font-size: 1.8rem; border: 2px solid var(--outline-variant); }
.speech-bubble { position: relative; background: var(--surface-lowest); border: 2px solid var(--surface-high); border-radius: 20px; padding: 16px 18px; color: var(--primary); font-weight: 800; font-size: 1.15rem; line-height: 1.4; }
.speech-bubble::before { content: ""; position: absolute; left: -9px; top: 20px; width: 16px; height: 16px; background: var(--surface-lowest); border-left: 2px solid var(--surface-high); border-bottom: 2px solid var(--surface-high); transform: rotate(45deg); }
.practice-body { padding: 8px 20px 250px; overflow-y: auto; height: calc(100dvh - 60px); }
.practice-sub { text-align: center; font-size: 1.3rem; font-weight: 800; margin-bottom: 18px; }

.calligraphy { background: var(--surface-lowest); border: 1px solid var(--outline-variant); border-radius: 24px; padding: 30px 20px; box-shadow: var(--shadow); text-align: center; }
.verse-kicker { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--outline); margin-bottom: 16px; }
.arabic { font-family: var(--font-ar); font-size: 2.4rem; line-height: 1.9; margin-bottom: 10px; color: var(--secondary-container); }
.verse-divider { width: 56px; height: 4px; background: var(--surface); border-radius: 999px; margin: 8px auto 16px; }
.verse-fr { color: var(--on-surface-variant); line-height: 1.55; font-weight: 500; }
.reciter-row { margin-top: 16px; }

.tip { margin-top: 20px; background: var(--surface-low); border: 1px solid rgba(13,148,136,.1); border-radius: 20px; padding: 18px; }
.tip-head { display: flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 700; }
.tip-text { color: var(--on-surface-variant); line-height: 1.5; margin: 8px 0 0; }
.tip-arabic { margin-top: 10px; }
.tip-arabic summary { cursor: pointer; color: var(--outline); font-size: .85rem; }
.translit { font-style: italic; color: var(--on-surface-variant); margin: 6px 0 0; }
.tags { display: flex; gap: 8px; margin-top: 12px; }
.tag { background: rgba(13,148,136,.1); color: var(--primary); padding: 4px 12px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.tag.gold { background: rgba(245,158,11,.2); color: var(--secondary); }

.result { margin-top: 18px; }
.feedback { font-weight: 800; white-space: pre-line; min-height: 1.2em; }
.feedback.ok { color: var(--primary); }
.feedback.ko { color: var(--secondary); }
.breakdown { list-style: none; padding: 0; margin: 10px 0 0; }
.breakdown li { display: flex; justify-content: space-between; padding: 7px 10px; background: var(--surface-lowest); border: 1px solid var(--outline-variant); border-radius: 10px; margin-bottom: 6px; }
.breakdown b { color: var(--primary); }

.stats-mini { margin-top: 18px; border-top: 1px solid var(--outline-variant); padding-top: 12px; }
.stats-mini summary { cursor: pointer; color: var(--outline); font-weight: 600; }
.stats-list { list-style: none; padding: 8px 0 0; margin: 0; color: var(--on-surface-variant); }
.stats-list li { padding: 4px 0; }
.stats-list b { color: var(--on-surface); }

/* Boutons d'action de la pratique : deux pilules pleine largeur, en pile. */
.action-dock { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 12px; padding: 16px 20px calc(20px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 80%, transparent); }
.record-status { text-align: center; font-size: .82rem; font-weight: 700; color: var(--outline); min-height: 1em; }
.btn-action { width: 100%; border: none; border-radius: 18px; padding: 17px; font-family: var(--font); font-weight: 800; font-size: 1.05rem; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: transform .12s, box-shadow .12s; }
.btn-action:active { transform: translateY(3px); }
#m-listen { background: var(--primary-container); box-shadow: 0 4px 0 0 #2563eb; }        /* Écouter — azur */
#m-record { background: var(--primary); box-shadow: 0 4px 0 0 #0a7268; }                  /* Enregistrer — mint */
#m-record[data-state="recording"] { background: var(--error); box-shadow: 0 4px 0 0 #8a0000; }
.action-dock audio { width: 100%; }

/* Onboarding */
.onboard { border: none; border-radius: 24px; padding: 0; width: 100%; max-width: 560px; max-height: 90dvh; margin: auto; background: var(--bg); color: var(--on-surface); }
.onboard::backdrop { background: rgba(30,41,59,.6); }
.onboard-content { padding: 28px 20px; overflow-y: auto; text-align: center; }
.onboard-content h1 { font-size: 1.7rem; font-weight: 800; margin: 0 0 6px; }
.onboard-content > p { color: var(--on-surface-variant); margin: 0 0 28px; font-size: 1.05rem; }
.onboard-step { text-align: left; margin: 20px 0; }
.onboard-step label { display: block; font-weight: 700; margin-bottom: 8px; color: var(--primary); }
.onboard-step input, .onboard-step select { width: 100%; padding: 12px; border: 1px solid var(--outline-variant); border-radius: 12px; background: var(--surface-lowest); color: var(--on-surface); font-size: 1rem; font-family: inherit; }
.onboard-desc { margin: 8px 0 0; font-size: .8rem; color: var(--on-surface-variant); line-height: 1.4; }
.onboard-info { background: var(--surface-low); border-left: 4px solid var(--primary); padding: 12px; border-radius: 8px; font-size: .9rem; line-height: 1.6; color: var(--on-surface-variant); text-align: left; }
.btn-start { width: 100%; margin-top: 24px; padding: 14px; background: var(--primary); color: #fff; border: none; border-radius: 12px; font-weight: 700; font-size: 1rem; cursor: pointer; box-shadow: var(--shadow); }
.btn-start:disabled { opacity: .5; cursor: not-allowed; }
.btn-start:not(:disabled):active { transform: scale(.98); }

@media (min-width: 620px) {
  .practice, .sheet { border-radius: 24px; height: auto; max-height: 90dvh; margin: auto; }
  .practice-body { height: auto; max-height: 70dvh; }
  .record-dock { position: static; transform: none; margin: 16px auto; }
}
