/* Livre Vert v4 — mise en page entièrement en flex :
   en-tête (flex: none) · corps défilant sur mesure (flex: 1) · pied fixe (flex: none) */

:root {
  --green: #1D4A2E;
  --green-2: #285C3A;
  --gold: #B8913F;
  --gold-light: #D9BC7A;
  --sans: Tahoma, Verdana, "Segoe UI", sans-serif;
  --display: var(--sans);
  --serif: var(--sans);
  --mono: "Courier Prime", "Courier New", monospace;
  --fs: 19px;
  --radius: 16px;
  --tabs-h: 64px;
  --header-h: 60px;
}

/* Thèmes de lecture */
:root, [data-theme="ivoire"] {
  --bg: #F6F1E6; --paper: #FBF8F0; --sheet: #FFFDF8; --card: #FBF8F0;
  --fg: #1E1C17; --muted: #5C574C; --line: #E3DCCB; --line-2: #D9D0BB;
  --marker: #7A5B1E; --accent: var(--green); --on-accent: #F6F1E6;
  --soft: #E7EFE8; --mark: #F2E2AE; --shadow: rgba(60,48,20,.10);
  --doc: #FFFEFA; --stamp: #9A2B1E;
}
[data-theme="sepia"] {
  --bg: #EFE4CB; --paper: #F3E9D2; --sheet: #F8F0DE; --card: #F6EDD8;
  --fg: #2A2217; --muted: #5F523B; --line: #DCCDAA; --line-2: #CFBF99;
  --marker: #6E4F14; --accent: var(--green); --on-accent: #F6F1E6;
  --soft: #E3E0C2; --mark: #E9CF8C; --shadow: rgba(60,48,20,.12);
  --doc: #FBF5E6; --stamp: #8E2A1C;
}
[data-theme="nuit"] {
  --bg: #0E120E; --paper: #111511; --sheet: #1A201A; --card: #161B16;
  --fg: #E6E2D6; --muted: #A7A294; --line: #2C332C; --line-2: #3A423A;
  --marker: #D8B66C; --accent: #8CC59D; --on-accent: #0E1A12;
  --soft: #1B261D; --mark: #5B4A1C; --shadow: rgba(0,0,0,.4);
  --doc: #1A1E19; --stamp: #E07A63;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ============ Squelette flex ============ */
.app {
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
.app-header {
  flex: none; display: flex; align-items: center; gap: 4px;
  min-height: var(--header-h); padding: 0 8px 0 12px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.app-main {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;              /* chaque vue décide de son défilement */
  position: relative;
}
.app-tabs {
  flex: none; display: flex; flex-direction: column;
  background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Zone défilante standard d'une vue */
.scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.split { flex: 1 1 auto; min-height: 0; display: flex; }
.split > .side { flex: none; width: 300px; overflow-y: auto; border-right: 1px solid var(--line); display: none; }
.split > .scroll { flex: 1 1 auto; }
@media (min-width: 1100px) { .split > .side { display: flex; flex-direction: column; } }

/* ============ En-tête ============ */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); padding: 8px 6px; border-radius: 10px; }
.brand b { font-family: var(--serif); font-weight: 600; font-size: 18px; white-space: nowrap; }
@media (max-width: 759px) { .app-header.has-title .brand b { display: none; } }
.hdr-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding: 0 4px; }
.hdr-title .k { font-size: 11px; font-weight: 600; letter-spacing: 1.4px; color: var(--marker); text-transform: uppercase; }
.hdr-title .t { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-spacer { flex: 1 1 auto; }
.icon-btn {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 22px;
  background: transparent; color: var(--fg);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.icon-btn:hover { background: var(--soft); }
.icon-btn.aa { font-family: var(--serif); font-weight: 600; font-size: 17px; }
.chip-status {
  flex: none; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--soft); color: var(--accent); display: none;
}
.chip-status.show { display: inline-flex; }
.chip-status.off { background: #F6DCD5; color: #8A2A1B; }
[data-theme="nuit"] .chip-status.off { background: #3A1E19; color: #F0A898; }
.hide-mobile { display: none; }
@media (min-width: 760px) { .hide-mobile { display: inline-flex; } .hide-desktop { display: none !important; } }

/* ============ Pied fixe (onglets + progression) ============ */
.progress { display: none; flex-direction: column; gap: 6px; padding: 8px 20px 6px; }
.progress.show { display: flex; }
.progress .bar { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress .row { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.tabs { display: flex; height: var(--tabs-h); }
.tab {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; min-width: 0;
}
.tab[aria-current="page"] { color: var(--accent); font-weight: 600; }
@media (min-width: 760px) {
  .app-tabs { flex-direction: row; align-items: center; }
  .progress { order: 2; flex: 1 1 auto; padding: 0 24px; }
  .tabs { order: 1; height: 52px; flex: none; padding: 0 12px; gap: 4px; }
  .tab { flex: none; flex-direction: row; gap: 8px; font-size: 14px; padding: 0 14px; border-radius: 10px; margin: 6px 0; }
  .tab svg.i { width: 18px; height: 18px; }
  .tab[aria-current="page"] { background: var(--soft); }
}

/* ============ Éléments communs ============ */
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 24px; }
@media (min-width: 760px) { .wrap { padding: 36px 32px 64px; gap: 40px; } }
.kicker { font-size: 11px; font-weight: 600; letter-spacing: 1.6px; color: var(--marker); text-transform: uppercase; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; line-height: 1.2; }
.h-sec { font-size: 26px; }
@media (min-width: 760px) { .h-sec { font-size: 32px; } }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 15px; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--line-2); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 18px; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--card); color: var(--fg); font-size: 13px; font-weight: 500;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip .n { opacity: .75; margin-left: 4px; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
mark.cur { outline: 2px solid var(--accent); }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.loading { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); gap: 10px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Accueil ============ */
.hero { display: flex; flex-wrap: wrap; gap: 20px; }
.cover {
  flex: 3 1 480px; min-width: 0; position: relative; overflow: hidden;
  background: var(--green); color: #F6F1E6; border-radius: 24px;
  padding: 32px 24px 28px; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; min-height: 340px;
}
.cover .rings { position: absolute; right: -120px; top: -120px; width: 380px; height: 380px; pointer-events: none; }
.cover .author { font-size: 12px; font-weight: 600; letter-spacing: 2.6px; color: var(--gold-light); }
.cover .rule { width: 40px; height: 2px; background: var(--gold-light); }
.cover h1 { font-size: 36px; line-height: 1.08; max-width: 620px; }
.cover p { margin: 0; color: #D8DED5; font-size: 15px; line-height: 1.6; max-width: 540px; }
.cover .pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cover .pill { font-size: 12px; padding: 6px 10px; border-radius: 999px; background: var(--green-2); color: #EDF2EA; display: inline-flex; gap: 6px; align-items: center; }
.cover .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.cover .btn { background: #F6F1E6; color: var(--green); border-radius: 26px; }
.cover .btn.ghost { background: transparent; color: #F6F1E6; border-color: #6E8F78; }
@media (min-width: 760px) { .cover { padding: 56px 48px; min-height: 440px; } .cover h1 { font-size: 56px; } }
.hero-side { flex: 2 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.resume { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.resume .t { font-family: var(--serif); font-size: 20px; line-height: 1.3; }
.quote { padding: 22px; border-radius: var(--radius); background: var(--soft); display: flex; flex-direction: column; gap: 12px; flex: 1; }
.quote blockquote { margin: 0; font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.5; }
.quote .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.chap {
  display: flex; flex-direction: column; gap: 8px; padding: 20px; min-height: 150px;
  text-decoration: none; color: var(--fg);
}
.chap .num { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--gold); line-height: 1; }
.chap .t { flex: 1; font-family: var(--serif); font-size: 18px; line-height: 1.3; }
.chap .p { font-size: 13px; color: var(--muted); }
.chap:hover { border-color: var(--accent); }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 22px; border-radius: var(--radius); background: var(--green); color: #F6F1E6; text-decoration: none; min-height: 140px; }
.tile .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tile b { font-family: var(--serif); font-size: 21px; }
.tile .tag { font-size: 11px; font-weight: 600; letter-spacing: 1px; color: var(--green); background: var(--gold-light); border-radius: 999px; padding: 4px 8px; }
.tile span.d { font-size: 14px; line-height: 1.5; color: #D8DED5; }
.site-foot { border-top: 1px solid var(--line); padding-top: 20px; display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; font-size: 13px; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 16px; }

/* ============ Lecteur ============ */
.toc { padding: 24px 14px 24px 18px; display: flex; flex-direction: column; gap: 2px; }
.toc a { display: flex; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--fg); font-size: 14px; line-height: 1.35; }
.toc a .n { width: 28px; flex: none; font-family: var(--serif); font-weight: 600; color: var(--marker); }
.toc a .t { flex: 1; }
.toc a .p { font-size: 12px; color: var(--muted); }
.toc a[aria-current="true"] { background: var(--soft); }
.toc a.sub { padding: 6px 12px 6px 50px; font-size: 13px; color: var(--muted); }
.toc a.sub:hover { color: var(--fg); background: var(--soft); }
.goto { display: flex; gap: 8px; align-items: center; padding: 18px 12px 0; flex-wrap: wrap; }
.goto label { width: 100%; font-size: 13px; color: var(--muted); }
.goto input { width: 90px; height: 42px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--paper); padding: 0 10px; }

.reader-scroll { scroll-behavior: auto; }
.article {
  max-width: 680px; margin: 0 auto; padding: 32px 24px 120px;
  font-family: var(--serif); font-size: var(--fs); line-height: 1.7;
  hyphens: auto; -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
@media (min-width: 1280px) { .article.has-margin { max-width: 980px; padding-right: 300px; } }
.ch-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; margin: 12px 0 36px; }
.ch-head .k { font: 600 12px var(--sans); letter-spacing: 3px; color: var(--marker); }
.ch-head h1 { font-size: 30px; line-height: 1.2; }
@media (min-width: 760px) { .ch-head h1 { font-size: 40px; } }
.article p { margin: 0 0 1em; }
.article h3 { font-size: 1.1em; margin: 1.6em 0 .8em; }
.article .doc {
  font-family: var(--mono); font-size: .8em; line-height: 1.6; white-space: pre-line;
  background: var(--doc); border: 1px solid var(--line); border-radius: 8px; padding: 20px 22px; margin: 0 0 1.2em;
  box-shadow: 0 6px 14px var(--shadow);
}
.article .caps { font-family: var(--sans); font-size: .78em; font-weight: 600; letter-spacing: .6px; color: var(--muted); margin-bottom: .6em; }
.article .doc.center { text-align: center; font-family: var(--serif); font-size: .95em; box-shadow: none; }
.article .pgline { margin: .4em 0; }
.nref, .pg { user-select: none; -webkit-user-select: none; }
.article .biblio { font-size: .85em; }
.article .biblio p { padding-left: 2em; text-indent: -2em; margin-bottom: .6em; }
.pg {
  display: inline-block; font: 600 11px/1.4 var(--sans); color: var(--marker);
  border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin: 0 2px;
  vertical-align: 2px; scroll-margin-top: 30vh; user-select: none; -webkit-user-select: none;
}
.nref {
  font: 600 11px var(--sans); vertical-align: 7px; min-width: 20px; height: 20px; padding: 0 5px; margin: 0 1px;
  border-radius: 10px; border: 0; background: var(--soft); color: var(--accent); line-height: 20px;
}
.nref.on { background: var(--accent); color: var(--on-accent); }
.sidenote { display: none; }
@media (min-width: 1280px) {
  .sidenote {
    display: block; float: right; clear: right; width: 260px; margin: 0 -300px 14px 0;
    font: 14px/1.55 var(--serif); color: var(--fg);
    border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--card);
    max-height: 260px; overflow: auto;
  }
  .sidenote .h { display: block; font: 600 12px var(--sans); color: var(--marker); margin-bottom: 4px; }
  .sidenote.on { border-color: var(--accent); background: var(--soft); }
}
.ch-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); font: 14px var(--sans); }
.ch-nav a { text-decoration: none; font-weight: 600; }
.ch-nav .prev { color: var(--muted); }

/* Barre de résultats dans le lecteur */
.hitbar {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 5;
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 16px; min-height: 52px;
  background: var(--accent); color: var(--on-accent); border-radius: 26px; box-shadow: 0 8px 24px var(--shadow);
}
.hitbar .lbl { flex: 1; font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hitbar button { width: 40px; height: 40px; border: 0; border-radius: 20px; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
.hitbar svg.i { width: 18px; height: 18px; }
.quotebar {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 6;
  display: flex; gap: 6px; padding: 6px; border-radius: 26px; background: var(--fg); box-shadow: 0 8px 24px var(--shadow);
}
.quotebar button { border: 0; border-radius: 20px; height: 40px; padding: 0 14px; background: transparent; color: var(--bg); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }

/* ============ Recherche ============ */
.search-head { flex: none; padding: 12px 16px 0; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.search-box { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 6px 0 16px; border-radius: 25px; border: 1.5px solid var(--accent); background: var(--sheet); max-width: 720px; width: 100%; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; font-weight: 500; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-opts { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; color: var(--muted); }
.search-opts label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--fg); }
.search-opts input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); }
.search-head .chips { margin: 0 -16px; padding: 2px 16px 12px; }
.results { max-width: 820px; margin: 0 auto; padding: 14px 16px 40px; display: flex; flex-direction: column; gap: 10px; }
.result { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; text-decoration: none; color: var(--fg); }
.result:hover { border-color: var(--accent); }
.result .top { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; font-weight: 600; }
.result .top .c { color: var(--marker); }
.result .top .p { color: var(--accent); white-space: nowrap; }
.result .s { font-family: var(--serif); font-size: 16px; line-height: 1.55; }
.more { align-self: center; }

/* ============ Frise ============ */
.eras { display: flex; flex-wrap: wrap; gap: 8px; }
.era {
  flex: var(--g, 1) 1 200px; min-height: 104px; padding: 14px 16px; border-radius: 16px; border: 0; text-align: left;
  background: var(--card); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.era .s { font-size: 11px; font-weight: 600; letter-spacing: 1.4px; color: var(--marker); }
.era b { font-family: var(--serif); font-size: 19px; line-height: 1.2; }
.era .c { margin-top: auto; font-size: 12px; color: var(--muted); }
.era[aria-pressed="true"] { background: var(--green); color: #F6F1E6; box-shadow: none; }
.era[aria-pressed="true"] .s { color: var(--gold-light); }
.era[aria-pressed="true"] .c { color: #D8DED5; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ev { display: flex; gap: 12px; }
.ev .d { width: 72px; flex: none; padding-top: 16px; text-align: right; display: flex; flex-direction: column; }
.ev .d small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.ev .d b { font-family: var(--serif); font-size: 18px; color: var(--marker); }
.ev .rail { width: 14px; flex: none; display: flex; flex-direction: column; align-items: center; }
.ev .rail i { width: 2px; background: var(--line-2); }
.ev .rail i:first-child { height: 20px; }
.ev .rail i:last-child { flex: 1; }
.ev .rail em { width: 12px; height: 12px; border-radius: 6px; background: var(--accent); box-shadow: 0 0 0 3px var(--bg); }
.ev a { flex: 1; min-width: 0; margin: 8px 0; padding: 14px 16px; text-decoration: none; color: var(--fg); display: flex; flex-direction: column; gap: 6px; }
.ev a .t { font-family: var(--serif); font-size: 16px; line-height: 1.45; }
.ev a .p { font-size: 12px; font-weight: 600; color: var(--accent); }
@media (min-width: 900px) {
  .timeline { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
  .ev .d, .ev .rail { display: none; }
  .ev a { margin: 0; min-height: 170px; padding: 20px; }
  .ev a::before { content: attr(data-date); font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--marker); }
}

/* ============ Archives ============ */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.docc {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px; min-height: 170px;
  background: var(--doc); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 1px 0 var(--line), 0 6px 14px var(--shadow);
  text-decoration: none; color: var(--fg);
}
.docc:hover { border-color: var(--accent); }
.docc .h { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-right: 96px; }
.docc .t { flex: 1; font-family: var(--serif); font-size: 16px; line-height: 1.4; }
.docc .f { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line-2); padding-top: 10px; }
.docc .f b { color: var(--accent); }
.stamp {
  position: absolute; top: 14px; right: 12px; transform: rotate(-6deg);
  font: 700 11px var(--mono); letter-spacing: 1px; color: var(--stamp); border: 1.5px solid currentColor; border-radius: 4px; padding: 2px 6px;
}

/* ============ À propos ============ */
.prose { max-width: 720px; font-size: 16px; line-height: 1.7; }
.prose h2 { font-size: 24px; margin: 1.4em 0 .5em; }
.prose h3 { font-size: 18px; margin: 1.2em 0 .4em; }
.prose ul { padding-left: 1.2em; }
.names { columns: 2 220px; padding-left: 1.2em; }

/* ============ Feuilles (bottom sheets) & toasts ============ */
.sheet-back {
  position: fixed; inset: 0; z-index: 50; background: rgba(10,14,10,.45);
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  animation: fade .15s ease-out;
}
.sheet {
  width: 100%; max-width: 640px; max-height: 85dvh; display: flex; flex-direction: column;
  background: var(--sheet); color: var(--fg); border-radius: 22px 22px 0 0;
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px var(--shadow);
  animation: up .2s ease-out;
}
@media (min-width: 760px) { .sheet-back { justify-content: center; } .sheet { border-radius: 22px; max-height: 80vh; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); align-self: center; margin-bottom: 10px; flex: none; }
.sheet .sh-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet .sh-head b { font-family: var(--serif); font-size: 18px; }
.sheet .sh-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.sheet .sh-foot { flex: none; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.sheet .sh-foot .btn { flex: 1 1 160px; }
.note-text { font-family: var(--serif); font-size: 16px; line-height: 1.6; white-space: pre-line; }
.set-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.set-row .l { font-size: 13px; color: var(--muted); }
.size-row { display: flex; align-items: center; gap: 12px; }
.size-row button { width: 56px; height: 48px; border-radius: 14px; border: 1px solid var(--line-2); background: transparent; font-family: var(--serif); font-weight: 600; }
.size-row input { flex: 1; accent-color: var(--green); }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.themes button { height: 64px; border-radius: 14px; border: 1px solid var(--line-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; }
.themes button span { font-family: var(--serif); font-weight: 600; font-size: 17px; }
.themes button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
.quote-card { display: block; margin: 0 auto; width: auto; height: auto; max-width: 100%; max-height: 56vh; max-height: 56dvh; border-radius: 14px; background: var(--green); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 60; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 18px; border-radius: 24px; background: var(--fg); color: var(--bg); font-size: 14px;
  box-shadow: 0 8px 24px var(--shadow); animation: up .2s ease-out;
}
.toast button { border: 0; border-radius: 18px; height: 36px; padding: 0 14px; background: var(--bg); color: var(--fg); font-weight: 600; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }
.toast { animation-name: fade; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.home-wrap { max-width: 1340px; }
.hero { display: grid; gap: clamp(18px, 3vw, 42px); }
.cover {
  display: grid; grid-template-columns: 1fr; align-items: center;
  min-height: auto; padding: clamp(26px, 5vw, 70px); gap: clamp(24px, 4vw, 64px);
  border-radius: 4px;
  background: radial-gradient(ellipse at 80% 25%, #315548 0%, #182f28 64%, #152820 100%);
}
.cover-copy { display: grid; gap: 15px; justify-items: start; min-width: 0; }
.cover h1 {
  margin: 0; color: #fbf1da; font: 400 clamp(2.15rem, 8.6vw, 6.4rem)/.91 var(--display);
  letter-spacing: -.018em; text-wrap: balance;
}
.cover h1 em { display: block; font-weight: inherit; }
.cover p.cover-byline { color: #ebd4a3; font: 400 clamp(1.15rem, 2.1vw, 1.75rem)/1.15 var(--serif); }
.cover .actions { margin-top: 7px; }
.cover .pill { background: none; padding: 0; color: #dce6d6; }
.cover .pill:empty { display: none; }
.cover-stage { display: grid; place-items: center; perspective: 1100px; padding: 0 12px 8px; }
.book-cover {
  position: relative; isolation: isolate; width: min(100%, 255px); aspect-ratio: 3 / 4;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: 12% 8% 10%; text-align: center; color: #f1d6a1;
  background: repeating-linear-gradient(91deg, #ffffff06 0 1px, transparent 1px 4px), linear-gradient(90deg, #12312c 0 7%, #496753 8%, #234b40 11%, #305647 100%);
  border: 1px solid #637a5e; border-radius: 4px 2px 2px 4px;
  box-shadow: 7px 4px 0 #d5c29a, 12px 7px 0 #254138, 20px 22px 32px #071512a6;
  transform: rotateY(-13deg) rotateZ(-4deg);
  transition: transform .5s cubic-bezier(.22, 1, .36, 1);
}
.book-cover::before { content: ""; position: absolute; inset: 7% 8% 7% 12%; border: 1px solid #dcbe8082; pointer-events: none; }
.book-cover span, .book-cover small { font: 600 .63rem/1.2 var(--sans); letter-spacing: .08em; }
.book-cover div { font: 400 clamp(1.65rem, 3.2vw, 2.45rem)/.94 var(--display); }
.hero-side { display: grid; grid-template-columns: 1fr; gap: 18px; }
.hero-side .resume, .hero-side .quote { border: 0; border-top: 1px solid var(--line-2); background: transparent; border-radius: 0; padding: 18px 0 0; }
.hero-side .resume .btn { align-self: start; }
.hero-side .quote blockquote { font-size: clamp(1.35rem, 2.8vw, 2rem); line-height: 1.16; }
.reading-tools { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.reading-tools .btn span { color: var(--muted); font-size: .75rem; }
.edition-button { font-size: .72rem; font-weight: 700; }
.edition-row {
  display: flex; width: 100%; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px;
  text-align: start; text-decoration: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 14px 0; color: var(--fg); background: transparent;
}
.edition-row span { color: var(--muted); font-size: .85rem; }
.translation-text, .passage-preview { font: 400 var(--fs)/1.55 var(--serif); }
.passage-preview { margin-inline: 0; padding-inline-start: 14px; border-inline-start: 2px solid var(--marker); }
.passage-preview cite { font: .8rem var(--sans); color: var(--muted); }
.annotation-form { display: grid; gap: 9px; }
.annotation-form textarea {
  width: 100%; min-height: 100px; resize: vertical; font: inherit; color: var(--fg);
  padding: 12px; background: var(--paper); border: 1px solid var(--line-2); border-radius: 8px;
}
.annotation-form .btn { justify-self: start; }
.notebook-entry { padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.notebook-entry p { white-space: pre-wrap; }
.annotation-actions { display: flex; gap: 12px; align-items: center; }
.quotebar { width: max-content; max-width: calc(100% - 24px); display: flex; flex-wrap: wrap; justify-content: center; }
.quotebar button { white-space: normal; }
.article { line-height: 1.62; }
.ch-head h1 { font: 400 clamp(2.4rem, 5vw, 4.5rem)/.97 var(--display); }
@media (min-width: 580px) {
  .cover { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
  .hero-side { grid-template-columns: 1fr 1fr; gap: clamp(18px, 4vw, 52px); }
  .cover h1 { font-size: clamp(2.8rem, 6.2vw, 6.4rem); }
}
@media (max-width: 579px) {
  .cover-stage { display: none; }
  .hero-side .quote { padding-bottom: 7px; }
  #hdrActions .icon-btn { min-width: 33px; width: 33px; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .cover-stage:hover .book-cover { transform: rotateY(-4deg) rotateZ(-1deg) translateY(-5px); }
  .home-wrap .btn, .home-wrap .chap { transition: background-color .2s ease, border-color .2s ease, transform .22s ease; }
  .home-wrap .chap:hover { transform: translateY(-3px); }
}
@media (prefers-reduced-motion: no-preference) {
  .cover-copy, .cover-stage { animation: lv-enter .5s cubic-bezier(.22, 1, .36, 1) both; }
  .cover-stage { animation-delay: 75ms; }
  @keyframes lv-enter { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
}

:root, [data-theme="ivoire"] {
  --bg: #f4f1ea; --paper: #faf8f2; --card: #f8f5ee; --line: #ded8cb;
  --line-2: #ccc3b1; --green: #213b31; --green-2: #35594a; --soft: #e4e9e1;
}
.app-header {
  position: relative; z-index: 9; min-height: 68px; gap: 8px; padding-inline: clamp(10px, 3vw, 48px);
}
.brand { color: var(--fg); }
.brand b { font: 400 clamp(1.4rem, 2.4vw, 2rem)/1 var(--display); }
.brand .i { color: var(--accent); }
.hdr-title { padding-inline: 6px; }
.main-menu { display: none; }
.main-menu a, .main-menu button {
  display: flex; align-items: center; color: var(--fg); background: none; border: 0;
  padding: 11px 12px; text-decoration: none; font-size: .9rem; white-space: nowrap;
}
.main-menu :is(a, button):hover, .main-menu [aria-current="page"] { background: var(--soft); color: var(--accent); }
.menu-toggle {
  flex: none; min-height: 40px; border: 1px solid var(--line-2); color: var(--fg); background: transparent;
  padding-inline: 8px; font-size: .83rem;
}
.menu-toggle span { margin-inline-start: 2px; }
.main-menu.is-open {
  display: flex; flex-direction: column; position: absolute; inset: 100% 0 auto;
  max-height: min(75vh, 440px); overflow: auto; padding: 8px clamp(12px, 3vw, 48px);
  background: var(--paper); border-bottom: 1px solid var(--line-2); box-shadow: 0 8px 16px var(--shadow);
}
.app-tabs[hidden], .pinned-note[hidden] { display: none; }
.app-tabs { padding-inline: clamp(12px, 3vw, 48px); }
.app-tabs .progress { padding: 8px 0; }
.home-wrap { gap: clamp(30px, 5vw, 72px); }
.hero { display: flex; flex-direction: column; }
.cover {
  display: flex; justify-content: space-between; background: var(--paper); color: var(--fg);
  padding: clamp(22px, 5vw, 72px); border: 1px solid var(--line); border-radius: 0;
}
.cover-copy { flex: 1 1 60%; }
.cover h1 { color: var(--fg); }
.cover h1 em { color: var(--accent); }
.cover p, .cover p.cover-byline, .cover .pill { color: var(--muted); }
.cover .btn { background: var(--accent); color: var(--on-accent); border-radius: 3px; }
.cover .btn.ghost { color: var(--accent); border-color: var(--line-2); }
.cover-stage { flex: 1 0 30%; }
.hero-side { display: flex; flex-wrap: wrap; }
.hero-side > section { flex: 1 1 260px; }
.home-wrap .chap { flex: 1 1 245px; min-height: 120px; border-radius: 0; }
.home-wrap .grid { display: flex; flex-wrap: wrap; }
.explore { display: flex; flex-wrap: wrap; gap: 12px 44px; }
.explore h2 { flex: 1 1 220px; }
.explore-links { flex: 3 1 480px; min-width: 0; }
.explore-links a {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; padding: 14px 0;
  border-top: 1px solid var(--line-2); color: var(--fg); text-decoration: none;
}
.explore-links a:last-child { border-bottom: 1px solid var(--line-2); }
.explore-links b { flex: 1 1 150px; font: 400 1.55rem var(--display); }
.explore-links span { flex: 2 1 175px; font-size: .88rem; color: var(--muted); }
.explore-links a:hover { color: var(--accent); }
.editorial-footer { background: #1b3028; color: #fbf5e9; }
.editorial-footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px 46px;
  max-width: 1340px; margin: auto; padding: clamp(22px, 4vw, 54px) clamp(16px, 3vw, 40px) 20px;
}
.editorial-footer p { color: #d8dfd4; margin: 6px 0 12px; }
.editorial-footer a { color: inherit; text-underline-offset: 4px; }
.footer-masthead { font: 400 2.6rem/1 var(--display); text-decoration: none; }
.editorial-footer nav { display: flex; flex-direction: column; gap: 9px; }
.footer-share {
  display: inline-flex; gap: 8px; align-items: center; padding: 8px 10px; color: inherit;
  background: none; border: 1px solid #91a095; border-radius: 3px;
}
.footer-colophon {
  flex: 1 0 100%; border-top: 1px solid #5a6d61; padding-top: 12px; color: #d8dfd4;
  display: flex; flex-wrap: wrap; gap: 4px 20px; justify-content: space-between; font-size: .81rem;
}
.about-wrap .prose { margin-inline: auto; }
.about-wrap h1 { font: 400 clamp(2.8rem, 7vw, 5.6rem)/.96 var(--display); }
.about-lead { font: 400 clamp(1.3rem, 3vw, 1.8rem)/1.35 var(--serif); padding-bottom: 20px; border-bottom: 1px solid var(--line-2); }
.reading-pane { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.reader-scroll { min-width: 0; }
.pinned-note {
  display: flex; flex: 0 0 auto; flex-direction: column; min-height: 0; max-height: 34vh; max-height: 34dvh;
  background: var(--sheet); border-top: 2px solid var(--accent); padding: 0 16px 10px;
}
.pinned-note-head { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pinned-note-head h2 { font: 400 1.55rem var(--display); margin: 0; }
.pinned-note-head span { color: var(--muted); font: .8rem var(--sans); }
.note-controls { display: flex; }
.pinned-note-text { overflow: auto; min-height: 0; overscroll-behavior: contain; white-space: pre-line; font: 400 1.05rem/1.45 var(--serif); }
@media (min-width: 1050px) {
  .menu-toggle { display: none; }
  .main-menu, .main-menu.is-open { order: 0; display: flex; position: static; padding: 0; background: transparent; box-shadow: none; border: 0; }
  #netChip, #hdrActions { order: 1; }
}
@media (min-width: 1100px) {
  .reading-pane { flex-direction: row; }
  .pinned-note { width: clamp(230px, 23vw, 350px); max-height: none; border-top: 0; border-left: 1px solid var(--line-2); }
  .pinned-note-text { flex: 1 1 auto; }
}
@media (min-width: 760px) and (max-width: 1099px) {
  #hdrActions .hide-desktop { display: inline-flex !important; }
}
@media (max-width: 579px) {
  .app-header { gap: 3px; }
  .brand { gap: 6px; padding-inline: 3px; }
  .brand .i { width: 18px; height: 18px; }
  .brand b { font-size: 1.35rem; }
  .menu-toggle { padding-inline: 6px; }
  .chip-status { position: absolute; top: 100%; right: 8px; }
  .cover { display: block; }
  .explore-links a { position: relative; padding-right: 30px; }
  .explore-links svg { position: absolute; right: 0; top: 14px; }
}
@media (prefers-reduced-motion: no-preference) {
  .main-menu.is-open, .pinned-note:not([hidden]) { animation: lv-enter .2s ease-out both; }
}

:root, [data-theme="ivoire"] {
  --bg: #f4f6f3; --paper: #fff; --card: #fff; --sheet: #fff;
  --fg: #152523; --muted: #495955; --line: #dce4de; --line-2: #bacbc1;
  --green: #00634d; --green-2: #00745c; --marker: #8b490b; --soft: #e6f1eb;
}
:root {
  --masthead: #003b33; --masthead-ink: #f6fffb; --signal: #f0b94b;
  --blue: #236599; --purple: #74436f;
}
.app-header {
  background: var(--masthead); color: var(--masthead-ink); border: 0;
  box-shadow: inset 0 -3px #137a63; min-height: 68px;
}
.app-header .brand, .app-header .brand .i, .app-header .icon-btn, .app-header .menu-toggle { color: inherit; }
.app-header .brand b { font-size: clamp(1.15rem, 2.2vw, 1.55rem); font-weight: 700; letter-spacing: -.055em; }
.app-header .hdr-title .k { color: var(--signal); }
.app-header .hdr-title .t { color: #d5ebe1; }
.app-header :is(.icon-btn, .menu-toggle):hover { background: #175449; }
.app-header :focus-visible { outline-color: var(--signal); }
.app-header .menu-toggle { border-color: #79a395; border-radius: 4px; }
.edition-button { font-size: .84rem; }
.global-search { display: none; }
@media (min-width: 1200px) {
  .app-header:not(.has-title) .global-search {
    position: relative; display: flex; flex: 0 1 clamp(190px, 24vw, 350px); min-width: 0; margin-inline: 4px 14px;
  }
  .app-header:not(.has-title) .hdr-title { order: 1; }
  .app-header:not(.has-title) #hdrActions a[href="#/recherche"] { display: none; }
  .global-search input { width: 100%; min-width: 0; color: #152523; background: white; border: 0; border-radius: 4px; padding: 10px 39px 10px 12px; }
  .global-search button { position: absolute; right: 0; height: 100%; display: grid; place-items: center; width: 39px; background: transparent; color: #003b33; border: 0; }
}
@media (min-width: 1050px) {
  .main-menu a, .main-menu button { color: var(--masthead-ink); padding-inline: 9px; border-radius: 4px; }
  .main-menu :is(a, button):hover, .main-menu [aria-current="page"] { background: #175449; color: #fff; }
}
.home-wrap { max-width: 1240px; gap: clamp(20px, 3.5vw, 46px); }
.home-edition {
  display: flex; flex-direction: row-reverse; align-items: center; gap: clamp(24px, 5vw, 76px);
  border-top: 5px solid var(--accent); background: var(--paper);
  padding: clamp(18px, 4vw, 48px); min-width: 0;
}
.edition-copy { flex: 2 1 0; min-width: 0; }
.edition-label { font-weight: 700; font-size: .78rem; color: var(--accent); }
.edition-copy h1 {
  font-size: clamp(1.8rem, 4.7vw, 3.85rem); line-height: 1.06; letter-spacing: -.045em;
  margin: .29em 0 .35em; overflow-wrap: anywhere;
}
.edition-copy p { max-width: 47ch; color: var(--muted); }
.edition-copy .cover-byline { color: var(--fg); font-weight: 700; }
.edition-actions, .edition-meta { display: flex; flex-wrap: wrap; gap: 9px 14px; }
.edition-actions { margin: 22px 0 16px; }
.edition-meta { align-items: center; color: var(--muted); font-size: .79rem; }
.edition-meta > :last-child { display: inline-flex; align-items: center; gap: 5px; }
.edition-meta .i { width: 15px; height: 15px; color: var(--accent); }
.edition-cover {
  flex: 1 1 0; width: 100%; max-width: 245px; min-width: 128px; aspect-ratio: 1 / 1.414;
  margin: 0; padding: 0; background: var(--bg); border: 1px solid var(--line);
}
.edition-cover img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cover-placeholder { height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 9px; color: var(--muted); font-size: .8rem; }
.cover-placeholder .i { width: 28px; height: 28px; }
.home-tools { display: flex; flex-wrap: wrap; gap: 10px; }
.home-tools button {
  flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px;
  text-align: start; position: relative; padding: 14px 40px 14px 14px;
  color: var(--fg); background: var(--paper); border: 1px solid var(--line); border-inline-start: 4px solid var(--blue);
}
.home-tools button:nth-child(2) { border-inline-start-color: var(--accent); }
.home-tools button:nth-child(3) { border-inline-start-color: var(--purple); }
.home-tools span { color: var(--muted); font-size: .78rem; }
.home-tools .i { width: 17px; height: 17px; position: absolute; top: 16px; right: 13px; }
.home-columns { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.contents-panel { flex: 2 1 380px; min-width: 0; }
.contents-rows { margin-top: 14px; border-top: 2px solid var(--accent); }
.contents-rows a {
  display: flex; gap: 8px; align-items: baseline; padding: 11px 7px;
  border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--fg);
}
.contents-rows .num { flex: 0 0 34px; font-weight: 700; color: var(--accent); }
.contents-rows .t { flex: 1; }
.contents-rows .p { font-size: .76rem; white-space: nowrap; color: var(--muted); }
.home-quote { flex: 1 1 250px; border-radius: 0; border-top: 4px solid var(--signal); padding: 19px; background: var(--soft); }
.home-quote blockquote { font-size: 1.05rem; font-style: normal; }
.home-wrap .btn { border-radius: 4px; }
.editorial-footer { background: var(--masthead); border-top: 4px solid var(--signal); }
.footer-masthead { font-size: 1.6rem; font-weight: 700; }
.about-wrap h1, .ch-head h1 { font-weight: 700; letter-spacing: -.04em; }
.article { line-height: 1.7; }
::highlight(lv-saved) { background: #ffd779; color: #242112; }
.app-tabs { flex-direction: row; align-items: center; gap: clamp(8px, 2vw, 24px); }
.app-tabs .progress { order: 0; flex: 1 1 auto; min-width: 0; }
.page-step {
  flex: none; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px;
  color: var(--accent); text-decoration: none; font-size: .82rem;
}
.page-step[hidden] { visibility: hidden; display: block; }
@media (max-width: 580px) {
  .home-edition { flex-direction: column; align-items: stretch; }
  .edition-cover { flex: auto; width: min(56vw, 195px); align-self: start; }
  .edition-copy h1 { font-size: clamp(1.7rem, 7.8vw, 2.65rem); }
  .page-step span { display: none; }
  .page-step { font-size: 1.18rem; padding: 1px 9px; }
  .app-tabs .progress .row { gap: 6px; font-size: .69rem; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .home-tools button, .contents-rows a, .page-step { transition: background-color .17s ease, border-color .17s ease; }
  .home-tools button:hover, .contents-rows a:hover, .page-step:hover { background: var(--soft); }
}

.app-header { min-height: 51px; }
.app-tabs {
  position: relative; z-index: 10; display: flex; flex-direction: column; align-items: stretch; gap: 0;
  background: var(--paper); padding-inline: 0; box-shadow: 0 -4px 20px var(--shadow);
}
.reader-controls {
  display: flex; align-items: center; gap: clamp(8px, 2vw, 24px);
  padding-inline: clamp(10px, 3vw, 44px); border-bottom: 1px solid var(--line);
}
.reader-controls[hidden], .more-menu[hidden], .notebook-entry[hidden] { display: none; }
.reader-controls .progress { padding: 4px 0; gap: 3px; }
.reader-controls .page-step { font-size: .74rem; padding: 2px 6px; }
.bottom-nav {
  display: flex; justify-content: center; gap: clamp(2px, 1vw, 12px);
  padding: 3px clamp(5px, 2vw, 22px);
}
.dock-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; min-height: 43px; flex: 1 1 0; max-width: 100px; padding: 4px 2px;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font: 600 .625rem/1.2 var(--sans); text-decoration: none; letter-spacing: .01em;
}
.dock-item .i { width: 19px; height: 19px; }
.dock-item[aria-current="page"], .dock-more[aria-expanded="true"] { background: var(--soft); color: var(--accent); }
.dock-item:hover { color: var(--accent); background: var(--soft); }
.bottom-nav:has(#moreMenu [aria-current="page"]:not(.compact-dock)) .dock-more { color: var(--accent); }
.wide-dock { display: none; }
.more-menu {
  position: absolute; right: max(8px, calc((100% - 920px) / 2)); bottom: calc(100% + 6px);
  width: min(360px, calc(100vw - 16px)); max-height: min(60dvh, 416px); overflow: auto;
  display: flex; flex-wrap: wrap; padding: 7px; gap: 3px;
  border: 1px solid var(--line-2); border-top: 3px solid var(--accent); border-radius: 10px;
  background: var(--sheet); box-shadow: 0 8px 30px var(--shadow);
}
.more-menu .dock-item {
  flex: 1 0 44%; max-width: none; flex-direction: row; justify-content: flex-start;
  gap: 8px; padding-inline: 9px; font-size: .76rem;
}
@media (min-width: 760px) {
  .bottom-nav .wide-dock { display: flex; }
  .more-menu .compact-dock { display: none; }
  .bottom-nav > .dock-item { font-size: .7rem; }
}
.pinned-note {
  max-height: 38dvh; padding: 0; border-color: var(--line-2); background: var(--sheet);
}
.pinned-note-head, .note-actions { padding: 6px clamp(13px, 2vw, 21px); }
.pinned-note-head { background: var(--soft); border-bottom: 1px solid var(--line); }
.pinned-note-head h2 { font: 700 1rem/1.3 var(--sans); }
.pinned-note-head span { display: block; margin-bottom: 1px; font-size: .67rem; }
.pinned-note-head .icon-btn { width: 34px; height: 34px; }
.pinned-note-text {
  padding: 11px clamp(13px, 2vw, 21px);
  font: 400 .9rem/1.55 var(--sans); overflow-wrap: anywhere;
}
.note-actions {
  flex: none; display: flex; justify-content: flex-end; gap: 7px; border-top: 1px solid var(--line);
}
.note-actions .btn { min-height: 32px; font-size: .73rem; }
.note-actions .i { width: 15px; height: 15px; }
@media (min-width: 1100px) {
  .pinned-note { max-height: none; width: clamp(250px, 24vw, 370px); }
}
.sheet-back.sheet-back-wide { align-items: center; justify-content: center; padding: 0; }
.sheet-back-wide .sheet {
  display: flex; flex-direction: column; width: 90vw; max-width: none; height: 90vh; height: 90dvh; max-height: none;
  border-radius: 12px; padding: 0; overflow: hidden; border: 1px solid var(--line-2); border-top: 4px solid var(--accent);
}
.sheet-back-wide .grab { display: none; }
.sheet-back-wide .sh-head {
  margin: 0; padding: 8px clamp(12px, 3vw, 30px);
  background: var(--soft); border-bottom: 1px solid var(--line);
}
.sheet-back-wide .sh-head b { font-size: clamp(1.05rem, 2.5vw, 1.4rem); }
.sheet-back-wide .sh-body {
  display: flex; flex-direction: column; padding: clamp(12px, 3vw, 30px); gap: 12px;
}
.notebook-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.notebook-filters button {
  border: 1px solid var(--line-2); border-radius: 5px; background: var(--paper); color: var(--fg);
  padding: 7px 10px; font-size: .76rem;
}
.notebook-filters [aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.notebook-status { font-size: .73rem; margin: 0; }
.notebook-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(255px, 100%), 1fr)); gap: 10px; align-items: start; }
.notebook-entry {
  padding: 12px; border: 1px solid var(--line); border-inline-start: 3px solid var(--accent);
  border-radius: 5px; background: var(--paper); min-width: 0;
}
.notebook-entry[data-kind="highlight"] { border-inline-start-color: var(--signal); }
.notebook-entry[data-kind="question"], .notebook-entry[data-kind="draft"] { border-inline-start-color: var(--purple); }
.notebook-entry .kicker { font-size: .62rem; }
.notebook-entry .annotation-actions { flex-wrap: wrap; gap: 7px; font-size: .76rem; }
.notebook-entry .btn { min-height: 31px; font-size: .73rem; }
.notebook-entry .btn .i { width: 14px; height: 14px; }
.annotation-workspace { flex: 1 1 auto; min-height: 0; display: flex; gap: clamp(12px, 3vw, 32px); }
.annotation-source {
  flex: 0 1 30%; min-width: 0; overflow: auto; padding: 12px;
  border-inline-start: 3px solid var(--accent); background: var(--soft);
}
.annotation-source h2, .annotation-source > span { font: 700 .74rem var(--sans); margin: 0; }
.annotation-source .passage-preview { border: 0; padding: 0; margin: 7px 0; font: 400 .82rem/1.55 var(--sans); }
.annotation-workspace .annotation-form { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; }
.annotation-form label { font-size: .8rem; font-weight: 700; }
.annotation-workspace textarea { flex: 1 1 auto; font-size: 16px; resize: none; }
.editor-actions { flex: none; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.editor-actions > span { flex: 1 1 190px; font-size: .72rem; }
@media (max-width: 680px) {
  .annotation-workspace { flex-direction: column; }
  .annotation-source { flex: 0 0 auto; max-height: 25%; }
  .annotation-workspace .annotation-form { flex-basis: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .more-menu:not([hidden]) { animation: lv-enter .16s ease-out both; }
}

.app-header {
  min-height: 66px; gap: clamp(8px, 1.7vw, 24px);
  background: #07332d; box-shadow: inset 0 -1px #487169;
}
.app-header .brand { padding: 0; flex: none; gap: 10px; }
.brand-cover { flex: none; width: 38px; height: 38px; object-fit: contain; border: 1px solid #7e9d7f; border-radius: 4px; }
.brand-name { display: flex; flex-direction: column; gap: 2px; }
.app-header .brand .brand-name b { display: block; font: 700 clamp(1rem, 2vw, 1.3rem)/1 var(--sans); letter-spacing: -.035em; }
.brand-name small { color: #d1e8d9; font-size: .65rem; }
.app-header .hdr-title { padding-inline: 0; }
.app-header.has-title .hdr-title { border-inline-start: 1px solid #42665e; padding-inline-start: clamp(7px, 1.6vw, 21px); }
.app-header .hdr-title .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-share {
  flex: none; display: inline-flex; gap: 7px; align-items: center; justify-content: center;
  min-height: 39px; border: 1px solid #7ea397; border-radius: 5px; padding: 5px 11px;
  background: #154b40; color: #f1fff9; font: 700 .75rem var(--sans);
}
.header-share:hover { background: #236758; }
.header-share .i { width: 18px; height: 18px; }
.edition-cover.original-cover { aspect-ratio: 1; }
.search-head { padding: 0; background: var(--paper); }
.search-inner, .results { width: min(100%, 1020px); margin-inline: auto; padding-inline: clamp(12px, 4vw, 40px); }
.search-inner { display: flex; flex-direction: column; gap: 10px; padding-block: clamp(16px, 4vw, 34px) 12px; }
.search-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; }
.search-heading h1 { font: 700 clamp(1.27rem, 4vw, 2.15rem)/1.15 var(--sans); letter-spacing: -.035em; margin: 0; }
.search-heading > span { color: var(--muted); font-size: .75rem; }
.search-box {
  max-width: none; min-height: 51px; height: auto; gap: 8px; border-radius: 6px; padding: 4px 4px 4px 12px;
  border: 1px solid var(--line-2); background: var(--bg);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.search-box > .i { width: 18px; height: 18px; color: var(--accent); }
.search-box input { outline: 0; }
.search-box [data-clear] { width: 30px; height: 34px; }
.search-box [data-clear][hidden] { display: none; }
.search-submit { flex: none; min-height: 36px; border-radius: 4px; padding-inline: 9px; font-size: .78rem; }
.search-head .search-opts { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; font-size: .75rem; }
.search-head .search-opts label { display: flex; align-items: center; gap: 4px; }
.search-head .search-opts input { accent-color: var(--accent); }
.search-head .chips { margin: 0; padding: 0 0 3px; }
.search-head .chips:empty { display: none; }
.results { padding-block: 16px 40px; }
.search-start { background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--accent); padding: clamp(15px, 3vw, 30px); }
.search-start h2 { margin: 0; font: 700 1.15rem/1.3 var(--sans); overflow-wrap: anywhere; }
.search-start h3 { font: 700 .82rem var(--sans); margin: 21px 0 8px; color: var(--muted); }
.search-start p { font-size: .85rem; color: var(--muted); }
.search-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.search-suggestions a { color: var(--accent); background: var(--soft); padding: 6px 9px; border-radius: 4px; font-size: .77rem; text-decoration: none; overflow-wrap: anywhere; }
.search-suggestions a:hover { text-decoration: underline; }
.result { border-radius: 5px; border-inline-start: 3px solid var(--line-2); }
.result:hover { border-inline-start-color: var(--accent); }
@media (max-width: 690px) {
  .app-header { min-height: 57px; }
  .brand-cover { width: 29px; height: 29px; }
  .app-header .brand { gap: 6px; }
  .brand-name small, .header-share span { display: none; }
  .header-share { width: 36px; min-height: 36px; padding: 4px; }
  .app-header .hdr-title .t { font-size: .68rem; }
}

.app-header .header-share { margin-inline-start: auto; align-self: center; }
.app-header .hdr-title { flex: 0 1 auto; }
.stats-sheet .sh-body { gap: 12px; }
.stats-sheet .sh-body > p { margin: 0; }
.stat-summary { display: flex; flex-wrap: wrap; gap: 9px; margin: 0; }
.stat-summary > div { flex: 1 1 145px; padding: 12px; border: 1px solid var(--line); border-top: 3px solid var(--accent); }
.stat-summary dt, .stat-footnote { color: var(--muted); font-size: .78rem; }
.stat-summary dd { margin: 3px 0 0; font-size: 1.28rem; font-weight: 700; }
.stat-summary small { color: var(--muted); font-size: .73em; }
.stat-heading { font-size: 1rem; margin: 7px 0 0; }
.stat-week { padding: 0; margin: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.stat-week li { display: grid; grid-template-columns: 45px 1fr 70px; align-items: center; gap: 9px; font-size: .78rem; }
.stat-week li > :last-child { text-align: right; }
.stat-track { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.stat-track i { display: block; height: 100%; background: var(--accent); }

.header-share[hidden], .header-search[hidden], .dock-item[hidden] { display: none; }
.app-header.is-search .hdr-title { display: none; }
.header-search { flex: 1 1 auto; min-width: 0; max-width: 840px; margin-inline: auto; }
.header-search .search-box { min-height: 41px; }
.header-search .search-box:focus-within { border-color: #84b7a9; box-shadow: 0 0 0 1px #84b7a9; }
.header-search :is(input, [data-clear]) { color: var(--fg); }
.home-quote { position: sticky; top: 12px; align-self: start; z-index: 1; }
.nref {
  color: var(--on-accent); background: var(--accent); border: 1px solid var(--accent);
  min-width: 23px; min-height: 22px; padding-inline: 5px; border-radius: 5px; vertical-align: .2em;
}
.nref:hover, .nref.on { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 540px) {
  .app-header.is-search { flex-wrap: wrap; padding-block: 6px; gap: 5px 8px; }
  .header-search { flex: 1 0 100%; }
  .home-columns .home-quote { order: -1; top: 4px; padding: 10px 12px; }
  .home-quote blockquote { font-size: .9rem; }
}

.app-header, .app-header.is-search { display: flex; flex-flow: row nowrap; }
.header-left { display: flex; align-items: center; flex: 1 1 0; min-width: 0; gap: inherit; }
.header-left .hdr-title { order: 0; min-width: 0; }
.header-left .hdr-title:empty { display: none; }
.app-header .header-share { flex: none; margin-inline-start: 0; }
.search-history-btn { margin-inline-start: auto; font-size: .75rem; }
.history-edit-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.history-edit-row input { flex: 1 1 130px; min-width: 0; border: 1px solid var(--line-2); border-radius: 5px; padding: 7px; background: var(--paper); }
@media (max-width: 540px) {
  .app-header.is-search .header-left { flex-wrap: wrap; }
  .app-header.is-search .header-search { flex: 1 0 100%; }
}

.reader-layout > .reader-side {
  padding: 0; overflow: hidden; width: clamp(235px, 22vw, 300px); background: var(--paper);
}
.reader-side-top { flex: none; padding: 14px 15px; border-bottom: 1px solid var(--line); background: var(--soft); }
.reader-side-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.reader-side-scroll .toc { padding: 8px; }
.reader-column { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.reader-mobile-bar {
  flex: none; display: flex; justify-content: space-between; align-items: end; gap: 8px;
  padding: 6px clamp(8px, 3vw, 28px); border-bottom: 1px solid var(--line); background: var(--paper);
}
.goto { display: flex; align-items: stretch; flex-direction: column; gap: 4px; padding: 0; }
.goto label { font-size: .73rem; font-weight: 700; }
.goto-fields { display: flex; align-items: center; gap: 6px; }
.goto input {
  width: 78px; min-width: 0; height: 34px; border-radius: 5px; padding-inline: 6px;
  text-align: center; font-size: 16px;
}
.goto .btn, .reader-mobile-bar > .btn { min-height: 34px; border-radius: 5px; padding: 4px 8px; font-size: .75rem; }
.goto .i, .reader-mobile-bar > .btn .i { width: 15px; height: 15px; }
@media (min-width: 1100px) {
  .reader-mobile-bar { display: none; }
}
.contents-view { max-width: 1150px; gap: clamp(20px, 4vw, 36px); }
.contents-hero {
  display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 15px 36px;
  color: #f4fffa; background: #07332d; border-inline-start: 5px solid #f0b94b;
  padding: clamp(16px, 5vw, 36px);
}
.contents-hero p { margin: 0 0 4px; color: #cce3da; font-size: .82rem; font-weight: 600; }
.contents-hero h1 { margin: 0; line-height: 1; font-size: clamp(2.15rem, 7vw, 4.2rem); letter-spacing: -.05em; }
.contents-hero .goto label { color: #f4fffa; }
.contents-hero .goto input { background: #fff; color: #152523; }
.contents-hero .goto .btn { background: #f0b94b; color: #16231d; }
.contents-section-title { margin: 0 0 10px; font-size: 1.05rem; }
.contents-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.contents-card {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: clamp(11px, 2.4vw, 19px); color: var(--fg); background: var(--paper);
  border: 1px solid var(--line); border-top: 4px solid var(--accent); text-decoration: none;
}
.contents-card:nth-child(3n + 2) { border-top-color: var(--blue); }
.contents-card:nth-child(3n) { border-top-color: var(--purple); }
.contents-card-top, .contents-card-foot { display: flex; justify-content: space-between; gap: 5px; align-items: center; color: var(--accent); }
.contents-numeral { font-weight: 700; font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1; }
.contents-current { color: var(--fg); background: var(--soft); font-size: .66rem; padding: 3px 5px; }
.contents-card h3 { flex: 1; margin: 0; font-size: clamp(.95rem, 1.6vw, 1.18rem); line-height: 1.3; }
.contents-card-foot { border-top: 1px solid var(--line); padding-top: 8px; font-size: .74rem; }
.contents-card-foot .i { width: 17px; height: 17px; }
.contents-card:hover { background: var(--soft); }
.contents-reference { gap: 7px; }

.header-account {
  flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 39px;
  border: 1px solid #7ea397; border-radius: 5px; padding: 5px 10px; background: transparent;
  color: #f1fff9; font: 700 .75rem var(--sans);
}
.header-account[hidden], .account-form [hidden] { display: none; }
.header-account:hover { background: #236758; }
.header-account .i { width: 17px; height: 17px; }
.account-modes { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.account-modes [aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.account-form { display: flex; flex-direction: column; gap: 11px; max-width: 620px; }
.account-form label { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; font-weight: 700; }
.account-form :is(input, textarea) {
  min-width: 0; padding: 9px; border: 1px solid var(--line-2); border-radius: 5px;
  font: 400 16px var(--sans); background: var(--paper); color: var(--fg);
}
.account-form .btn { align-self: flex-start; }
.forum-wrap { max-width: 900px; }
.forum-drafts.btn.ghost { color: #f4fffa; border-color: #7ea397; }
.forum-body { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.forum-body h2 { margin: 8px 0 0; font-size: 1.15rem; }
.forum-body > p { margin: 0; }
.forum-post { border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); background: var(--paper); padding: 13px 16px; }
.forum-post .passage-preview { font-size: .95rem; }
.forum-text { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 690px) {
  .header-account { width: 36px; min-height: 36px; padding: 4px; justify-content: center; }
  .header-account span { display: none; }
}
@media (max-width: 760px) { .contents-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 360px) {
  .contents-grid { grid-template-columns: 1fr; }
  .reader-mobile-bar .btn .i { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .contents-card { transition: background-color .18s ease, transform .18s ease; }
  .contents-card:hover { transform: translateY(-2px); }
}

/* ============ Accueil personnalisé (première ouverture) — v4.12 ============ */
.welcome {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--green);
  background-image: radial-gradient(circle at 85% 10%, rgba(217,188,122,.16) 0, rgba(217,188,122,0) 45%);
  animation: fade .2s ease-out;
}
.welcome-card {
  position: relative; width: 100%; max-width: 440px; max-height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  background: var(--sheet); color: var(--fg); border-radius: 24px; padding: 32px 24px 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.welcome-cover { width: 76px; height: 76px; border-radius: 16px; object-fit: cover; box-shadow: 0 6px 16px var(--shadow); }
.welcome-close { position: absolute; top: 10px; right: 10px; }
.welcome-step { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.welcome-step[hidden] { display: none; }
.welcome h1 { font-size: 30px; color: var(--accent); }
.welcome p { margin: 0; line-height: 1.55; }
.welcome-q { font-weight: 600; margin-top: 6px !important; }
.welcome-choices { display: flex; gap: 12px; }
.welcome-choices button {
  flex: 1 1 0; min-height: 64px; border-radius: 18px; border: 1.5px solid var(--line-2);
  background: var(--card); color: var(--fg); font-size: 20px; font-weight: 700;
}
.welcome-choices button:hover, .welcome-choices button[aria-pressed="true"] { border-color: var(--accent); background: var(--soft); color: var(--accent); }
.welcome label { text-align: left; font-size: 14px; color: var(--muted); }
.welcome input {
  height: 52px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--paper);
  padding: 0 16px; font-size: 18px; color: var(--fg);
}
.welcome input:focus { outline: none; border-color: var(--accent); }
.welcome-error { color: var(--stamp); font-size: 14px; text-align: left; }
.welcome-back { align-self: center; border: 0; background: transparent; color: var(--muted); font-size: 14px; min-height: 40px; }
.welcome-note { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px !important; }
.home-greeting { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; font-size: 17px; color: var(--muted); }
.home-greeting b { color: var(--accent); }
.link-btn { border: 0; background: transparent; color: var(--muted); text-decoration: underline; font-size: 13px; min-height: 32px; padding: 0 4px; }
.profile-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.special-mention {
  margin: 18px 0; padding: 16px 18px; border-radius: 14px;
  background: var(--soft); border-left: 4px solid var(--gold);
  display: flex; flex-direction: column; gap: 6px;
}
.special-mention p { margin: 0; }
.home-quote .quote-actions { display: flex; flex-wrap: wrap; gap: 8px; }
