/* Plume bleue Web — pensé d'abord pour l'iPhone, fonctionne aussi sur iPad et ordinateur. */
:root {
  --accent: #0033A0;
  --accent-doux: #e3eaf8;
  --fond: #eef2f9;
  --papier: #ffffff;
  --encre: #1b2238;
  --doux: #66708a;
  --trait: #d9e0ee;
  --ombre: 0 10px 30px rgba(10, 30, 80, .12);
  --serif: "Iowan Old Style", "Palatino", "Georgia", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --taille: 18px;
  --haut: env(safe-area-inset-top, 0px);
  --bas: env(safe-area-inset-bottom, 0px);
  --gauche: max(16px, env(safe-area-inset-left, 0px));
  --droite: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
:root[data-theme="sombre"] {
  --accent: #7ea6ff;
  --accent-doux: #1e2b4d;
  --fond: #0e1424;
  --papier: #161e33;
  --encre: #e7ecf7;
  --doux: #9aa6c4;
  --trait: #273252;
  --ombre: 0 10px 30px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--fond); color: var(--encre); font: 16px/1.5 var(--sans); }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 8px; }

svg.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; display: block; }

.vue { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--fond); }
.rond { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--encre); }
.rond:active { background: var(--accent-doux); }

/* ---------- Liste ---------- */
.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(var(--haut) + 14px) var(--droite) 8px var(--gauche); }
.marque { display: flex; align-items: center; gap: 12px; min-width: 0; }
.marque img { border-radius: 11px; box-shadow: 0 4px 12px rgba(0, 51, 160, .25); }
.marque h1 { margin: 0; font: 700 24px/1.1 var(--serif); color: var(--accent); }
.marque p { margin: 2px 0 0; color: var(--doux); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recherche { margin: 6px var(--droite) 0 var(--gauche); display: flex; align-items: center; gap: 8px; padding: 0 14px;
  background: var(--papier); border: 1px solid var(--trait); border-radius: 14px; height: 46px; color: var(--doux); }
.recherche input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--encre); font-size: 16px; }
.filtres { display: flex; gap: 8px; padding: 12px var(--droite) 4px var(--gauche); overflow-x: auto; scrollbar-width: none; }
.filtres button { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--trait); background: var(--papier); font-size: 14px; font-weight: 600; white-space: nowrap; }
.filtres button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="sombre"] .filtres button[aria-pressed="true"] { color: #0e1424; }

.liste { list-style: none; margin: 0; padding: 6px var(--droite) calc(var(--bas) + 110px) var(--gauche); overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.groupe { font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--doux); padding: 14px 4px 6px; text-transform: uppercase; }
.carte { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 16px; margin-bottom: 10px;
  background: var(--papier); border-radius: 16px; border: 1px solid var(--trait); box-shadow: 0 1px 2px rgba(10, 30, 80, .04); }
.carte:active { transform: scale(.99); }
.carte h3 { margin: 0; font: 650 17px/1.3 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte .extrait { grid-column: 1; color: var(--doux); font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.carte .date { grid-column: 1; color: var(--doux); font-size: 12.5px; }
.carte .actions { grid-row: 1 / span 3; grid-column: 2; align-self: center; }
.carte .pastille { position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px; border-radius: 0 4px 4px 0; }
.carte mark { background: color-mix(in srgb, #ffd54a 60%, transparent); color: inherit; border-radius: 3px; }
.vide { text-align: center; color: var(--doux); padding: 40px 30px; }
.vide img { border-radius: 18px; opacity: .9; }
.fab { position: fixed; right: var(--droite); bottom: calc(var(--bas) + 20px); display: flex; align-items: center; gap: 8px; padding: 0 22px 0 18px; height: 56px;
  border-radius: 28px; background: var(--accent); color: #fff; font-weight: 700; font-size: 17px; box-shadow: 0 10px 26px rgba(0, 51, 160, .35); }
:root[data-theme="sombre"] .fab { color: #0e1424; }
.fab:active { transform: scale(.97); }

/* ---------- Éditeur ---------- */
.barre-haut { display: flex; align-items: center; gap: 2px; padding: calc(var(--haut) + 6px) calc(var(--droite) - 8px) 6px calc(var(--gauche) - 8px);
  background: color-mix(in srgb, var(--fond) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--trait); z-index: 2; }
.etat { flex: 1; min-width: 0; text-align: center; font-size: 13px; color: var(--doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.defile { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.feuille { max-width: 760px; margin: 0 auto; padding: 22px var(--droite) 140px var(--gauche); }
@media (min-width: 820px) { .feuille { margin: 24px auto 120px; padding: 48px 64px; background: var(--papier); border-radius: 6px; box-shadow: var(--ombre); } }
.titre { width: 100%; border: 0; outline: 0; background: none; font: 700 28px/1.2 var(--serif); padding: 0; color: var(--encre); }
.titre::placeholder { color: color-mix(in srgb, var(--doux) 60%, transparent); }
.infos { color: var(--doux); font-size: 12.5px; margin: 6px 0 18px; padding-bottom: 12px; border-bottom: 2px solid var(--accent); width: max-content; max-width: 100%; }

.editeur { outline: 0; font: var(--taille)/1.6 var(--serif); min-height: 50vh; color: var(--encre); caret-color: var(--accent); word-wrap: break-word; }
.editeur .p { min-height: 1.6em; }
.editeur .p.h1 { font-size: 1.6em; font-weight: 700; line-height: 1.25; margin: .5em 0 .2em; }
.editeur .p.h2 { font-size: 1.3em; font-weight: 700; line-height: 1.3; margin: .45em 0 .15em; }
.editeur .p[data-al="1"] { text-align: center; }
.editeur .p[data-al="2"] { text-align: right; }
.editeur .p.qt { border-left: 4px solid var(--accent); padding-left: 16px; font-style: italic; color: color-mix(in srgb, var(--encre) 85%, var(--accent)); margin: .2em 0; }
.editeur .p.li, .editeur .p.ol, .editeur .p.ck { position: relative; padding-left: 1.6em; }
.editeur .p.li::before { content: "•"; position: absolute; left: .45em; color: var(--accent); font-weight: 700; }
.editeur { counter-reset: num; }
.editeur .p:not(.ol) { counter-reset: num; }
.editeur .p.ol { counter-increment: num; }
.editeur .p.ol::before { content: counter(num) "."; position: absolute; left: 0; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.editeur .p.ck::before { content: ""; position: absolute; left: .1em; top: .32em; width: .95em; height: .95em; border: 2px solid var(--accent); border-radius: 5px; }
.editeur .p.ck[data-k="1"]::before { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center/80% no-repeat; }
.editeur .p.ck[data-k="1"] { color: var(--doux); text-decoration: line-through; }
.editeur img.img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 8px 0; }
.editeur sup.fn { color: var(--accent); font-weight: 700; padding: 0 2px; cursor: pointer; }
.editeur .tb { display: block; overflow-x: auto; margin: 8px 0; }
.editeur .tb table, .texte-lecture table { border-collapse: collapse; font-family: var(--sans); font-size: .85em; }
.editeur .tb td, .editeur .tb th, .texte-lecture td, .texte-lecture th { border: 1px solid var(--trait); padding: 6px 10px; text-align: left; }
.editeur .tm { color: var(--accent); font-family: var(--sans); font-size: .85em; }

.outils { position: fixed; left: 0; right: 0; bottom: 0; padding: 6px var(--droite) calc(var(--bas) + 6px) var(--gauche); z-index: 5;
  background: color-mix(in srgb, var(--papier) 92%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--trait);
  transform: translateY(var(--clavier, 0px)); }
.outils-defile { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; align-items: center; }
.outils-defile::-webkit-scrollbar { display: none; }
.outils button { flex: none; min-width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; color: var(--encre); }
.outils button.txt { padding: 0 12px; font-weight: 650; font-size: 14px; background: var(--accent-doux); color: var(--accent); }
.outils button[aria-pressed="true"] { background: var(--accent); color: #fff; }
:root[data-theme="sombre"] .outils button[aria-pressed="true"] { color: #0e1424; }
.outils .sep { width: 1px; height: 26px; background: var(--trait); margin: 0 4px; flex: none; }

/* ---------- Menu « / » ---------- */
.menu-slash { position: fixed; z-index: 20; width: min(320px, calc(100vw - 32px)); max-height: 300px; overflow-y: auto; background: var(--papier); border: 1px solid var(--trait);
  border-radius: 14px; box-shadow: var(--ombre); padding: 6px; }
.menu-slash button { width: 100%; display: grid; grid-template-columns: 32px 1fr; gap: 2px 10px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 10px; }
.menu-slash button.actif, .menu-slash button:active { background: var(--accent-doux); }
.menu-slash b { font-weight: 650; font-size: 15px; }
.menu-slash small { grid-column: 2; color: var(--doux); font-size: 12.5px; margin-top: -2px; }
.menu-slash svg { grid-row: span 2; color: var(--accent); }

/* ---------- Feuilles du bas ---------- */
.fond-feuille { position: fixed; inset: 0; background: rgba(5, 12, 30, .38); z-index: 30; animation: apparait .2s; }
.feuille-bas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 88vh; overflow-y: auto; background: var(--papier);
  border-radius: 22px 22px 0 0; padding: 8px var(--droite) calc(var(--bas) + 18px) var(--gauche); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
  animation: monte .26s cubic-bezier(.2, .9, .3, 1); }
@media (min-width: 700px) { .feuille-bas { left: 50%; right: auto; width: 560px; transform: translateX(-50%); bottom: 24px; border-radius: 22px; animation: apparait .2s; } }
.poignee { width: 40px; height: 5px; border-radius: 3px; background: var(--trait); margin: 2px auto 12px; }
.feuille-bas h2 { margin: 4px 4px 12px; font: 700 21px/1.2 var(--serif); }
.feuille-bas p.aide { color: var(--doux); margin: -4px 4px 14px; font-size: 14.5px; }
.choix { display: grid; gap: 2px; }
.choix button, .choix a { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 13px 12px; border-radius: 12px; font-size: 16px; color: var(--encre); text-decoration: none; }
.choix button:active, .choix a:active { background: var(--accent-doux); }
.choix svg { color: var(--accent); flex: none; }
.choix .danger, .choix .danger svg { color: #d33; }
.choix small { display: block; color: var(--doux); font-size: 13px; }
.choix hr { border: 0; border-top: 1px solid var(--trait); margin: 6px 4px; }
.galerie { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .galerie { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.modele { text-align: left; }
.modele .page { aspect-ratio: 8.5 / 11; background: #fff; border: 1px solid var(--trait); border-radius: 8px; overflow: hidden; padding: 10px; position: relative;
  font: 6px/1.35 var(--serif); color: #222; box-shadow: 0 2px 8px rgba(10, 30, 80, .08); }
.modele .page .p.h1 { font-size: 1.6em; font-weight: 700; }
.modele .page .p.h2 { font-size: 1.3em; font-weight: 700; }
.modele .page .p.li::before { content: "• "; }
.modele .page .vierge { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); font-size: 40px; font-weight: 300; }
.modele span.nom { display: block; font-size: 13.5px; font-weight: 600; margin-top: 6px; }
.couleurs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; padding: 4px; }
.couleurs button { aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--papier); box-shadow: 0 0 0 1px var(--trait); }
.couleurs button.aucune { background: linear-gradient(135deg, transparent 46%, #d33 46%, #d33 54%, transparent 54%), var(--papier); }
.reglage { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 6px; border-bottom: 1px solid var(--trait); }
.reglage:last-child { border-bottom: 0; }
.reglage b { display: block; font-weight: 600; }
.reglage small { color: var(--doux); font-size: 13px; }
.segments { display: flex; background: var(--fond); border-radius: 10px; padding: 3px; flex: none; }
.segments button { padding: 6px 11px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--doux); }
.segments button[aria-pressed="true"] { background: var(--papier); color: var(--encre); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.champ { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--trait); background: var(--fond); font-size: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; border-radius: 14px; font-weight: 700; background: var(--accent); color: #fff; width: 100%; font-size: 16px; }
:root[data-theme="sombre"] .btn { color: #0e1424; }
.btn.second { background: var(--accent-doux); color: var(--accent); }
.rangee { display: flex; gap: 10px; margin-top: 14px; }
.etapes { margin: 0; padding: 0 4px 0 22px; display: grid; gap: 10px; }
.etapes li { padding-left: 4px; }
.carre-ios { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent-doux); color: var(--accent); vertical-align: -7px; }
.carre-ios svg { width: 17px; height: 17px; }

/* ---------- Bulle ---------- */
.bulle { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bas) + 90px); z-index: 50; background: var(--encre); color: var(--papier);
  padding: 11px 18px; border-radius: 14px; font-size: 14.5px; max-width: calc(100vw - 40px); box-shadow: var(--ombre); animation: apparait .2s; text-align: center; }

/* ---------- Lecture ---------- */
.lecture { background: #fbf8f1; --encre-l: #2a2620; }
.lecture[data-l="sepia"] { background: #f1e6cf; --encre-l: #4a3a22; }
.lecture[data-l="nuit"] { background: #12161f; --encre-l: #d6d9e0; }
.lecture .barre-haut { background: transparent; border: 0; }
.lecture .rond { color: var(--encre-l); }
.lecture .etat { color: color-mix(in srgb, var(--encre-l) 60%, transparent); }
.texte-lecture { max-width: 640px; margin: 0 auto; padding: 12px var(--droite) 120px var(--gauche); font: var(--taille-l, 21px)/1.75 var(--serif); color: var(--encre-l); }
.texte-lecture h1.titre-l { font-size: 1.5em; line-height: 1.2; margin: .3em 0 1em; }
.texte-lecture .p { min-height: 1em; margin: 0 0 .5em; }
.texte-lecture .p.h1 { font-size: 1.35em; font-weight: 700; }
.texte-lecture .p.h2 { font-size: 1.15em; font-weight: 700; }
.texte-lecture .p.qt { border-left: 3px solid currentColor; padding-left: 14px; font-style: italic; opacity: .9; }
.texte-lecture .p.li::before { content: "• "; }
.texte-lecture .p[data-al="1"] { text-align: center; }
.texte-lecture img { max-width: 100%; border-radius: 8px; }
.texte-lecture .lu { background: color-mix(in srgb, #ffd54a 55%, transparent); border-radius: 3px; }

#voile-fondu { position: fixed; inset: 0; z-index: 100; pointer-events: none; }

@keyframes monte { from { transform: translateY(100%); } }
@keyframes apparait { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Impression (Exporter en PDF) : seulement le document */
@media print {
  body { background: #fff; }
  .vue, .feuille-bas, .fond-feuille, .menu-slash, .bulle { display: none !important; }
  #impression { display: block !important; font: 12pt/1.5 Georgia, serif; color: #000; }
  #impression .p { min-height: 1em; }
  #impression .p.h1 { font-size: 1.6em; font-weight: 700; }
  #impression .p.h2 { font-size: 1.3em; font-weight: 700; }
  #impression .p.li::before { content: "• "; }
  #impression .p.qt { border-left: 3px solid #0033A0; padding-left: 12px; font-style: italic; }
  #impression .p[data-al="1"] { text-align: center; }
  #impression .p[data-al="2"] { text-align: right; }
  #impression img { max-width: 100%; }
}
#impression { display: none; }
