/* Ma bibliothèque : un mur clair, des étagères, du papier. L'encre bleue est celle de l'IA. */
:root {
  --mur: #EDE7DC;
  --papier: #F8F4EC;
  --encre: #221D18;
  --doux: #74695E;
  --trait: #D6CCBD;
  --ligne: #E3DACB;
  --planche: #2E2620;
  --bleu: #27408B;
  --bleu-fond: rgba(39, 64, 139, .065);
  --rouge: #9A3B30;
  --or: #C9A24A;
  --serif: 'Literata', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --zone: 160px; /* hauteur utile d'un rayon */
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--mur); color: var(--encre);
  font: 400 16px/1.55 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--bleu); outline-offset: 2px; }
a { color: inherit; }
h1, h2, h3 { font-weight: 600; margin: 0; }
.icone { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icone svg { width: 100%; height: 100%; }

/* ---------- Boutons et champs ---------- */

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--encre); font-weight: 500; font-size: 15px;
  transition: transform .15s, background .15s;
}
.bouton:active:not(:disabled) { transform: scale(.97); }
.bouton.plein { background: var(--encre); color: var(--papier); }
.bouton.discret { border-color: transparent; color: var(--doux); padding: 0 10px; }
.bouton.discret:hover { color: var(--encre); }
.rond { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; }
.rond:hover { background: rgba(34, 29, 24, .07); }
.rond.petit { width: 26px; height: 26px; }
.rond.petit .icone { width: 14px; height: 14px; }
.lien { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; color: var(--doux); font-size: 15px; padding: 6px 0; }
.lien:hover { color: var(--encre); }
.lien.petit { font-size: 13px; padding: 2px 0; }
.lien.danger { color: var(--rouge); }
.rangee { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

label > span { display: block; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--doux); margin-bottom: 7px; }
input:not([type=checkbox]), textarea {
  width: 100%; font-size: 17px; padding: 11px 13px;
  background: var(--papier); border: 1px solid var(--trait); border-radius: 8px;
}
input:focus, textarea:focus { outline: none; border-color: var(--encre); }
input::placeholder, textarea::placeholder { color: #A2978A; }
.form-erreur { color: var(--rouge); font-size: 14px; margin: 0; min-height: 1px; }
.form-erreur:empty { display: none; }

/* ---------- Accueil : compte et connexion ---------- */

.accueil { max-width: 380px; margin: 0 auto; padding: 14vh 20px 40px; }
.accueil-livres { display: flex; align-items: flex-end; gap: 3px; height: 84px; padding: 0 10px; border-bottom: 7px solid var(--planche); margin-bottom: 30px; width: max-content; }
.accueil-livres i { width: 18px; height: var(--h); background: var(--c); border-radius: 2px 2px 0 0; animation: pousse .7s cubic-bezier(.2, .8, .2, 1.2) backwards; }
.accueil-livres i:nth-child(2) { width: 24px; animation-delay: .06s; }
.accueil-livres i:nth-child(3) { width: 15px; animation-delay: .12s; }
.accueil-livres i:nth-child(4) { width: 21px; animation-delay: .18s; }
.accueil-livres i:nth-child(5) { width: 17px; animation-delay: .24s; transform: rotate(9deg); transform-origin: bottom left; }
@keyframes pousse { from { transform: translateY(-30px); opacity: 0; } }
.accueil h1 { font-size: 32px; font-weight: 500; letter-spacing: -.01em; line-height: 1.1; }
.accueil-sous { color: var(--doux); margin: 10px 0 28px; }
.accueil-form { display: grid; gap: 18px; }
.accueil-form .bouton { justify-self: start; }

/* ---------- En-tête ---------- */

.haut { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; max-width: 1100px; margin: 0 auto; padding: calc(22px + env(safe-area-inset-top)) 16px 6px; }
.titre-site { font-size: 27px; font-weight: 500; letter-spacing: -.015em; line-height: 1.1; }
.titre-site em { font-weight: 400; color: var(--doux); }
.sous-titre { margin: 6px 0 0; font: 12px/1.3 var(--mono); color: var(--doux); }
.lien-bilan { font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; padding: 9px 12px; border: 1px solid var(--trait); border-radius: 999px; text-decoration: none; margin-top: 2px; }
.lien-bilan:hover { border-color: var(--encre); }
.haut-livre { align-items: center; max-width: 720px; }
.retour { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; padding: 8px 8px 8px 0; color: var(--doux); }
.retour:hover { color: var(--encre); }

/* ---------- L'étagère ---------- */

.salle { max-width: 1100px; margin: 0 auto; padding: 8px 0 0; }
.rayon { margin-top: 26px; }
.rayon-titre { font: 500 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--doux); padding: 0 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.compte { font-size: 10.5px; letter-spacing: 0; padding: 3px 6px 2px; border-radius: 999px; background: rgba(34, 29, 24, .07); }

/* Chaque rangée de livres pose sur une planche : le fond se répète au pas d'une rangée */
.etagere {
  --sous: 34px;
  --pas: calc(var(--zone) + var(--sous));
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 3px;
  padding: 0 16px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 var(--zone), var(--planche) var(--zone) calc(var(--zone) + 9px), rgba(46, 38, 32, .18) calc(var(--zone) + 9px), transparent calc(var(--zone) + 17px), transparent var(--pas));
}
.etagere-vide { height: var(--zone); margin: 0 0 var(--sous); display: flex; align-items: flex-end; padding-bottom: 14px; color: var(--doux); font-style: italic; font-size: 15px; max-width: 34ch; }

.dos {
  position: relative; flex: none;
  --hh: calc(var(--h) * var(--k, 1));
  width: var(--l); height: var(--hh);
  margin: calc(var(--zone) - var(--hh)) 0 var(--sous);
  background: var(--c); color: #F5EEE2;
  border-radius: 2px 2px 1px 1px;
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, .13), inset -3px 0 0 rgba(0, 0, 0, .2), 0 -1px 0 rgba(0, 0, 0, .06);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
/* Les filets dorés en tête et en pied du dos */
.dos::before, .dos::after { content: ''; position: absolute; left: 3px; right: 4px; height: 4px; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; opacity: .32; }
.dos::before { top: 9px; }
.dos::after { bottom: 11px; }
.dos[data-clair], .couche[data-clair] { color: var(--encre); }
.dos-titre {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(180deg);
  writing-mode: vertical-rl; text-orientation: sideways;
  max-height: calc(var(--hh) - 40px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 12.5px; font-weight: 500; letter-spacing: .01em; line-height: 1;
}
.dos-coeur { position: absolute; left: 50%; bottom: 20px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--or); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .15); }
@media (hover: hover) { .dos:hover { transform: translateY(-9px); } }
.dos:active { transform: translateY(-14px); }
.dos.nouveau, .face.nouveau { animation: arrive .8s cubic-bezier(.2, .9, .3, 1.25) backwards .15s; }
@keyframes arrive { from { transform: translateY(-60px) rotate(-6deg); opacity: 0; } }

/* Les abandonnés : couchés en pile au bout du rayon */
.pile { height: var(--zone); margin: 0 0 var(--sous) 14px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; }
.couche { height: 17px; width: var(--l); background: var(--c); color: #F5EEE2; border-radius: 1px 2px 2px 1px; padding: 0 7px; font-size: 10px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .12), inset 0 -2px 0 rgba(0, 0, 0, .18); opacity: .85; }
.couche:nth-child(even) { transform: translateX(5px); }
.couche span { display: block; overflow: hidden; text-overflow: ellipsis; }

/* En cours : les livres de face, avec la page en cours sous la planche */
.etagere.face-avant { --sous: 58px; gap: 0 18px; }
.face { position: relative; width: 104px; height: var(--zone); margin-bottom: var(--sous); display: flex; align-items: flex-end; text-align: left; }
.face .couv { width: 100%; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.face:nth-child(odd) .couv { transform: rotate(-1.2deg); }
.face:nth-child(even) .couv { transform: rotate(1deg); }
@media (hover: hover) { .face:hover .couv { transform: translateY(-6px) rotate(0); } }
.face-page { position: absolute; top: calc(100% + 17px); left: 0; font: 11px/1 var(--mono); color: var(--doux); white-space: nowrap; }
.face-barre { position: absolute; top: calc(100% + 34px); left: 0; right: 0; height: 2px; background: var(--trait); }
.face-barre::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--p); background: var(--encre); }

/* ---------- Couvertures ---------- */

.couv {
  position: relative; aspect-ratio: 2 / 3; overflow: hidden;
  background: var(--c); color: #F5EEE2;
  border-radius: 2px 4px 4px 2px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .1), 0 10px 18px -10px rgba(40, 25, 10, .55);
}
.couv[data-clair] { color: var(--encre); }
.couv img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Le pli de la reliure */
.couv::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .16) 0, rgba(255, 255, 255, .14) 3px, transparent 7px); pointer-events: none; }
.couv-typo { position: absolute; inset: 0; padding: 14px 10px 12px 13px; display: flex; flex-direction: column; justify-content: space-between; }
.couv-titre { font-size: 13px; font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.couv-auteur { font: 9.5px/1.3 var(--mono); opacity: .8; }
.couv.grande { width: 112px; flex: none; }
.couv.grande .couv-titre { font-size: 14px; }

/* ---------- Bouton Ajouter ---------- */

.ajouter {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 22px 14px 18px; border-radius: 999px;
  background: var(--encre); color: var(--papier); font-weight: 500; font-size: 16px;
  box-shadow: 0 12px 26px -10px rgba(34, 29, 24, .6);
  transition: transform .2s;
}
.ajouter:active { transform: translateX(-50%) scale(.96); }

/* ---------- Feuille d'ajout ---------- */

.voile { position: fixed; inset: 0; z-index: 10; background: rgba(34, 29, 24, .38); display: flex; align-items: flex-end; justify-content: center; animation: fondu .2s; }
.voile.part { opacity: 0; transition: opacity .2s; }
@keyframes fondu { from { opacity: 0; } }
.feuille {
  width: min(560px, 100%); max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--papier); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
  animation: monte .32s cubic-bezier(.2, .9, .3, 1);
}
@keyframes monte { from { transform: translateY(40%); } }
.feuille-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.feuille-tete h2 { font-size: 21px; font-weight: 500; }
.recherche { display: flex; gap: 6px; align-items: center; }
.recherche .rond { border: 1px solid var(--trait); width: 46px; height: 46px; }
.attente { color: var(--doux); font-style: italic; margin: 16px 2px; }
.resultats { list-style: none; margin: 10px 0 6px; padding: 0; }
.resultats button { display: flex; gap: 13px; width: 100%; text-align: left; padding: 10px 4px; border-bottom: 1px solid var(--ligne); align-items: center; }
.resultats button:hover { background: rgba(34, 29, 24, .035); }
.resultats img, .res-sans { width: 42px; height: 63px; object-fit: cover; border-radius: 2px; flex: none; background: var(--ligne); box-shadow: 0 3px 8px -4px rgba(0, 0, 0, .4); }
.res-texte { display: flex; flex-direction: column; min-width: 0; }
.res-titre { font-weight: 600; line-height: 1.25; margin: 0; }
.res-auteur { color: var(--doux); font-style: italic; font-size: 15px; margin: 0; }
.res-meta { font: 11.5px/1.5 var(--mono); color: var(--doux); margin: 0; }
.choisi-livre { display: flex; gap: 16px; align-items: flex-start; margin: 10px 0 20px; }
.choisi-livre img, .choisi-livre .couv { width: 88px; flex: none; border-radius: 2px 4px 4px 2px; box-shadow: 0 10px 20px -10px rgba(0, 0, 0, .5); }
.choisi-livre .res-titre { font-size: 19px; }
.choix-statut { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; }
.choix-statut p { width: 100%; margin: 0 0 2px; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--doux); }
.manuel { display: grid; gap: 14px; margin-top: 14px; }

/* ---------- Page d'un livre ---------- */

.livre, .bilan { max-width: 720px; margin: 0 auto; padding: 10px 16px 0; }
.livre-intro { display: flex; gap: 18px; align-items: flex-end; }
.livre-infos { min-width: 0; flex: 1; padding-bottom: 2px; }
.livre-titre { font-size: 25px; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
.livre-auteur { margin: 6px 0 0; font-style: italic; color: var(--doux); font-size: 17px; }
.fiche-meta { margin: 10px 0 0; font: 11.5px/1.5 var(--mono); color: var(--doux); }
.form-livre { display: grid; gap: 12px; }

.statuts { display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 0; }
.statuts button { font: 500 12px/1 var(--mono); padding: 9px 12px; border-radius: 999px; border: 1px solid var(--trait); color: var(--doux); }
.statuts button:hover { border-color: var(--encre); color: var(--encre); }
.statuts .actif { background: var(--encre); border-color: var(--encre); color: var(--papier); }
.statuts .actif:hover { color: var(--papier); }

.avancee { display: flex; align-items: center; gap: 12px; margin-top: 16px; font: 13px/1 var(--mono); color: var(--doux); }
.avancee label { white-space: nowrap; }
.avancee input { width: 4.2em; padding: 6px 6px; font: 15px var(--mono); text-align: center; display: inline-block; }
.avancee-barre { flex: 1; height: 3px; background: var(--trait); position: relative; border-radius: 2px; }
.avancee-barre::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--p); background: var(--encre); border-radius: 2px; transition: width .5s; }

.onglets { display: flex; gap: 24px; margin: 26px 0 0; border-bottom: 1px solid var(--trait); position: sticky; top: 0; background: var(--mur); z-index: 2; }
.onglets button { padding: 14px 0 12px; font-weight: 500; color: var(--doux); position: relative; }
.onglets .actif { color: var(--encre); }
.onglets .actif::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--encre); }

/* ----- Le carnet ----- */

.carnet, .fiche, .avis { padding-top: 20px; }
/* Papier réglé : les lignes suivent le texte */
.composer {
  position: relative; background: var(--papier); border: 1px solid var(--trait); border-radius: 10px;
  padding: 6px 12px 10px; box-shadow: 0 8px 22px -18px rgba(40, 25, 10, .5);
}
.composer textarea {
  border: 0; background: transparent; border-radius: 0; padding: 6px 2px 0; resize: vertical;
  line-height: 32px; min-height: 134px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--ligne) 31px 32px);
  background-attachment: local;
  background-position: 0 6px;
}
.composer-bas { display: flex; align-items: center; gap: 8px; margin-top: 8px; justify-content: flex-end; }
.page-label { display: flex; align-items: center; gap: 4px; font: 13px var(--mono); color: var(--doux); margin-right: auto; }
.champ-page { width: 4.4em !important; padding: 6px 6px !important; font: 15px var(--mono) !important; text-align: center; }
.photo-attente { position: relative; margin: 8px 0 4px; width: max-content; }
.photo-attente img { display: block; max-height: 140px; max-width: 100%; border-radius: 6px; box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .5); }
.photo-attente .rond { position: absolute; top: -10px; right: -10px; background: var(--encre); color: var(--papier); width: 28px; height: 28px; }
.photo-attente .rond .icone { width: 14px; height: 14px; }

.note { padding: 20px 0 18px; border-bottom: 1px solid var(--trait); animation: fondu .3s; }
.note-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 11.5px/1.4 var(--mono); color: var(--doux); }
.note-actions { display: flex; gap: 12px; opacity: .8; }
.note-texte { margin: 8px 0 0; font-size: 17px; line-height: 1.65; white-space: pre-line; }
.en-relecture .note-texte { color: var(--doux); }
.note-erreur { margin: 10px 0 0; color: var(--rouge); font-size: 14px; }
.passage { margin: 10px 0 0; padding: 2px 0 2px 14px; border-left: 2px solid var(--encre); font-style: italic; font-size: 16px; line-height: 1.6; white-space: pre-line; }
.passage cite { display: block; margin-top: 4px; font: normal 11px var(--mono); color: var(--doux); }

/* La plume de l'IA qui relit */
.relecture, .redaction { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; color: var(--bleu); font-size: 14px; font-style: italic; }
.trait { width: 34px; height: 2px; border-radius: 2px; background: var(--bleu); transform-origin: left; animation: plume 1.1s ease-in-out infinite; }
@keyframes plume { 0% { transform: scaleX(.1); opacity: .4; } 50% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(.1) translateX(300%); opacity: .4; } }

.fautes { margin-top: 10px; }
.fautes summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--bleu); font-size: 14px; padding: 4px 0; }
.fautes summary::-webkit-details-marker { display: none; }
.fautes summary .icone { width: 16px; height: 16px; }
.fautes[open] summary { margin-bottom: 4px; }
.fautes ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fautes li { padding: 10px 12px; background: var(--papier); border-radius: 8px; border: 1px solid var(--ligne); animation: fondu .25s; }
.faux { color: var(--rouge); text-decoration: line-through; text-decoration-thickness: 1px; opacity: .85; }
.fleche { color: var(--doux); margin: 0 8px; }
.juste { color: var(--bleu); font-weight: 600; }
.pourquoi { margin: 4px 0 0; color: var(--doux); font-size: 14.5px; line-height: 1.5; }

.explication { margin-top: 12px; padding: 12px 14px; background: var(--bleu-fond); border-left: 2px solid var(--bleu); border-radius: 0 8px 8px 0; }
.etiquette { font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--bleu); }
.explication p { margin: 6px 0 0; font-size: 16px; line-height: 1.6; white-space: pre-line; }

.vide-doux { color: var(--doux); font-style: italic; margin: 22px 0; max-width: 46ch; }
.aide { color: var(--doux); font-size: 14.5px; margin: 6px 0 0; }

/* ----- La fiche ----- */

.fiche.occupee .fiche-contenu { opacity: .4; transition: opacity .3s; }
.redaction { margin: 0 0 16px; }
.une-phrase { font-size: 22px; line-height: 1.4; font-style: italic; font-weight: 400; margin: 4px 0 4px; text-wrap: pretty; }
.une-phrase::before { content: '« '; color: var(--doux); }
.une-phrase::after { content: ' »'; color: var(--doux); }
.fiche h3, .synthese h3, .reglages h3 { font: 500 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .13em; color: var(--doux); margin: 30px 0 12px; }
.idees { list-style: none; counter-reset: idee; margin: 0; padding: 0; display: grid; gap: 16px; }
.idees li { counter-increment: idee; display: grid; grid-template-columns: 30px 1fr; }
.idees li::before { content: counter(idee); grid-row: span 2; font-size: 24px; line-height: 1; color: var(--bleu); font-weight: 300; }
.idees strong { font-size: 17px; }
.idees p { margin: 3px 0 0; line-height: 1.6; }
.retenir, .questions { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.retenir li, .questions li { padding-left: 24px; position: relative; line-height: 1.55; }
.retenir li::before { content: ''; position: absolute; left: 4px; top: .62em; width: 7px; height: 7px; background: var(--encre); }
.questions li::before { content: '?'; position: absolute; left: 4px; top: 0; color: var(--bleu); font-weight: 600; }
.fiche-vide p { margin: 0 0 14px; max-width: 48ch; }
.synthese { margin-top: 10px; }
.synthese.a-faire .composer { border: 1.5px dashed var(--bleu); }
.synthese-texte { font-size: 17px; line-height: 1.7; margin: 0 0 6px; white-space: pre-line; }

/* ----- L'avis ----- */

.critere { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--trait); }
.critere-nom { font-size: 17px; }
.points { display: flex; gap: 2px; }
.points button { width: 38px; height: 38px; display: grid; place-items: center; }
.points button::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--encre); transition: background .15s, transform .15s; }
.points button.plein::before { background: var(--encre); }
.points button:active::before { transform: scale(.85); }
.moyenne { font: 13px var(--mono); color: var(--doux); margin: 16px 0 0; }
.moyenne strong { font: 600 20px var(--serif); color: var(--encre); }

/* ---------- Le bilan ---------- */

.bilan section { margin-top: 38px; }
.bilan h2 { font-size: 19px; margin-bottom: 6px; }
.chiffres { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--trait); border: 1px solid var(--trait); border-radius: 10px; overflow: hidden; margin-top: 20px; }
.chiffre { background: var(--papier); padding: 16px 14px; display: flex; flex-direction: column; gap: 2px; }
.chiffre strong { font-size: 30px; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chiffre span { font: 11.5px var(--mono); color: var(--doux); }

.graphe { margin-top: 14px; }
.barres { display: flex; align-items: stretch; gap: 4px; height: 150px; border-bottom: 1px solid var(--doux); padding-top: 18px; margin-bottom: 26px; }
.barre { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.barre-trait { width: min(26px, 72%); height: var(--v); background: var(--bleu); border-radius: 4px 4px 0 0; opacity: .82; transition: opacity .15s; }
.barre:hover .barre-trait, .barre.choisie .barre-trait { opacity: 1; }
.barre.choisie .barre-trait { box-shadow: 0 0 0 2px var(--mur), 0 0 0 3.5px var(--bleu); }
.barre-valeur { font: 11px/1 var(--mono); color: var(--encre); margin-bottom: 5px; }
.barre-nom { position: absolute; top: calc(100% + 7px); left: 0; right: 0; font: 10.5px/1 var(--mono); color: var(--doux); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barres-detail { font-size: 14.5px; color: var(--doux); margin: 0; min-height: 1.5em; }

.pieges { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.pieges li { background: var(--papier); border: 1px solid var(--ligne); border-radius: 10px; padding: 12px 14px; }
.piege-haut { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.piege-haut .juste { font-size: 18px; }
.fois { margin-left: auto; font: 500 12px var(--mono); color: var(--doux); }

.puces { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.puces li { display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px 5px 14px; border: 1px solid var(--trait); border-radius: 999px; background: var(--papier); font-size: 15px; }
.reglages .rangee input { flex: 1; min-width: 180px; }
.mdp { display: grid; gap: 10px; max-width: 380px; margin-bottom: 24px; }
.mdp .bouton { justify-self: start; }

/* ---------- Annonces ---------- */

.annonce {
  position: fixed; z-index: 20; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 999px;
  background: var(--encre); color: var(--papier); font-size: 15px;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .6);
  animation: tombe .3s cubic-bezier(.2, .9, .3, 1.2);
}
.annonce.erreur { background: var(--rouge); }
.annonce.part { opacity: 0; transform: translate(-50%, -10px); transition: .4s; }
@keyframes tombe { from { transform: translate(-50%, -20px); opacity: 0; } }

/* ---------- Le livre qui sort de l'étagère ---------- */

::view-transition-group(livre-ouvert) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2, .75, .2, 1); }
::view-transition-old(livre-ouvert), ::view-transition-new(livre-ouvert) { height: 100%; object-fit: cover; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }

/* ---------- Écrans plus grands ---------- */

@media (min-width: 700px) {
  :root { --zone: 190px; --k: 1.2; }
  .titre-site { font-size: 34px; }
  .haut { padding-top: 40px; padding-inline: 32px; }
  .rayon-titre, .etagere { padding-inline: 32px; }
  .face { width: 124px; }
  .couv.grande { width: 150px; }
  .livre-titre { font-size: 32px; }
  .chiffres { grid-template-columns: repeat(4, 1fr); }
  .voile { align-items: center; }
  .feuille { border-radius: 18px; max-height: 80dvh; }
}
@media (max-width: 420px) { .cache-mobile { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
