/* « À lire » — thème du soir (sombre chaud, peu de lumière bleue) et thème sépia (clair).
   Ni blanc pur ni noir pur ; texte principal ≥ 10:1, texte secondaire ≥ 5:1 ; une seule couleur d'accent. */

@font-face { font-family: 'Literata'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/literata-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/literata-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/literata-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/literata-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* Thème du soir (par défaut) : charbon chaud mat, ivoire doux, bronze discret */
:root {
  --bg: #191918; --surface: #232321; --surface-2: #2C2B27; --line: #3D3B34; --bar: #1D1D1B;
  --text: #DED8CC; --strong: #F0EADF; --muted: #A8A397;
  --accent: #B79A67; --accent-hover: #C9AD7B; --accent-ink: #1B1813; --accent-soft: #393022;
  --ok: #9BC795; --warn: #E2B866; --bad: #EE9584; --fr: #9DBDF0; --en: #DDA9D3;
  --shadow: 0 -12px 40px rgba(8, 6, 4, 0.5);
  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --display: 'Cormorant Garamond', 'Literata', Georgia, serif;
  --sans: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 12px; --tap: 48px;
  color-scheme: dark;
}
/* Thème sépia (clair) : suit l'appareil, ou choix explicite */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="night"]) {
    --bg: #F3EAD8; --surface: #FBF5EA; --surface-2: #EFE4CF; --line: #E0D3BA; --bar: #EFE4CF;
    --text: #3B3226; --strong: #2A2219; --muted: #6B5E4E;
    --accent: #8E5514; --accent-hover: #74440F; --accent-ink: #FFF8EC; --accent-soft: #F1DFC4;
    --ok: #2F6B4F; --warn: #845B0E; --bad: #A63A2A; --fr: #2E5E9E; --en: #8A3F7E;
    --shadow: 0 -10px 34px rgba(60, 44, 20, 0.16);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F3EAD8; --surface: #FBF5EA; --surface-2: #EFE4CF; --line: #E0D3BA; --bar: #EFE4CF;
  --text: #3B3226; --strong: #2A2219; --muted: #6B5E4E;
  --accent: #8E5514; --accent-hover: #74440F; --accent-ink: #FFF8EC; --accent-soft: #F1DFC4;
  --ok: #2F6B4F; --warn: #845B0E; --bad: #A63A2A; --fr: #2E5E9E; --en: #8A3F7E;
  --shadow: 0 -10px 34px rgba(60, 44, 20, 0.16);
  color-scheme: light;
}

/* Thème nuit : noir doux et neutre (ni bleu vif ni noir pur), pour lire dans le noir */
:root[data-theme="night"] {
  --bg: #111214; --surface: #191A1D; --surface-2: #212327; --line: #2C2E33; --bar: #141517;
  --text: #D9DBDF; --strong: #ECEDEF; --muted: #969BA3;
  --accent: #D9A86C; --accent-hover: #E6BB86; --accent-ink: #15120E; --accent-soft: #2E2720;
  --ok: #95C39A; --warn: #DDB76E; --bad: #E79486; --fr: #9DBDF0; --en: #DDA9D3;
  --shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
body.focus-mode { padding-bottom: env(safe-area-inset-bottom); }
main {
  max-width: 760px; margin: 0 auto;
  padding-block: calc(16px + env(safe-area-inset-top)) 24px;
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1 { font-family: var(--display); font-weight: 600; font-size: 2.3rem; line-height: 1.15; margin: 6px 0 4px; color: var(--strong); text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 600; font-size: 1.55rem; margin: 24px 0 10px; color: var(--strong); }
h3 { font-size: 1rem; margin: 0; color: var(--strong); }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hide { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* Boutons et champs : cibles ≥ 44 px */
button, .btn {
  min-height: var(--tap); padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; cursor: pointer;
}
button:active, .btn:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.ghost { background: transparent; }
.danger { color: var(--bad); }
.icon-btn { width: 44px; min-height: 44px; padding: 0; flex: none; }
.icon { width: 20px; height: 20px; flex: none; }
input, select, textarea {
  min-height: var(--tap); width: 100%; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 84px; }
label { display: block; font-size: .9rem; color: var(--muted); margin: 14px 0 6px; }
.field-inline { display: flex; gap: 8px; }
.field-inline input { flex: 1; min-width: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* En-tête de page (date, titre, sous-titre) */
.page-head { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin: 8px 0 14px; }
.page-head > div { min-width: 0; }
@media (min-width: 560px) { .page-head { flex-direction: row; align-items: flex-end; } .page-head > div { flex: 1; } }
.eyebrow { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sub { font-size: .95rem; color: var(--muted); }
.quick {
  flex: none; min-height: 44px; border-radius: 22px; padding: 0 14px; font-size: .9rem;
  background: var(--accent-soft); color: var(--accent); border: 0;
}

/* Puces de filtre */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 760px) { .chips { flex-wrap: wrap; overflow: visible; } }
/* Téléphone : la rangée défile ; un fondu à droite signale qu’il y a la suite */
@media (max-width: 759px) { .chips { mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; } }
.chip {
  min-height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--line);
  background: transparent; color: var(--text); font-weight: 400; white-space: nowrap; flex: none;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 700; }
.chips select { width: auto; min-height: 40px; border-radius: 20px; padding: 0 12px; flex: none; background: transparent; }

.banner { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); margin: 6px 0 12px; font-size: .92rem; }
.banner.warn { border: 1px solid var(--warn); }
.banner a { font-weight: 700; }

/* À lire : cartes */
.cards { display: grid; gap: 10px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 12px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; }
.cover {
  width: 64px; aspect-ratio: 64 / 90; border-radius: 10px; object-fit: cover; background: var(--surface-2);
  display: block; max-width: 100%;
}
.cover.ph { display: flex; align-items: flex-end; padding: 6px; font-family: var(--serif); font-weight: 600; font-size: 1.1rem; color: var(--strong); }
.card .body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.card .head { display: flex; gap: 8px; align-items: flex-start; }
.card .title {
  flex: 1; min-width: 0; font-family: var(--serif); font-weight: 500; font-size: 1.07rem; line-height: 1.25;
  color: var(--strong); text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { font-size: .875rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.count {
  flex: none; min-width: 28px; height: 24px; padding: 0 8px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .875rem;
  display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
.lang { font-size: .7rem; font-weight: 700; letter-spacing: .05em; padding: 1px 6px; border-radius: 6px; border: 1px solid currentColor; }
.lang.fr { color: var(--fr); } .lang.en { color: var(--en); }
.actions { display: flex; gap: 8px; margin-top: 6px; }
.actions .read { flex: 1; min-width: 0; min-height: 44px; }
.actions .read span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { font-size: .82rem; color: var(--muted); }
.note.warn { color: var(--warn); }
.note.bad { color: var(--bad); }
.fav { color: var(--accent); }

/* Bibliothèque : grille de couvertures */
.seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border-radius: 14px; padding: 4px; margin: 4px 0 12px; }
.seg button { min-height: 40px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 400; padding: 0 6px; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--strong); font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 12px; }
.tile { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.tile .art { position: relative; }
.tile .cover { width: 100%; border-radius: 12px; aspect-ratio: 3 / 4.2; }
.tile .cover.ph { font-size: 1.3rem; padding: 8px; }
.tile .badge {
  position: absolute; top: 6px; right: 6px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
}
.tile .lang-tag {
  position: absolute; top: 6px; left: 6px; font-size: .65rem; font-weight: 700; letter-spacing: .06em;
  padding: 2px 5px; border-radius: 5px; background: var(--bg); color: var(--text);
}
.tile .t { font-size: .85rem; line-height: 1.3; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .st { font-size: .75rem; color: var(--muted); }

/* Fiche de série en feuille (bibliothèque) */
.ss-head { display: flex; gap: 14px; align-items: center; }
.ss-head .cover { width: 56px; }
.ss-head h2 { margin: 0; }
.progress { margin-top: 8px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.ss-actions { display: flex; gap: 10px; margin: 16px 0 6px; }
.ss-actions .primary { flex: 1; min-height: 52px; font-size: 1.02rem; }
.ss-src { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.ss-src span:last-child { color: var(--muted); text-align: right; }

/* Fiche série (page) */
.hero { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: start; }
.hero .cover { width: 112px; }
.alt { font-size: .85rem; color: var(--muted); }
.panel { background: var(--surface); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.src { border-top: 1px solid var(--line); padding: 12px 0; }
.src:first-of-type { border-top: 0; padding-top: 0; }
.state { font-size: .82rem; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state.ok { color: var(--ok); } .state.new { color: var(--accent); } .state.error { color: var(--bad); }
.state.manual, .state.pending { color: var(--muted); }
.chap-list { list-style: none; padding: 0; margin: 8px 0 0; max-height: 360px; overflow: auto; }
.chap-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.chap-list li a { flex: 1; min-width: 0; text-decoration: none; min-height: 40px; display: flex; align-items: center; }
.chap-list li.read a { color: var(--muted); }
.chap-list .new { font-size: .7rem; font-weight: 700; color: var(--accent); }
details summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-weight: 700; }

/* Ajout */
.preview { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
.preview .cover { width: 96px; }

/* Lecture rapide : une série à la fois */
.focus { min-height: calc(100dvh - 40px); display: flex; flex-direction: column; gap: 16px; max-width: 520px; margin: 0 auto; }
.focus-top { display: flex; align-items: center; gap: 12px; }
.focus-top .pos { flex: 1; text-align: center; font-size: .9rem; color: var(--muted); }
.focus-top .pos strong { color: var(--strong); }
.focus-top .icon-btn, .focus-top .chip { border-radius: 22px; background: var(--surface); border-color: transparent; }
.dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--line); }
.dots span.on { width: 22px; background: var(--accent); }
.focus-card { flex: 1; background: var(--surface); border-radius: 28px; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.focus-art { position: relative; flex: 1; min-height: 220px; max-height: 46dvh; border-radius: 18px; overflow: hidden; background: var(--surface-2); display: flex; }
.focus-art .cover { flex: 1; width: 100%; height: auto; aspect-ratio: auto; border-radius: 0; }
.focus-art .cover.ph { font-size: 3rem; padding: 18px; }
.focus-art .pill { position: absolute; top: 12px; padding: 5px 10px; border-radius: 10px; font-size: .78rem; font-weight: 700; }
.focus-art .pill.src { left: 12px; background: var(--bg); color: var(--text); border: 0; }
.focus-art .pill.cnt { right: 12px; background: var(--accent); color: var(--accent-ink); }
.focus-card h1 { font-size: 1.75rem; margin: 0; }
.focus-card .big-read { min-height: 58px; border-radius: 18px; font-size: 1.08rem; }
.focus-card .two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.focus-card .two button { min-height: 50px; border-radius: 16px; background: transparent; }
.next-up .lbl { font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.next-up .row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.next-up button { all: unset; cursor: pointer; min-width: 0; padding: 10px 12px; border-radius: 14px; background: var(--surface); color: var(--text); }
.next-up button:focus-visible { outline: 2px solid var(--accent); }
.next-up .n1 { font-size: .82rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-up .n2 { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Réglages / diagnostic */
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; }
.scroll-x { overflow-x: auto; }

/* Barre d'onglets */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--bar); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.tabs a { min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: .75rem; }
.tabs a .icon { width: 22px; height: 22px; }
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 700; }
body.focus-mode .tabs { display: none; }
.tabs .nav-brand, .nav-peek { display: none; }

/* Téléphone (< 900 px) : barre du bas à 4 onglets (À lire, Bibliothèque, Ajouter, Réglages). */
.nav-bottom { display: contents; }
.nav-bottom .profile { display: none; }

/* Ordinateur (≥ 900 px) : barre latérale de 230 px — marque, navigation, profil et Réglages en bas.
   En lecture (Lecture rapide, liseuse), elle se cache et réapparaît quand la souris passe sur le bord gauche. */
@media (min-width: 900px) {
  body { padding: 0 0 0 230px; }
  body.reader-mode, body.focus-mode, body.login-mode { padding-left: 0; }
  main { max-width: 1320px; padding: 34px clamp(24px, 3vw, 50px) 48px; }
  body.page-narrow main { max-width: 820px; }
  .tabs {
    top: 0; bottom: 0; left: 0; right: auto; width: 230px; height: 100%;
    display: flex; flex-direction: column; gap: 6px; padding: 26px 12px 20px;
    border-top: 0; border-right: 1px solid var(--line); background: var(--bar);
    transition: transform .22s ease, box-shadow .22s ease; z-index: 40; overflow-y: auto;
  }
  .tabs .nav-brand { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-decoration: none; margin: 0 0 22px; gap: 2px; min-height: 0; }
  .nav-brand img { width: 104px; height: 104px; object-fit: contain; margin-bottom: 4px; -webkit-mask-image: radial-gradient(ellipse 62% 60% at 50% 42%, #000 62%, transparent 100%); mask-image: radial-gradient(ellipse 62% 60% at 50% 42%, #000 62%, transparent 100%); }
  .nb-name { font: 600 1.42rem/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--strong); }
  .nb-tag { font-size: .84rem; color: var(--muted); }
  .tabs a[data-tab] {
    min-height: 56px; flex-direction: row; justify-content: flex-start; gap: 16px; padding: 0 18px;
    border-radius: 10px; border: 1px solid transparent; font-size: 1.02rem; color: var(--text);
  }
  .tabs a[data-tab] .icon { width: 25px; height: 25px; color: var(--muted); }
  .tabs a[data-tab]:hover { background: var(--surface); }
  .tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--strong); font-weight: 700; border-color: color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
  .tabs a[aria-current="page"] .icon { color: var(--accent); }
  .nav-bottom { display: block; margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; }
  .nav-bottom .profile { display: block; position: relative; margin-bottom: 6px; }
  .profile-btn { width: 100%; min-height: 72px; justify-content: flex-start; gap: 14px; padding: 6px 10px; background: transparent; border-color: transparent; font-weight: 400; color: var(--text); }
  .profile-btn:hover { background: var(--surface); }
  .profile-btn img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; object-position: center 20%; background: #2A2620; box-shadow: 0 0 0 1px var(--accent), 0 0 0 3px var(--bar), 0 0 0 4px var(--line); }
  .profile-btn .pname { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile-btn .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; }
  .profile-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
  .profile-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.4); display: grid; gap: 2px; }
  .profile-menu a, .profile-menu button { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; border: 0; background: transparent; color: var(--text); text-decoration: none; font-weight: 400; justify-content: flex-start; }
  .profile-menu a:hover, .profile-menu button:hover, .profile-menu :focus-visible { background: var(--surface-2); }
  .toast { bottom: 24px; left: calc(50% + 115px); }
  body.focus-mode .tabs, body.reader-mode .tabs { display: flex !important; transform: translateX(-100%); box-shadow: none; }
  body.focus-mode .nav-peek, body.reader-mode .nav-peek { display: block; position: fixed; inset: 0 auto 0 0; width: 14px; z-index: 39; }
  body.focus-mode .nav-peek:hover ~ .tabs, body.reader-mode .nav-peek:hover ~ .tabs,
  body.focus-mode .tabs:hover, body.reader-mode .tabs:hover,
  body.focus-mode .tabs:focus-within, body.reader-mode .tabs:focus-within { transform: none; box-shadow: 20px 0 50px rgba(0,0,0,.45); }
  body.focus-mode .toast, body.reader-mode .toast { left: 50%; }
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom));
  background: var(--strong); color: var(--bg); border-radius: 12px; padding: 10px 10px 10px 16px; z-index: 20;
  display: flex; gap: 12px; align-items: center; width: max-content; max-width: min(560px, calc(100vw - 32px));
}
body.focus-mode .toast { bottom: calc(20px + env(safe-area-inset-bottom)); }
.toast button { min-height: 40px; background: transparent; color: var(--bg); border: 0; text-decoration: underline; }

.sheet { border: 0; border-radius: 26px 26px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); width: 100%; max-width: 560px;
  margin: auto auto 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); max-height: 88dvh; }
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.sheet::backdrop { background: rgba(10, 8, 6, .55); }
@media (min-width: 700px) { .sheet { border-radius: 22px; margin: auto; } }

.empty { text-align: center; padding: 48px 12px; color: var(--muted); }
.empty .big { font-family: var(--serif); font-size: 1.25rem; color: var(--strong); font-weight: 600; margin-bottom: 6px; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

@media (min-width: 700px) {
  .card { grid-template-columns: 76px minmax(0, 1fr); }
  .card .cover { width: 76px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- En-têtes : outils (thème, lecture rapide) ---------- */
.page-head { position: relative; }
.page-head > div:first-child { padding-right: 56px; }
.theme-btn { position: absolute; top: 0; right: 0; }

/* ---------- Ajout express / vrac ---------- */
.quick-add { display: flex; gap: 8px; align-items: stretch; margin: 12px 0 6px; }
.quick-add input { flex: 1; min-width: 0; }
.quick-add .icon-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.express { margin-bottom: 20px; }
.vrac-help { margin: 0 0 12px; }

/* ---------- Liseuse ---------- */
body.reader-mode { padding-bottom: 0; background: #0B0B0C; }
@media (max-width: 899px) { body.reader-mode #tabs { display: none; } }
body.reader-mode main { max-width: none; padding: 0; }
.reader { min-height: 100vh; background: #0B0B0C; color: #D9DBDF; }
.r-loading, .r-msg { padding: 96px 20px 40px; text-align: center; max-width: 520px; margin: 0 auto; }
.r-msg .big { font-family: var(--serif); font-size: 1.4rem; color: #ECEDEF; margin-bottom: 8px; }
.r-bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(6px + env(safe-area-inset-top)) 8px 6px; background: rgba(17, 18, 20, .92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid #23252A;
  transition: transform .25s ease;
}
.r-bar.r-off { transform: translateY(-110%); }
.r-bar .icon-btn { color: #D9DBDF; background: transparent; border-color: transparent; font-weight: 700; }
.r-title { flex: 1; min-width: 0; }
.r-title .n1 { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ECEDEF; }
.r-title .n2 { font-size: .8rem; color: #969BA3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 21; pointer-events: none; }
.r-progress span { display: block; height: 100%; width: 0; background: var(--accent); opacity: .8; }
.r-settings {
  position: fixed; top: calc(62px + env(safe-area-inset-top)); right: 8px; z-index: 22; width: min(320px, calc(100vw - 16px));
  background: #191A1D; border: 1px solid #2C2E33; border-radius: 14px; padding: 14px; display: grid; gap: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.r-settings label { display: grid; gap: 4px; color: #D9DBDF; font-size: .9rem; margin: 0; }
.r-settings input[type=range] { width: 100%; accent-color: var(--accent); min-height: 32px; padding: 0; border: 0; background: none; }
.r-pages { padding-top: calc(56px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; }
.r-pages img { display: block; width: 100%; height: auto; min-height: 120px; background: #141517; }
.fit-width .r-pages img { max-width: 800px; }
.fit-narrow .r-pages img { max-width: 560px; }
.r-pages img[src] { min-height: 0; }
.r-end { max-width: 560px; margin: 0 auto; padding: 32px 16px calc(40px + env(safe-area-inset-bottom)); text-align: center; }
.r-end-title { font-family: var(--serif); font-size: 1.25rem; color: #ECEDEF; margin-bottom: 14px; }
.r-end-actions { display: grid; gap: 10px; }
.r-end-actions .btn, .r-end-actions button { width: 100%; }
.r-end .ghost, .r-msg .ghost { color: #D9DBDF; border-color: #2C2E33; background: #191A1D; }
.r-prev { margin-top: 18px; }
.r-credit { margin-top: 18px; color: #7E838B; }
.r-filter { position: fixed; inset: 0; pointer-events: none; z-index: 15; mix-blend-mode: multiply; }

/* ---------- Écran de connexion « Turtle Toon » : carte art déco noir et or ----------
   Fond : public/connexion*.webp (le personnage reste visible à gauche) ; la carte se place à sa droite.
   Palette propre, indépendante du thème. */
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/cormorant-garamond-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/cormorant-garamond-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url(/fonts/cormorant-garamond-latin-500-italic.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url(/fonts/cormorant-garamond-latin-ext-500-italic.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

body.login-mode { padding: 0 !important; background: #0E0C0A; }
body.login-mode main { max-width: none; padding: 0; min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; }
.login-bg {
  position: fixed; inset: 0; z-index: 0;
  /* Image HD : 2560 px par défaut (téléphones, écrans ≤ 1920 px), 4K pour les grands écrans et les écrans haute densité.
     L'aperçu flou (1000 px) s'affiche immédiatement pendant le chargement. */
  background: url(/connexion-2k.webp) 22% center / cover no-repeat, #14110E url(/connexion-1000.webp) 22% center / cover no-repeat;
  animation: login-fade .7s ease both;
}
@media (min-width: 900px) and (min-resolution: 1.5dppx), (min-width: 2000px) {
  .login-bg { background-image: url(/connexion-4k.webp), url(/connexion-1000.webp); }
}
.login-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 8, 6, .1), rgba(10, 8, 6, .55)); }

.login {
  --gold: #D6B36A; --gold-2: #F0D9A2; --gold-3: #9C7A3C; --gold-line: rgba(214, 179, 106, .55);
  --ink: #141210; --ink-2: #1B1815; --txt: #EDE3CF; --muted: #B4A68C;
  --cut: 26px;
  position: relative; z-index: 1; color: var(--txt);
  width: min(460px, calc(100vw - 28px)); margin: 46px auto 24px;
  padding: 104px clamp(26px, 6vw, 48px) 30px;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, .65));
  animation: login-rise .6s .1s ease both;
  isolation: isolate; container-type: inline-size;
}
.login h1 .l1 { white-space: nowrap; }
/* Cadre : or (extérieur) → noir → filet d'or → noir (intérieur), coins coupés */
.login .frame { position: absolute; z-index: -1; pointer-events: none;
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c)); }
.login .f1 { inset: 0; --c: var(--cut); background: linear-gradient(160deg, var(--gold-2), var(--gold) 30%, var(--gold-3) 60%, var(--gold) 85%, var(--gold-2)); }
.login .f2 { inset: 2px; --c: calc(var(--cut) - 1px); background: var(--ink); }
.login .f3 { inset: 9px; --c: calc(var(--cut) - 4px); background: var(--gold-line); }
.login .f4 { inset: 10px; --c: calc(var(--cut) - 4.5px);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(214, 179, 106, .10), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(214, 179, 106, .06), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 4px),
    var(--ink-2); }
/* Ornements : losanges sur les côtés, coins */
.login .orn { position: absolute; z-index: 0; width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); box-shadow: 0 0 0 3px var(--ink), 0 0 0 4px var(--gold-line); }
.login .orn.l { left: 5px; top: 46%; } .login .orn.r { right: 5px; top: 46%; }
.login .orn.l2 { left: 5px; top: 78%; } .login .orn.r2 { right: 5px; top: 78%; }
.login .corner { position: absolute; z-index: 0; width: 34px; height: 34px; color: var(--gold); opacity: .9; }
.login .corner.tl { left: 14px; top: 14px; } .login .corner.tr { right: 14px; top: 14px; transform: scaleX(-1); }
.login .corner.bl { left: 14px; bottom: 14px; transform: scaleY(-1); } .login .corner.br { right: 14px; bottom: 14px; transform: scale(-1); }
/* Médaillon : lune au sommet, éventail art déco, avatar cerclé d'or */
.login .crest { position: absolute; left: 50%; top: -38px; transform: translateX(-50%); width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #2A241C, var(--ink)); box-shadow: 0 0 0 2px var(--gold), 0 0 0 6px var(--ink), 0 0 0 7px var(--gold-line);
  display: grid; place-items: center; color: var(--gold-2); }
.login .crest svg { width: 30px; height: 30px; }
.login .medal { position: absolute; left: 50%; top: 34px; transform: translateX(-50%); width: 300px; height: 210px; pointer-events: none; z-index: 0; }
.login .fan { position: absolute; inset: 0; color: var(--gold); opacity: .45; }
.login .avatar {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%); width: 168px; height: 168px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--ink); box-shadow: 0 0 0 2px var(--gold), 0 0 0 7px var(--ink), 0 0 0 8px var(--gold-line), 0 14px 30px rgba(0, 0, 0, .6);
  background: #221C15;
}
.login .lbrand { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 136px 0 8px; color: var(--gold);
  font: 600 .86rem/1 'Cormorant Garamond', var(--serif); letter-spacing: .38em; text-transform: uppercase; }
.login .lbrand::before, .login .lbrand::after { content: ''; width: 46px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.login .lbrand::after { transform: scaleX(-1); }
.login h1 { margin: 6px 0 0; text-align: center; color: #F5ECDA; font: 600 min(2.95rem, 10.4cqi)/1.02 'Cormorant Garamond', var(--serif); letter-spacing: -.005em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
.login h1 em { display: block; font-style: italic; font-weight: 500; color: var(--gold); margin-top: 4px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 60%, var(--gold-3)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.login .sep { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px auto 18px; width: 70%; color: var(--gold); }
.login .sep::before, .login .sep::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.login .sep::after { transform: scaleX(-1); }
.login .sep i { width: 8px; height: 8px; background: var(--gold); transform: rotate(45deg); box-shadow: 0 0 0 3px var(--ink-2), 0 0 0 4px var(--gold-line); }
.login label { display: block; margin: 14px 0 7px; color: #EFE6D3; font: 600 1.12rem 'Cormorant Garamond', var(--serif); letter-spacing: .01em; }
.login .field { position: relative; display: flex; align-items: center; }
.login .field > svg { position: absolute; left: 16px; width: 20px; height: 20px; color: var(--gold); pointer-events: none; }
.login .field input {
  width: 100%; min-height: 54px; padding: 0 52px 0 50px; border-radius: 8px;
  background: linear-gradient(180deg, #100E0C, #16130F); border: 1px solid rgba(214, 179, 106, .45); color: var(--txt);
  font: 1.02rem var(--sans); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5);
}
.login .field input::placeholder { color: #7E735F; font-family: 'Cormorant Garamond', var(--serif); font-size: 1.08rem; }
.login .field input:focus { outline: none; border-color: var(--gold-2); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5), 0 0 0 3px rgba(214, 179, 106, .2); }
.login .eye { position: absolute; right: 4px; min-height: 44px; width: 46px; padding: 0; background: transparent; border: 0; color: var(--gold); }
.login .eye:hover { color: var(--gold-2); }
.login .eye svg { width: 23px; height: 23px; }
.login .under { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.login .remember { display: inline-flex; gap: 10px; align-items: center; margin: 0; font: 600 1.02rem 'Cormorant Garamond', var(--serif); color: #E4D9C2; }
.login .remember input { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; min-height: 0; margin: 0; padding: 0; border: 1px solid var(--gold); border-radius: 3px; background: #100E0C; display: grid; place-items: center; cursor: pointer; }
.login .remember input:checked::after { content: ''; width: 11px; height: 6px; border: 2px solid var(--gold-2); border-top: 0; border-right: 0; transform: translateY(-2px) rotate(-45deg); }
.login .remember input:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.login .forgot { background: none; border: 0; border-bottom: 1px solid var(--gold-line); border-radius: 0; min-height: 30px; padding: 0; color: var(--gold); font: 500 italic 1.02rem 'Cormorant Garamond', var(--serif); }
.login .forgot:hover { color: var(--gold-2); border-color: var(--gold-2); }
.login .forgot-help { font-size: .88rem; color: #D8CDB6; background: #100E0C; border: 1px solid rgba(214, 179, 106, .3); border-radius: 8px; padding: 10px 12px; margin: 12px 0 0; }
.login .forgot-help code { color: var(--gold-2); }
.login .err { min-height: 1.3em; margin: 10px 0 0; color: #F0A48E; font-size: .92rem; text-align: center; }
.login .go {
  --g: 14px;
  width: calc(100% + 16px); margin: 8px -8px 0; min-height: 64px; border: 0; border-radius: 0; position: relative;
  clip-path: polygon(var(--g) 0, calc(100% - var(--g)) 0, 100% var(--g), 100% calc(100% - var(--g)), calc(100% - var(--g)) 100%, var(--g) 100%, 0 calc(100% - var(--g)), 0 var(--g));
  background: linear-gradient(180deg, #F3E1B4, #D9B873 45%, #B8924F 100%); color: #1A140C;
  font: 600 1.55rem/1 'Cormorant Garamond', var(--serif); letter-spacing: .01em; gap: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 245, 215, .6);
  text-shadow: 0 1px 0 rgba(255, 245, 220, .5);
}
.login .go::before { content: ''; position: absolute; inset: 4px; pointer-events: none; border: 1px solid rgba(90, 64, 26, .45);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px); }
.login .go:hover { filter: brightness(1.06); }
.login .go:disabled { filter: grayscale(.4) brightness(.8); }
.login .go svg { width: 24px; height: 24px; transition: transform .2s; }
.login .go:hover svg { transform: translateX(4px); }
.login .foot { margin: 22px 0 0; text-align: center; color: var(--gold); }
.login .foot svg { width: 30px; height: 22px; display: block; margin: 0 auto 6px; }
.login .motto { display: flex; align-items: center; justify-content: center; gap: 10px; color: #D8CCB3; font: 500 italic 1.06rem 'Cormorant Garamond', var(--serif); letter-spacing: .03em; margin: 0; }
.login .motto::before, .login .motto::after { content: '◆'; color: var(--gold); font-size: .5rem; font-style: normal; }
@media (min-width: 900px) {
  .login-bg { background-position: 30% center; }
  .login-bg::after { background: linear-gradient(90deg, rgba(10, 8, 6, 0) 45%, rgba(10, 8, 6, .35) 100%); }
  /* À droite du personnage du fond, sans coller au bord */
  .login { margin: 56px max(4vw, calc(25vw - 230px)) 24px auto; }
}

@keyframes login-fade { from { opacity: 0; } }
@keyframes login-rise { from { opacity: 0; translate: 0 16px; } }
@media (prefers-reduced-motion: reduce) { .login-bg, .login { animation: none; } }


/* ===================== Accueil « À lire » (maquette Turtle Toon) ===================== */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px 28px; flex-wrap: wrap; margin-bottom: 30px; }
.hero-text { min-width: 0; flex: 1 1 420px; }
.hero .eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .82rem; color: var(--muted); }
h1.display { font-size: clamp(2.3rem, 4.6vw, 3.9rem); line-height: 1.02; margin: 6px 0 6px; letter-spacing: -.005em; }
.hero .lead { font-family: var(--display); font-size: clamp(1.15rem, 1.8vw, 1.55rem); color: var(--muted); margin: 0; letter-spacing: .01em; }
.hero .stat { margin: 12px 0 0; color: var(--muted); font-size: .95rem; }
.hero .stat strong { color: var(--text); }
.hero-tools { display: flex; gap: 12px; align-items: center; flex: 0 1 430px; justify-content: flex-end; }
.hero .theme-btn { position: static; flex: none; width: 52px; height: 52px; min-height: 52px; border-radius: 10px; background: var(--surface); border-color: var(--line); color: var(--accent); }
.search { position: relative; flex: 1; min-width: 0; }
.search .s-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 21px; height: 21px; color: var(--muted); pointer-events: none; }
.search .s-icon svg { width: 100%; height: 100%; display: block; }
.search input { width: 100%; min-height: 52px; padding: 0 16px 0 50px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 1rem; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); }
.s-results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.45); display: grid; gap: 2px; }
.s-results a { display: flex; gap: 12px; align-items: center; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--text); min-height: 52px; }
.s-results a:hover, .s-results a:focus-visible { background: var(--surface-2); outline-offset: -2px; }
.s-results .s-cover { width: 34px; height: 46px; border-radius: 5px; object-fit: cover; flex: none; font-size: .7rem; }
.s-results strong { display: block; font-weight: 700; } .s-results small { color: var(--muted); font-size: .85rem; }
.s-results .s-all { width: 100%; min-height: 44px; background: transparent; border: 0; color: var(--accent); font-weight: 700; justify-content: flex-start; padding: 0 10px; }
.s-results .s-none { margin: 8px 10px; color: var(--muted); }

.resume { margin-bottom: 34px; }
.resume h2, .latest h2 { margin: 0 0 14px; font-size: clamp(1.6rem, 2.2vw, 2.05rem); }
.rcard { display: grid; grid-template-columns: minmax(200px, 38%) minmax(0, 1fr) auto; align-items: center; gap: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; padding-right: 26px; }
.rc-art { display: block; align-self: stretch; min-height: 184px; background: #2A2620; }
.rc-art img { width: 100%; height: 100%; min-height: 184px; max-height: 210px; object-fit: cover; object-position: center 25%; display: block; }
.rc-info { min-width: 0; padding: 20px 0; }
.rc-info h3 { margin: 0; font: 600 clamp(1.5rem, 2.3vw, 2.1rem)/1.1 var(--display); }
.rc-info h3 a { color: var(--strong); text-decoration: none; }
.rc-info h3 a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.rc-meta { color: var(--muted); margin: 8px 0 14px; }
.rc-progress { display: flex; align-items: center; gap: 14px; max-width: 420px; }
.rc-progress .bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.rc-progress .bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.rc-progress .pct { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3.5em; }
.rc-go { min-height: 52px; padding: 0 22px; border-radius: 8px; font-size: 1rem; white-space: nowrap; }
.rc-go .icon { width: 20px; height: 20px; }
.rc-next { font-weight: 400; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 14px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filter-group { display: flex; flex-wrap: wrap; gap: 10px; }
.filter-sep { width: 1px; height: 30px; background: var(--line); margin: 0 4px; }
.filters .chip { min-height: 44px; border-radius: 8px; padding: 0 18px; }
.filters .chip[aria-pressed="true"] { background: #E3CDA4; color: #1B1813; border-color: #C9AD7B; }
.pill-select { width: auto; min-height: 44px; border-radius: 8px; padding: 0 38px 0 14px; background-color: transparent; }
.filters .quick { min-height: 44px; border-radius: 8px; }

.tgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.tcard { min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tc-cover { position: relative; display: block; aspect-ratio: 6 / 5; background: #2A2620; overflow: hidden; }
.tc-cover img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; display: block; transition: transform .25s ease; }
.tc-cover:hover img { transform: scale(1.03); }
.tc-ph { position: absolute; inset: 0; display: grid; place-items: center; font: 600 2.4rem var(--display); color: var(--muted); letter-spacing: .05em; }
.tc-badge { position: absolute; left: 12px; top: 12px; background: #E3CDA4; color: #1B1813; font-size: .85rem; font-weight: 700; padding: 3px 10px; border-radius: 6px; }
.tc-ext { position: absolute; right: 10px; top: 10px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: rgba(20,20,18,.75); color: #F0EADF; }
.tc-body { padding: 14px 14px 8px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tc-title { margin: 0; font: 600 1.42rem/1.15 var(--display); }
.tc-title a { color: var(--strong); text-decoration: none; }
.tc-title a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.tc-meta { margin: 0; color: var(--muted); font-size: .95rem; }
.tc-meta abbr { text-decoration: none; }
.tc-body .note { font-size: .86rem; margin: 2px 0 0; }
.tc-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 4px; }
.tc-when { color: var(--muted); font-size: .9rem; }
.tc-more { width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.tc-more:hover, .tc-more[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.popmenu { position: fixed; z-index: 60; min-width: 230px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.45); display: grid; gap: 2px; }
.popmenu a, .popmenu button { min-height: 44px; display: flex; align-items: center; justify-content: flex-start; padding: 0 12px; border-radius: 8px; border: 0; background: transparent; color: var(--text); font-weight: 400; text-decoration: none; text-align: left; }
.popmenu a:hover, .popmenu button:hover, .popmenu :focus-visible { background: var(--surface-2); outline-offset: -2px; }
.empty-state { text-align: center; padding: 48px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; }
.empty-state .es-icon { width: 40px; height: 40px; margin: 0 auto 8px; color: var(--accent); }
.empty-state .big { font: 600 2rem var(--display); color: var(--strong); }
.empty-state p { color: var(--muted); margin: 4px 0 18px; }
.empty-state .btn .icon { width: 18px; height: 18px; }
.uptodate { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 34px; color: var(--muted); font-size: .95rem; }
.uptodate svg { width: 26px; height: 26px; color: var(--muted); }
.uptodate::before { content: ''; width: 100%; height: 1px; background: var(--line); margin-bottom: -16px; }
.uptodate svg { background: var(--bg); padding: 0 8px; box-sizing: content-box; position: relative; }

@media (max-width: 1100px) {
  .tgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rcard { grid-template-columns: minmax(180px, 34%) minmax(0, 1fr); padding-right: 0; }
  .rc-go { grid-column: 2; justify-self: start; margin: 0 0 20px; }
  .rc-art { grid-row: span 2; }
}
@media (max-width: 899px) {
  .tgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .hero-tools { flex: 1 1 100%; }
  main { max-width: 760px; }
  body:not(.page-narrow) main { max-width: 900px; }
}
@media (max-width: 600px) {
  .tgrid { grid-template-columns: minmax(0, 1fr); }
  .hero { margin-bottom: 22px; }
  .rcard { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rc-art { grid-row: auto; min-height: 0; }
  .rc-art img { min-height: 0; height: 160px; }
  .rc-info { padding: 16px 16px 12px; }
  .rc-go { grid-column: 1; margin: 0 16px 16px; justify-self: stretch; white-space: normal; text-align: center; }
  .filter-sep { display: none; }
  .filters .chip { padding: 0 14px; }
  .section-head { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .tc-cover img, .tabs, .profile-btn .chev { transition: none !important; } }

/* Recherche par nom (Ajouter) */
.name-search { margin-top: 16px; }
.ns-mine { display: grid; gap: 4px; }
.ns-mine a { display: flex; gap: 12px; align-items: center; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--text); min-height: 52px; }
.ns-mine a:hover { background: var(--surface-2); }
.ns-mine .s-cover { width: 34px; height: 46px; border-radius: 5px; object-fit: cover; flex: none; }
.ns-mine strong { display: block; } .ns-mine small { color: var(--muted); }
.ns-links { display: flex; flex-wrap: wrap; gap: 8px; }
.ns-links .btn { font-weight: 400; min-height: 44px; }
.s-cover.ph { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 700; }

/* Liseuse : fonds, largeurs, espace, réglages */
.reader.bg-gris, body.reader-mode:has(.bg-gris) { background: #2A2B2E; }
.reader.bg-sepia, body.reader-mode:has(.bg-sepia) { background: #E9DFC9; }
.reader.bg-sepia .r-end, .reader.bg-sepia .r-msg { color: #3B3226; }
.reader.bg-sepia .r-end-title, .reader.bg-sepia .r-msg .big { color: #2A2219; }
.reader.bg-sepia .r-credit { color: #6B5E4E; }
.reader.bg-sepia .r-end .ghost, .reader.bg-sepia .r-msg .ghost { color: #3B3226; background: #F5EDDC; border-color: #D7C9AE; }
.reader.bg-sepia .r-pages img { background: #DED2B8; }
.reader.bg-gris .r-pages img { background: #34363A; }
.fit-medium .r-pages img { max-width: 720px; }
.reader.gap .r-pages { gap: 14px; }
.r-settings .r-lbl { font-size: .82rem; color: #969BA3; margin-bottom: -6px; }
.r-settings .chips { flex-wrap: wrap; padding: 0; mask-image: none; -webkit-mask-image: none; }
.r-settings .chip { min-height: 38px; }
.r-toggle { display: flex !important; grid-template-columns: none; align-items: center; gap: 10px !important; }
.r-toggle input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--accent); flex: none; }
.r-keys { font-size: .78rem; color: #969BA3; margin: 0; }
@media (max-width: 899px) { .r-keys { display: none; } }
.r-settings { max-height: calc(100vh - 80px); overflow-y: auto; }

.ns-work { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; margin: 2px 0 6px; }
.ns-work strong { font-size: 1.05rem; color: var(--strong); }
.ns-t { font-size: .9rem; color: var(--muted); }
.ns-t abbr { text-decoration: none; font-size: .72rem; font-weight: 700; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-right: 2px; }
.ns-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.ns-card { display: flex; gap: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-width: 0; }
.ns-card.maybe { opacity: .92; }
.ns-cover { width: 64px; height: 88px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface); }
.ns-cover.ph { display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.ns-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ns-title { font-weight: 700; color: var(--strong); overflow-wrap: anywhere; }
.ns-meta { font-size: .88rem; color: var(--muted); }
.ns-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.ns-actions .btn { min-height: 40px; padding: 0 12px; font-size: .9rem; }
.ns-actions .btn .icon { width: 16px; height: 16px; }
.ns-ext { width: 40px; padding: 0 !important; }
.ns-maybe { margin-top: 12px; }
.ns-maybe summary { cursor: pointer; color: var(--accent); min-height: 40px; display: flex; align-items: center; }

.goto { margin-top: 14px; }
.goto label { margin-top: 0; }

/* Feuille série : aller au chapitre, grille des chapitres */
.ss-goto { display: flex; gap: 8px; margin-top: 12px; }
.ss-goto input { flex: 1; min-width: 0; }
.ss-msg { margin: 4px 0 0; min-height: 1em; }
.ss-chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; max-height: 36vh; overflow-y: auto; padding: 4px 2px; margin-top: 6px; overscroll-behavior: contain; }
.ss-ch { min-height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; font-weight: 700; font-size: .95rem; }
.ss-ch:hover { border-color: var(--accent); color: var(--strong); }
.ss-ch.read { color: var(--muted); font-weight: 400; background: transparent; }
.ss-ch.here { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--strong); }
.ss-ch.paid { opacity: .7; }
