/* Bible Horizon — feuille de style
   Ton : sobre, chaleureux, digne. Le texte biblique en serif (comme une Bible),
   l'interface en sans-serif. Palette calme, accent doré discret, vert « croissance ».
   Clair / sombre gérés automatiquement selon le réglage du téléphone. */

:root {
  --bg:        #f7f3ea;   /* parchemin clair */
  --surface:   #fffdf8;
  --surface-2: #f0e9da;
  --ink:       #24303f;   /* encre */
  --ink-soft:  #5b6675;
  --line:      #e2d9c6;
  --accent:    #b98a2e;   /* or discret */
  --accent-ink:#7a5a15;
  --grow:      #4b8055;   /* vert croissance */
  --grow-soft: #e4efe4;
  --danger:    #b4552f;
  --shadow:    0 6px 24px rgba(40, 34, 20, .10);
  --radius:    18px;
  --serif:     "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:      system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #141b28;
    --surface:   #1b2434;
    --surface-2: #232f43;
    --ink:       #eef2f8;
    --ink-soft:  #9fb0c6;
    --line:      #2c3a52;
    --accent:    #d9b45f;
    --accent-ink:#e7c987;
    --grow:      #6fb07c;
    --grow-soft: #22322a;
    --danger:    #e08a63;
    --shadow:    0 8px 28px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  max-width: 620px;
  margin: 0 auto;
  padding: 22px 18px 96px;
  min-height: 100vh;
}

/* ---------- Typo & titres ---------- */
h1, h2, h3 { font-weight: 650; letter-spacing: -.01em; margin: 0; }
.app-title { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); }
.app-title .seed { color: var(--grow); }
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- En-tête ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand .logo { width: 34px; height: 34px; }
.streak {
  font-size: .95rem; font-weight: 600; color: var(--accent-ink);
  background: var(--surface); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}

/* ---------- Cartes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}
.card.hero { padding: 26px 22px; }

.verse {
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.62;
  color: var(--ink);
}
.verse.small { font-size: 1.08rem; }
.ref {
  font-family: var(--sans);
  font-size: .9rem; font-weight: 600;
  color: var(--accent-ink);
  letter-spacing: .02em; text-transform: uppercase;
  margin-top: 14px;
}
.ref .version { color: var(--ink-soft); font-weight: 500; text-transform: none; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600;
  border: 1px solid transparent; border-radius: 14px;
  padding: 14px 20px; cursor: pointer;
  transition: transform .06s ease, background .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #241a05; width: 100%; font-size: 1.05rem; }
.btn-grow    { background: var(--grow); color: #fff; }
.btn-ghost   { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-soft    { background: var(--surface-2); color: var(--ink); }
.btn-block   { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- Écran d'accueil ---------- */
.hello { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 4px; }
.today-count { font-size: 2.1rem; font-weight: 700; font-family: var(--serif); line-height: 1.1; }
.today-count .n { color: var(--grow); }
.rest {
  text-align: center; padding: 30px 18px; color: var(--ink-soft);
}
.rest .big { font-size: 2rem; display: block; margin-bottom: 8px; }

/* Liste des versets appris */
.section-title {
  font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); margin: 26px 4px 10px;
}
.verse-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.verse-item .stage { font-size: 1.35rem; width: 28px; text-align: center; }
.verse-item .vi-ref { font-weight: 650; }
.verse-item .vi-text { color: var(--ink-soft); font-size: .9rem;
  display: inline-block; max-width: 100%; vertical-align: bottom;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verse-item .vi-main { min-width: 0; flex: 1; }
.badge-due { margin-left: auto; font-size: .72rem; font-weight: 700;
  color: var(--grow); background: var(--grow-soft); padding: 3px 8px; border-radius: 999px; }

/* ---------- Session de révision ---------- */
.progress-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 22px; }
.progress-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.progress-dots span.done { background: var(--grow); }
.progress-dots span.current { background: var(--accent); transform: scale(1.35); }

.exercise-label {
  text-align: center; font-size: .82rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 14px;
}

/* premières lettres */
.cloze { font-family: var(--serif); font-size: 1.35rem; line-height: 1.9; letter-spacing: .01em; }
.cloze .rev { color: var(--ink); }
.cloze .hint { color: var(--ink-soft); }
.cloze .blank {
  display: inline-block; min-width: 1.4em; border-bottom: 2px solid var(--accent);
  color: var(--accent-ink); text-align: center; margin: 0 1px;
}

/* mots mélangés */
.pool, .answer-line { display: flex; flex-wrap: wrap; gap: 8px; }
.answer-line {
  min-height: 54px; border: 2px dashed var(--line); border-radius: 12px;
  padding: 10px; margin-bottom: 14px; align-content: flex-start;
}
.chip {
  font-family: var(--serif); font-size: 1.05rem;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 12px; cursor: pointer; user-select: none;
}
.chip.placed { background: var(--grow-soft); border-color: var(--grow); }
.answer-line .chip { background: var(--surface); }

/* auto-évaluation */
.reveal-box { margin: 18px 0 8px; }
.eval-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.eval-grid .btn { flex-direction: column; gap: 2px; padding: 14px 8px; font-size: .95rem; }
.eval-grid .btn .sub { font-size: .72rem; font-weight: 500; opacity: .8; }
.eval-again { background: #f3ddd2; color: #7a3417; }
.eval-hard  { background: #f5e6cf; color: #7a5410; }
.eval-good  { background: var(--grow-soft); color: var(--grow); border:1px solid var(--grow); }
.eval-easy  { background: var(--grow); color: #fff; }
@media (prefers-color-scheme: dark) {
  .eval-again { background: #3a2519; color: #f0b191; }
  .eval-hard  { background: #3a2f17; color: #e6c877; }
}

/* fin de session */
.done-screen { text-align: center; padding: 22px 8px; }
.done-screen .seal { font-size: 3rem; }
.done-screen .verse { margin-top: 18px; }

/* ---------- Barre de navigation basse ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tabbar button {
  background: none; border: 0; font: inherit; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .72rem; padding: 4px 14px; cursor: pointer; border-radius: 10px;
}
.tabbar button .ic { font-size: 1.3rem; }
.tabbar button.active { color: var(--grow); font-weight: 650; }

/* ---------- Divers ---------- */
.field { width: 100%; font: inherit; padding: 13px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
textarea.field { min-height: 96px; font-family: var(--serif); resize: vertical; }
label.lbl { display: block; font-weight: 600; margin: 14px 2px 6px; font-size: .92rem; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font: inherit; cursor: pointer;
}
.pill.on { background: var(--grow); color: #fff; border-color: var(--grow); }
.back-link { background: none; border: 0; color: var(--ink-soft); font: inherit;
  cursor: pointer; padding: 4px 0; margin-bottom: 10px; }
.context-box { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; margin-top: 14px;
  font-size: .95rem; color: var(--ink-soft); }
.context-box b { color: var(--ink); }
.fade { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Accueil : hero de marque ---------- */
.card.hero { text-align: center; }
.hero-emblem img { width: 62px; height: 62px; }
.hero-name { font-family: var(--serif); font-size: 1.7rem; margin: 12px 0 6px; letter-spacing: -.01em; }
.hero-name .seed { color: var(--grow); }
.hero-tag { font-family: var(--serif); color: var(--ink-soft); font-size: 1.05rem; margin: 0; }

/* étapes « comment ça marche » */
.steps { display: flex; flex-direction: column; gap: 12px; margin: 18px 2px 20px; }
.step { display: flex; gap: 14px; align-items: flex-start; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.step .si { font-size: 1.5rem; line-height: 1.3; }
.step b { font-weight: 650; }

/* cartes d'action (accueil) */
.card.action { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.card.action .action-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.card.action .action-txt b { font-family: var(--serif); font-size: 1.12rem; }
.card.action .action-txt .muted { font-size: .9rem; }
.card.action .btn { width: auto; flex-shrink: 0; padding: 12px 18px; }

/* lien vers le jardin */
.gardenlink { margin-top: 4px; }
.gardenlink .chev { margin-left: auto; color: var(--ink-soft); font-size: 1.5rem; padding-left: 8px; }

/* boîte « ajouter mon verset » (repliée) */
.addbox summary { cursor: pointer; font-weight: 600; color: var(--accent-ink);
  padding: 10px 4px; list-style: none; }
.addbox summary::-webkit-details-marker { display: none; }

/* ---------- Exercices interactifs (vérifiés par l'appli) ---------- */
.ex-instr { text-align: center; font-weight: 650; margin-bottom: 14px; }
.answer-line .ph { color: var(--ink-soft); font-size: .9rem; padding: 6px; }
.chip.wrong { border-color: var(--danger); color: var(--danger); background: transparent; }

/* mots à trous interactifs */
.fillverse { line-height: 2.15; }
.slot { font: inherit; font-family: var(--serif); font-size: inherit; display: inline-block;
  border: 0; border-bottom: 2px solid var(--accent); border-radius: 6px 6px 0 0;
  padding: 0 6px; margin: 0 1px; background: var(--surface-2); cursor: pointer;
  color: var(--ink); min-width: 2em; }
.slot.empty { color: var(--ink-soft); letter-spacing: .1em; }
.slot.filled { background: var(--grow-soft); border-bottom-color: var(--grow); }
.slot.wrong { background: transparent; border-bottom-color: var(--danger); color: var(--danger); }

/* résultat d'exercice */
.exresult { text-align: center; padding: 10px 0 4px; }
.exresult .exres-icon { font-size: 2.4rem; }
.exresult .exres-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 650; margin-top: 6px; }
.exresult.ok .exres-title { color: var(--grow); }
.exresult.ko .exres-title { color: var(--accent-ink); }
.ex-wrong { text-align: center; color: var(--danger); font-size: .92rem; margin: 10px 0 0; }

/* aides discrètes sous l'exercice */
.ex-tools { display: flex; justify-content: space-between; margin-top: 12px; }
.linkbtn { background: none; border: 0; font: inherit; font-size: .88rem;
  color: var(--ink-soft); cursor: pointer; padding: 6px 4px; text-decoration: underline;
  text-underline-offset: 3px; }
.hint-reveal { font-family: var(--serif); font-size: 1.02rem; color: var(--ink-soft);
  background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }

/* ---------- Collections (objectifs facultatifs) ---------- */
.gauge { display: inline-block; flex: 1; height: 6px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden; }
.gauge i { display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--grow); transition: width .3s ease; }
.coll-meter { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.coll-count { font-size: .76rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }

/* item de collection (réutilise .verse-item) */
.coll-item { align-items: flex-start; }
.coll-item .stage { margin-top: 2px; }
.coll-item.complete { background: var(--grow-soft); border-color: var(--grow); cursor: default; }
.mini-badge { font-size: .68rem; font-weight: 700; color: var(--grow); background: var(--grow-soft);
  padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; white-space: nowrap; }
.mini-badge.gold { color: var(--accent-ink); background: var(--surface-2); }
.coll-item.complete .mini-badge.gold { background: var(--surface); }

/* ---------- Explorer : navigation vers les modules (Lire, Défi) ---------- */
a.verse-item { text-decoration: none; }
.verse-item .chev { margin-left: auto; color: var(--ink-soft); font-size: 1.5rem; padding-left: 8px; }
.explore-item .vi-text { white-space: normal; }
.explore-mini { margin-top: 16px; font-size: .92rem; }
.explore-mini a { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }

/* carte « objectif » sur l'accueil */
.card.objective { padding: 16px 18px; }
.card.objective .obj-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card.objective .obj-head b { font-family: var(--serif); font-size: 1.05rem; }
.objective-link .vi-text { white-space: normal; }

/* ============================================================================
   Refonte : accueil hub (3 modules à égalité) + apprentissage par série
   ========================================================================== */

/* hero de marque, version compacte (l'accueil est devenu un hub) */
.card.hero.compact { padding: 18px 20px 20px; }
.card.hero.compact .hero-emblem img { width: 46px; height: 46px; }
.card.hero.compact .hero-name { font-size: 1.4rem; margin: 8px 0 4px; }
.card.hero.compact .hero-tag { font-size: .95rem; }

/* grandes cartes de modules — même gabarit pour Mémoriser, Lire, Défi */
.hub-card {
  display: flex; align-items: center; gap: 16px; width: 100%;
  padding: 20px 18px; cursor: pointer;
  font: inherit; color: inherit; text-align: left; text-decoration: none;
}
.hub-card .hub-ic {
  font-size: 1.9rem; width: 54px; height: 54px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border-radius: 16px;
}
.hub-card .hub-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.hub-card .hub-title { font-family: var(--serif); font-size: 1.25rem; font-weight: 650; }
.hub-card .hub-sub { color: var(--ink-soft); font-size: .92rem; }
.hub-card .chev { color: var(--ink-soft); font-size: 1.5rem; padding-left: 4px; }

/* page d'étude (série de versets avant le quiz d'introduction) */
.study-note {
  font-size: .95rem; color: var(--accent-ink);
  background: var(--surface); border: 1px dashed var(--accent);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
}
.study-verse { padding: 20px; }
.study-verse .verse { font-size: 1.18rem; }
.study-verse .ref { margin-top: 10px; }
.study-verse .context-box { margin-top: 12px; }

/* ============================================================================
   Onglet « Moi » : espace personnel (stats locales, jardin, amis à venir)
   ========================================================================== */
.me-head { text-align: center; padding: 20px 18px; }
.me-head .me-emoji { font-size: 2rem; line-height: 1; }
.me-head h2 { font-family: var(--serif); margin: 8px 0 4px; }
.me-head p { margin: 0; font-size: .92rem; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 10px; text-align: center;
}
.stat-tile .st-n {
  font-family: var(--serif); font-size: 1.45rem; font-weight: 700;
  line-height: 1.2; color: var(--ink);
}
.stat-tile .st-l { color: var(--ink-soft); font-size: .78rem; margin-top: 2px; line-height: 1.3; }
.stat-tile.wide { grid-column: 1 / -1; }
.me-note { margin: 8px 4px 0; font-size: .88rem; }

.friends-card p { margin: 0; }
.friends-card p + p { margin-top: 6px; font-size: .92rem; }

/* ============================================================================
   Compte, synchronisation & amis (serveur facultatif)
   ========================================================================== */
.account-card .acc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.account-card .acc-head b { font-family: var(--serif); font-size: 1.12rem; }
.acc-ic { font-size: 1.5rem; line-height: 1; }
.account-card p { margin: 0 0 8px; font-size: .92rem; }
.acc-privacy { font-size: .85rem; }
.acc-user { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.acc-user .acc-id b { font-family: var(--serif); font-size: 1.15rem; }
.acc-mail { font-size: .88rem; overflow-wrap: anywhere; }

/* code ami — bien visible, en monospace */
.friend-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 1.3rem; font-weight: 700; letter-spacing: .08em; color: var(--accent-ink);
}
.friend-code.inline { font-size: 1rem; letter-spacing: .06em; }
.friend-code-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-2); border-radius: 12px; padding: 10px 14px;
}
.friend-code-row .btn { padding: 10px 14px; flex-shrink: 0; }
.fc-label { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }

.sync-status { font-size: .85rem; margin: 10px 2px 0; }

/* suppression de compte : repliée, en rouge sobre */
.danger-zone { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
.danger-zone summary { cursor: pointer; color: var(--danger); font-size: .88rem; padding: 8px 2px; list-style: none; }
.danger-zone summary::-webkit-details-marker { display: none; }
.btn-danger { color: var(--danger); border-color: var(--danger); }

/* messages sous les champs */
.field-error { color: var(--danger); font-size: .88rem; margin: 8px 2px 0; }
.field-ok { color: var(--grow); font-size: .88rem; margin: 8px 2px 0; }

/* saisie du code à 6 chiffres : champ grand, centré */
.code-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.7rem; text-align: center; letter-spacing: .35em; padding: 14px 10px;
}
.dev-code { text-align: center; font-size: .8rem; color: var(--ink-soft); margin: 10px 0 0; }

/* amis */
.add-friend-row { display: flex; gap: 8px; }
.add-friend-row .field { flex: 1; min-width: 0; }
.add-friend-row .btn { flex-shrink: 0; }
.friend-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); }
.friend-row:first-of-type { margin-top: 12px; }
.friend-row .fr-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--grow-soft); display: flex; align-items: center; justify-content: center;
}
.friend-row .fr-main { flex: 1; min-width: 0; }
.friend-row .fr-since { font-size: .82rem; }
.friend-row .fr-x { background: none; border: 0; color: var(--ink-soft); cursor: pointer; font-size: 1.05rem; padding: 8px; }
.fr-empty { margin: 12px 0 0; font-size: .9rem; }
