/* Thème sombre doux : fond gris-bleu très foncé, texte crème, gros boutons. */
:root {
  --fond: #1b2531;
  --surface: #26323f;
  --surface-2: #32414f;
  --bord: #46586a;
  --texte: #efe6d2;
  --texte-doux: #cfc6b2;
  --accent: #e0b25e;
  --accent-texte: #1b2531;
  --vert: #9fd3a6;
  --rouge: #a84e45;
  --rouge-texte: #f6ecdb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 22px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

.ecran {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px 140px;
}

h1 { font-size: 30px; margin: 8px 0 16px; line-height: 1.2; }
h2 { font-size: 26px; margin: 28px 0 12px; }
small { font-size: 20px; color: var(--texte-doux); }
.bouton.actif small, .bouton.principal small { color: inherit; }

.grand-texte { font-size: 24px; }

/* ---------- Boutons ---------- */
.bouton {
  display: block;
  width: 100%;
  min-height: 80px;
  padding: 14px 18px;
  border: 2px solid var(--bord);
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--texte);
  font: inherit;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}
.bouton:active { filter: brightness(1.15); }
.bouton:disabled { opacity: 0.45; cursor: default; }
.bouton.principal {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-texte);
}
.bouton.danger {
  background: var(--rouge);
  border-color: var(--rouge);
  color: var(--rouge-texte);
}
.bouton.gros { min-height: 96px; font-size: 26px; margin: 12px 0; }
.bouton.enorme {
  width: 170px;
  height: 170px;
  min-height: 170px;
  margin: 22px auto;
  border-radius: 50%;
  font-size: 72px;
  line-height: 1;
}
.bouton.discret {
  width: auto;
  min-height: 60px;
  padding: 8px 16px;
  font-size: 20px;
  font-weight: 500;
  background: transparent;
  color: var(--texte-doux);
}
.bouton.actif {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-texte);
}

.rangee { display: flex; gap: 14px; margin: 14px 0; }
.rangee > .bouton { flex: 1; }
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grille .large { grid-column: 1 / -1; }
.pile { display: flex; flex-direction: column; gap: 14px; margin: 14px 0; }

/* ---------- Bibliothèque ---------- */
.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.entete h1 { margin: 8px 0; }
.reseau {
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 20px;
  font-weight: 600;
  background: #2f4a3a;
  color: var(--vert);
}
.reseau.hors { background: #4a3a2f; color: #f0c79a; }

.reprendre { margin: 10px 0 20px; }
.reprendre .bouton { min-height: 120px; font-size: 26px; }
.reprendre small { display: block; color: var(--accent-texte); opacity: 0.8; }

.categorie {
  font-size: 26px;
  margin: 34px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--bord);
}

.livre {
  background: var(--surface);
  border: 2px solid var(--bord);
  border-radius: 20px;
  padding: 16px;
  margin: 14px 0;
}
.livre h3 { font-size: 28px; margin: 0 0 6px; line-height: 1.2; }
.livre .infos { margin: 0 0 8px; color: var(--texte-doux); }
.livre .badge { margin: 0 0 12px; color: var(--vert); font-weight: 600; }
.livre .boutons { display: flex; flex-direction: column; gap: 12px; }
.livre.grise { opacity: 0.5; }
.livre .attention { color: #f0c79a; }

.progression { margin: 12px 0; }
.progression .piste-prog {
  height: 26px;
  border-radius: 13px;
  background: var(--fond);
  border: 2px solid var(--bord);
  overflow: hidden;
}
.progression .remplie { height: 100%; width: 0; background: var(--accent); }
.progression p { margin: 6px 0 0; font-size: 22px; }

.erreur { color: #f0b3a8; font-weight: 600; }
.bloc { margin-top: 30px; }
.vide { color: var(--texte-doux); font-size: 24px; }

/* ---------- Ajout ---------- */
.champ {
  width: 100%;
  min-height: 70px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--bord);
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  font-size: 24px;
}
.etiquette { display: block; margin: 16px 0 8px; font-size: 22px; color: var(--texte-doux); }
.liste-chapitres { margin: 10px 0; padding-left: 1.6em; color: var(--texte-doux); font-size: 20px; }

/* ---------- Lecteur ---------- */
.barre-haut, .simple-haut { display: flex; justify-content: space-between; gap: 10px; }
.titre-livre { font-size: 32px; margin-top: 18px; }
.avancement {
  height: 14px;
  border-radius: 7px;
  background: var(--surface);
  overflow: hidden;
  margin-top: 14px;
}
#l-barre { height: 100%; width: 0; background: var(--accent); }
.temps { font-size: 22px; color: var(--texte-doux); margin: 8px 0 0; }

/* ---------- Écran simple ---------- */
#ecran-simple, .ecran-plein {
  position: fixed;
  inset: 0;
  max-width: none;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}
#ecran-simple[hidden], .ecran-plein[hidden] { display: none !important; }
.voix-titre { font-size: 46px; margin: 10px 0; line-height: 1.15; overflow-wrap: anywhere; }

/* ---------- Recherche ---------- */
.recherche { position: relative; margin: 10px 0 16px; }
.recherche .loupe {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 28px; pointer-events: none;
}
#recherche {
  width: 100%;
  min-height: 84px;
  padding: 12px 84px 12px 60px;
  border-radius: 18px;
  border: 2px solid var(--bord);
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  font-size: 28px;
}
#recherche::placeholder { color: var(--texte-doux); opacity: 0.8; }
#recherche:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
#recherche-effacer {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 72px; height: 72px;
  border: none; border-radius: 14px;
  background: var(--surface-2); color: var(--texte);
  font-size: 30px; cursor: pointer;
}
.aucun { font-size: 30px; font-weight: 700; margin: 24px 0 8px; }

.carte-resultat {
  display: flex; flex-direction: column; gap: 6px;
  width: 100%; margin: 14px 0; padding: 18px;
  text-align: left;
  background: var(--surface); color: var(--texte);
  border: 2px solid var(--accent); border-radius: 20px;
  font: inherit; cursor: pointer;
}
.cr-titre { font-size: 30px; font-weight: 700; line-height: 1.2; }
.cr-infos { font-size: 22px; color: var(--texte-doux); }
.cr-action {
  margin-top: 8px; padding: 14px; border-radius: 14px; text-align: center;
  background: var(--accent); color: var(--accent-texte); font-size: 26px; font-weight: 700;
}

/* ---------- Tuiles de catégories ---------- */
.tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 16px; }
.tuile {
  min-height: 110px; padding: 12px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  background: var(--surface-2); color: var(--texte);
  border: 2px solid var(--bord); border-radius: 18px;
  font: inherit; text-align: center; cursor: pointer;
}
.tuile-nom { font-size: 24px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.tuile-nb { font-size: 20px; color: var(--texte-doux); }
.tuile[data-filtre="en-cours"] { grid-column: 1 / -1; background: #3b3a2f; border-color: var(--accent); }
.titre-filtre { font-size: 32px; margin: 20px 0 8px; }
.livre .auteur { margin: 0 0 4px; font-size: 22px; font-style: italic; color: var(--texte-doux); }
.simple-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}
.simple-icone { font-size: 120px; line-height: 1; margin: 0; color: var(--accent); }
.simple-titre { font-size: 40px; margin: 10px 0 0; }
.simple-chapitre { font-size: 34px; margin: 0; color: var(--texte-doux); }
.simple-aide { font-size: 24px; margin: 20px 0 0; color: var(--texte-doux); }

/* ---------- Message ---------- */
.message {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  max-width: 616px;
  margin: 0 auto;
  padding: 16px;
  border-radius: 18px;
  background: #3a4757;
  border: 2px solid var(--accent);
  z-index: 10;
}
.message p { margin: 0 0 12px; font-size: 24px; }
.message .bouton { min-height: 70px; }
