/* ════════════════════════════════════════════════════════════════════════
   LISEUSE v2 — « Bibliothèque de verre, pages de papier »
   ─────────────────────────────────────────────────────────────────────────
   Direction (design_refs/_VERDICT.md) :
   · App = verre profond violet (3 niveaux d'élévation), mesh cosmique calme
   · Titres de livres & sections = serif éditorial (Fraunces) — l'objet-livre
   · Lecture = page de PAPIER crème sur encre (jamais de verre sous le texte)
   ════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Outfit:wght@400;500;600;700&display=swap');

/* ───────────────────────────────── tokens ───────────────────────────── */
:root {
  /* fond & encre */
  --bg: #0c0a14;
  --bg-deep: #08070f;
  --text: #f1eefb;
  --text-2: #aaa4c4;
  --text-3: #6f6a8a;

  /* famille d'accent (violet → indigo → cyan) */
  --acc: #8b5cf6;
  --acc-2: #6366f1;
  --acc-3: #22d3ee;
  --acc-soft: rgba(139, 92, 246, .16);
  --grad-acc: linear-gradient(135deg, #8b5cf6, #6366f1 55%, #22d3ee);

  /* verre — 3 niveaux d'élévation */
  --glass-1: rgba(255, 255, 255, .035);
  --glass-2: rgba(255, 255, 255, .06);
  --glass-3: rgba(22, 18, 38, .82);
  --stroke: rgba(255, 255, 255, .075);
  --stroke-lit: rgba(255, 255, 255, .16);
  --blur-1: blur(14px);
  --blur-2: blur(22px);
  --blur-3: blur(34px);

  /* papier (zone de lecture) */
  --paper: #f7f1e4;
  --paper-ink: #262019;
  --paper-muted: #8a7f6d;
  --paper-sepia: #f2e8d4;
  --paper-sepia-ink: #4a3f2e;
  --paper-night: #16131f;
  --paper-night-ink: #ddd7e8;

  /* surlignage */
  --hl-yellow: #f6e05e;
  --hl-green: #68d391;
  --hl-blue: #63b3ed;
  --hl-pink: #f687b3;

  /* sémantique */
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;

  /* géométrie */
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 22px;
  --r-xl: 30px;
  --gap: 18px;
  --pad: 20px;

  /* ombres multicouches */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .28);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .4), 0 16px 42px rgba(0, 0, 0, .42);
  --shadow-3: 0 8px 22px rgba(0, 0, 0, .5), 0 32px 80px rgba(8, 5, 22, .65);
  --shadow-acc: 0 4px 18px rgba(139, 92, 246, .35);

  /* typo */
  --ui: 'Outfit', -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fraunces', Georgia, serif;
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;

  --ease: cubic-bezier(.22, .8, .3, 1);
  --spring: cubic-bezier(.34, 1.4, .48, 1);
}

/* ───────────────────────────── base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { max-width: 100%; }
::selection { background: rgba(139, 92, 246, .4); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }

/* ascenseurs personnalisés (remplace les ascenseurs système) — fin, translucide, teinte violette */
* { scrollbar-width: thin; scrollbar-color: rgba(139, 92, 246, .35) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background-color: rgba(139, 92, 246, .32); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: rgba(139, 92, 246, .55); background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* fond cosmique calme */
.fx {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(58% 42% at 12% -6%, rgba(99, 102, 241, .20), transparent 62%),
    radial-gradient(46% 38% at 94% 16%, rgba(139, 92, 246, .16), transparent 60%),
    radial-gradient(52% 46% at 78% 96%, rgba(34, 211, 238, .07), transparent 58%),
    radial-gradient(40% 34% at 20% 88%, rgba(139, 92, 246, .08), transparent 60%),
    var(--bg);
}
.fx::after { /* voile de grain très léger */
  content: ''; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255, 255, 255, .014) 1px, transparent 1px);
  background-size: 3px 3px;
}

.screen[hidden] { display: none !important; }

/* ─────────────────────────── composants communs ─────────────────────── */
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--glass-1); border: 1px solid var(--stroke);
  color: var(--text-2); transition: all .2s var(--ease);
}
.iconbtn:hover { background: var(--glass-2); color: var(--text); border-color: var(--stroke-lit); transform: translateY(-1px); }
.iconbtn:active { transform: translateY(0) scale(.96); }
.iconbtn svg { width: 19px; height: 19px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 13px;
  background: var(--glass-2); border: 1px solid var(--stroke);
  font-weight: 600; font-size: 14px; color: var(--text);
  transition: all .2s var(--ease);
}
.btn:hover { border-color: var(--stroke-lit); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn--ask {
  background: linear-gradient(135deg, rgba(139, 92, 246, .28), rgba(99, 102, 241, .2));
  border-color: rgba(139, 92, 246, .42);
}
.btn--ask:hover { box-shadow: var(--shadow-acc); }
.btn--primary { background: var(--grad-acc); border: 0; color: #fff; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 0 15px; border-radius: 999px;
  background: var(--glass-1); border: 1px solid var(--stroke);
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  transition: all .18s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--stroke-lit); }
.chip.is-active {
  color: #fff; background: var(--acc-soft);
  border-color: rgba(139, 92, 246, .5); box-shadow: inset 0 0 18px rgba(139, 92, 246, .12);
}

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--err); color: #fff; font-size: 11px; font-weight: 700;
}

select {
  appearance: none; -webkit-appearance: none;
  min-height: 40px; padding: 0 34px 0 14px; border-radius: 12px;
  background: var(--glass-1)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aaa4c4' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 13px center;
  border: 1px solid var(--stroke); color: var(--text-2); font-size: 13.5px;
}
select:hover { border-color: var(--stroke-lit); color: var(--text); }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--acc)); display: inline-block; margin-right: 8px; }

.empty { text-align: center; color: var(--text-3); padding: 70px 20px; font-size: 15px; }

/* ═══════════════════════════ ÉCRAN LOGIN ═══════════════════════════ */
.screen-login {
  display: grid; place-items: center; min-height: 100dvh; padding: 24px;
}
.login-card {
  width: min(400px, 100%); padding: 44px 38px 38px; text-align: center;
  background: var(--glass-2); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke-lit); border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  animation: rise .6s var(--spring) both;
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px;
  background: var(--grad-acc); box-shadow: var(--shadow-acc); position: relative;
}
.login-logo::after { /* livre ouvert */
  content: ''; position: absolute; inset: 17px 15px;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(255,255,255,.9) calc(50% - 1px), rgba(255,255,255,.9) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(rgba(255,255,255,.92), rgba(255,255,255,.92));
  border-radius: 4px 4px 7px 7px;
  clip-path: polygon(0 12%, 50% 0, 100% 12%, 100% 100%, 50% 88%, 0 100%);
}
.login-card h1 { font-family: var(--display); font-size: 34px; font-weight: 600; margin: 0; }
.login-sub { color: var(--text-2); margin: 4px 0 28px; font-size: 14.5px; }
.login-card label { display: block; text-align: left; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 14px; }
.login-card input {
  display: block; width: 100%; margin-top: 6px; min-height: 48px; padding: 0 16px;
  background: rgba(0, 0, 0, .28); border: 1px solid var(--stroke); border-radius: 13px;
  color: var(--text); font-size: 15px; transition: border-color .2s;
}
.login-card input:focus { border-color: var(--acc); outline: none; box-shadow: 0 0 0 3px rgba(139, 92, 246, .18); }
.login-card button[type="submit"] {
  width: 100%; min-height: 50px; margin-top: 10px; border-radius: 14px;
  background: var(--grad-acc); color: #fff; font-weight: 700; font-size: 15.5px;
  transition: all .2s var(--ease); box-shadow: var(--shadow-acc);
}
.login-card button[type="submit"]:hover { transform: translateY(-1px); filter: brightness(1.08); }
.login-card button[type="submit"]:disabled { opacity: .6; }
.login-error { color: var(--err); font-size: 13.5px; margin: 0 0 10px; }

@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.97); } }

/* ═══════════════════════════ ÉCRAN APP ═══════════════════════════ */
.screen-app { display: flex; min-height: 100dvh; }

/* ───────────── sidebar ───────────── */
.sidebar {
  width: 248px; flex-shrink: 0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  backdrop-filter: var(--blur-2); -webkit-backdrop-filter: var(--blur-2);
  border-right: 1px solid var(--stroke);
}
.sidebar__head { display: flex; align-items: center; gap: 11px; padding: 22px 20px 14px; }
.sidebar__logo {
  width: 34px; height: 34px; border-radius: 11px; background: var(--grad-acc);
  box-shadow: var(--shadow-acc); position: relative; flex-shrink: 0;
}
.sidebar__logo::after {
  content: ''; position: absolute; inset: 9px 8px;
  background: rgba(255,255,255,.92); border-radius: 2px 2px 4px 4px;
  clip-path: polygon(0 14%, 50% 0, 100% 14%, 100% 100%, 50% 86%, 0 100%);
}
.sidebar__title { font-family: var(--display); font-size: 21px; font-weight: 600; }
.sidebar__close { display: none; margin-left: auto; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; scrollbar-width: thin; }
.sidebar__label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3); margin: 20px 10px 7px;
}
.nav-item {
  display: flex; align-items: center; width: 100%; min-height: 42px;
  padding: 0 12px; border-radius: 11px; text-align: left;
  color: var(--text-2); font-weight: 500; font-size: 14px;
  transition: all .16s var(--ease); position: relative;
}
.nav-item:hover { background: var(--glass-1); color: var(--text); }
.nav-item.is-active { background: var(--acc-soft); color: #fff; font-weight: 600; }
.nav-item.is-active::before {
  content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px;
  border-radius: 3px; background: var(--grad-acc);
}
.nav-item--sub { min-height: 38px; font-size: 13.5px; padding-left: 16px; }
.nav-item--ghost { color: var(--text-3); font-size: 13px; min-height: 36px; padding-left: 16px; }
.nav-item .badge { margin-left: auto; }

.sidebar__foot {
  display: flex; align-items: center; gap: 11px; padding: 14px 16px;
  border-top: 1px solid var(--stroke);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--grad-acc); color: #fff; font-weight: 700; font-size: 13px;
}
.sidebar__user { flex: 1; min-width: 0; line-height: 1.25; }
.sidebar__user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user small { color: var(--text-3); font-size: 12px; }
.sidebar__foot .iconbtn { width: 38px; height: 38px; }
.sidebar__foot .iconbtn::after { content: '⏻'; font-size: 15px; }

.sidebar-scrim {
  position: fixed; inset: 0; z-index: 48;
  background: rgba(5, 3, 12, .6); backdrop-filter: blur(3px);
}

/* ───────────── main + topbar ───────────── */
.main { flex: 1; min-width: 0; padding: 18px 26px 90px; }

.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  position: sticky; top: 12px; z-index: 40;
  padding: 10px 14px; margin-bottom: 22px;
  background: var(--glass-3); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke); border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
}
.topbar__burger { display: none; }

.searchbox { position: relative; flex: 1 1 200px; min-width: 160px; }
.searchbox input {
  width: 100%; min-height: 44px; padding: 0 74px 0 42px;
  background: rgba(0, 0, 0, .26); border: 1px solid var(--stroke); border-radius: 13px;
  color: var(--text); font-size: 14.5px;
}
.searchbox input:focus { border-color: var(--acc); outline: none; }
.searchbox::before {
  content: ''; position: absolute; left: 15px; top: 50%; width: 15px; height: 15px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6a8a' stroke-width='2.2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.4-3.4'/%3E%3C/svg%3E") center/contain no-repeat;
}
.searchbox__kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--ui); font-size: 11.5px; color: var(--text-3);
  border: 1px solid var(--stroke); border-radius: 7px; padding: 3px 8px;
  cursor: pointer; background: var(--glass-1);
}

.format-tabs { display: flex; gap: 4px; padding: 4px; background: rgba(0, 0, 0, .24); border-radius: 13px; overflow-x: auto; scrollbar-width: none; }
.format-tabs::-webkit-scrollbar { display: none; }
.ftab {
  min-height: 38px; padding: 0 15px; border-radius: 10px; white-space: nowrap;
  color: var(--text-2); font-weight: 600; font-size: 13.5px;
  transition: all .18s var(--ease);
}
.ftab:hover { color: var(--text); }
.ftab.is-active { background: var(--glass-2); color: #fff; box-shadow: var(--shadow-1); border: 1px solid var(--stroke-lit); }

.topbar__actions { display: flex; gap: 9px; align-items: center; }
[data-refresh-library]::after { content: '⟳'; font-size: 18px; }
[data-open-aa]::after { content: '⌖'; font-size: 19px; }

/* ───────────── bibliothèque ───────────── */
.view[hidden] { display: none !important; }

.shelf { margin-bottom: 26px; }
.shelf__title, .lib-head h2 {
  font-family: var(--display); font-size: 24px; font-weight: 600; margin: 0 0 13px;
}
.shelf__row {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 320px);
  gap: 14px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin;
}
.continue-card {
  display: flex; gap: 14px; align-items: center; text-align: left;
  padding: 12px; border-radius: var(--r-m);
  background: var(--glass-2); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur-1); -webkit-backdrop-filter: var(--blur-1);
  transition: all .2s var(--ease);
}
.continue-card:hover { transform: translateY(-2px); border-color: var(--stroke-lit); box-shadow: var(--shadow-2); }
.continue-card__cover {
  width: 52px; height: 74px; border-radius: 7px; overflow: hidden; flex-shrink: 0;
  background: linear-gradient(150deg, #4c3a86, #232047); box-shadow: var(--shadow-1);
}
.continue-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.continue-card__meta { flex: 1; min-width: 0; }
.continue-card__meta b {
  display: block; font-family: var(--display); font-size: 15.5px; font-weight: 600;
  line-height: 1.25; margin-bottom: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.continue-card__bar {
  display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1);
  position: relative; overflow: hidden; margin-bottom: 5px;
}
.continue-card__bar::after {
  content: ''; position: absolute; inset: 0; width: var(--p, 0%);
  background: var(--grad-acc); border-radius: 4px;
}
.continue-card__meta small { color: var(--text-3); font-size: 12px; }

/* bandeau TCL */
.tcl-strip {
  margin-bottom: 22px; padding: 14px 16px;
  background: linear-gradient(135deg, rgba(34, 211, 238, .08), rgba(99, 102, 241, .06));
  border: 1px solid rgba(34, 211, 238, .2); border-radius: var(--r-m);
}
.tcl-strip__head { font-size: 13.5px; margin-bottom: 10px; }
.tcl-strip__head b { color: var(--acc-3); }
.tcl-strip__head small { color: var(--text-3); }
.tcl-strip__row { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.tcl-action {
  display: inline-flex; align-items: center; gap: 9px; flex-shrink: 0;
  min-height: 42px; padding: 6px 14px 6px 9px; max-width: 340px;
  background: var(--glass-2); border: 1px solid var(--stroke); border-radius: 11px;
  color: var(--text-2); font-size: 13px; text-align: left;
  transition: all .2s var(--ease);
}
.tcl-action:hover { color: var(--text); border-color: rgba(34, 211, 238, .4); }
.tcl-action__check {
  width: 19px; height: 19px; border-radius: 6px; flex-shrink: 0;
  border: 1.5px solid var(--text-3); transition: all .2s;
}
.tcl-action.is-done { opacity: .35; }
.tcl-action.is-done .tcl-action__check { background: var(--ok); border-color: var(--ok); }
.tcl-action__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcl-action__date { color: var(--acc-3); flex-shrink: 0; }

/* en-tête + contrôles */
.lib-head { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; margin-bottom: 17px; }
.lib-count { color: var(--text-3); font-size: 13.5px; }
.lib-controls { display: flex; gap: 9px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.density { display: flex; gap: 4px; }
.density .iconbtn { width: 40px; height: 40px; font-size: 17px; }

/* grille de couvertures */
.books-grid {
  display: grid; gap: 22px 16px;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min, 168px), 1fr));
}
.book-card { cursor: pointer; }
.book-cover {
  position: relative; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden;
  background: linear-gradient(155deg, #453973, #221e40 70%);
  box-shadow: var(--shadow-1);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.book-card:hover .book-cover,
.book-card:focus-visible .book-cover { transform: translateY(-5px) scale(1.02); box-shadow: var(--shadow-2), 0 18px 40px rgba(139, 92, 246, .16); }
.book-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.book-cover__ph { /* placeholder typo (visible si pas d'image) */
  position: absolute; inset: 0; display: none; flex-direction: column; justify-content: space-between;
  padding: 42px 13px 14px; /* dégage le badge de format en haut */
}
.book-cover__ph::before { /* filet décoratif façon couverture d'éditeur */
  content: ''; position: absolute; inset: 30px 10px auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
}
.book-cover.no-img .book-cover__ph { display: flex; }
.book-cover__ph b {
  font-family: var(--display); font-weight: 600; font-size: 15.5px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.book-cover__ph i { font-style: normal; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
/* variations de teinte du placeholder par format */
.book-cover[data-kind="pdf"] { background: linear-gradient(155deg, #7a4a33, #33201a 70%); }
.book-cover[data-kind="audio"] { background: linear-gradient(155deg, #1f5f6b, #122831 70%); }
.book-cover[data-kind="bd"] { background: linear-gradient(155deg, #8a5a2a, #3a2413 70%); }
.book-cover[data-kind="texte"], .book-cover[data-kind="docx"] { background: linear-gradient(155deg, #4a6141, #1f2b1a 70%); }

.book-badge {
  position: absolute; top: 9px; left: 9px; z-index: 2;
  padding: 3px 9px; border-radius: 7px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  background: rgba(10, 8, 20, .72); backdrop-filter: blur(6px); color: #fff;
  border: 1px solid rgba(255, 255, 255, .14);
}
.book-badge--epub { color: #c4b5fd; }
.book-badge--pdf { color: #fdba74; }
.book-badge--audio { color: #67e8f9; }
.book-badge--bd { color: #fcd34d; }
.book-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: rgba(0, 0, 0, .45); z-index: 2;
}
.book-progress::after {
  content: ''; position: absolute; inset: 0; width: var(--p, 0%);
  background: var(--grad-acc);
}
/* étiquette de type de contenu TCL (DIARISATION, RÉSUMÉ, AUDIO 1…) — remplace le mot brut du nom de fichier */
.book-tcl-kicker {
  display: inline-block; margin: 9px 2px 0; padding: 3px 8px; border-radius: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--acc-3); background: rgba(34, 211, 238, .1); border: 1px solid rgba(34, 211, 238, .22);
}
.book-tcl-kicker + .book-title { margin-top: 5px; }
.book-title {
  font-family: var(--display); font-size: 14.5px; font-weight: 600; line-height: 1.3;
  margin: 10px 2px 2px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.book-author { color: var(--text-3); font-size: 12.5px; margin: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* squelettes */
.book-card--skeleton { aspect-ratio: 2 / 3.4; border-radius: 12px; background: var(--glass-1); position: relative; overflow: hidden; }
.book-card--skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .05) 50%, transparent 70%);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ═══════════════════════════ ÉCRAN LECTEUR ═══════════════════════════ */
.screen-reader { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--bg-deep); }

.reader-bar {
  display: flex; align-items: center; gap: 14px; flex-shrink: 0;
  padding: 10px 16px; margin: 10px 12px 0;
  background: var(--glass-3); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke); border-radius: var(--r-l);
  box-shadow: var(--shadow-2); z-index: 5;
}
[data-reader-close]::after { content: '‹'; font-size: 24px; line-height: 1; }
.reader-bar__meta { min-width: 0; line-height: 1.3; }
.reader-bar__meta b {
  display: block; font-family: var(--display); font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reader-bar__meta small { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.reader-bar__progress {
  margin-left: auto; flex-shrink: 0; color: var(--text-2); font-size: 13px; font-weight: 600;
  position: relative; padding-bottom: 6px; min-width: 70px; text-align: right;
}
.reader-bar__progress::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  border-radius: 3px; background: rgba(255, 255, 255, .1);
}
.reader-bar__progress::before {
  content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 0%);
  max-width: 100%; border-radius: 3px; background: var(--grad-acc); z-index: 1;
}
.reader-bar__actions { display: flex; gap: 7px; flex-shrink: 0; }
.reader-bar__actions .iconbtn { width: 40px; height: 40px; }

/* scène */
.reader-stage { flex: 1; position: relative; min-height: 0; }
.viewer { position: absolute; inset: 0; }
.viewer[hidden] { display: none !important; }

/* page de PAPIER (epub/txt/docx) — le texte ne vit jamais sur du verre */
.epub-host, .paper-page {
  position: absolute; inset: 14px; margin: 0 auto; max-width: 1080px;
  background: var(--paper); border-radius: var(--r-m);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .05), var(--shadow-3);
  overflow: hidden;
}
body[data-reader-theme="sepia"] .epub-host, body[data-reader-theme="sepia"] .paper-page { background: var(--paper-sepia); }
body[data-reader-theme="sombre"] .epub-host, body[data-reader-theme="sombre"] .paper-page { background: var(--paper-night); }
.paper-page {
  overflow-y: auto; padding: clamp(26px, 6vw, 72px);
  font-family: var(--serif); font-size: 17.5px; line-height: 1.7; color: var(--paper-ink);
}
body[data-reader-theme="sepia"] .paper-page { color: var(--paper-sepia-ink); }
body[data-reader-theme="sombre"] .paper-page { color: var(--paper-night-ink); }

/* PDF */
.pdf-host { position: absolute; inset: 14px 14px 66px; overflow: auto; display: grid; place-items: start center; }
.pdf-pages { display: grid; grid-template-columns: repeat(var(--cols, 1), auto); gap: 16px; padding-bottom: 20px; }
.pdf-page { position: relative; background: #fff; border-radius: 6px; box-shadow: var(--shadow-2); overflow: hidden; }
.pdf-textlayer { position: absolute; inset: 0; line-height: 1; opacity: .22; }
.pdf-textlayer > span { position: absolute; color: transparent; white-space: pre; transform-origin: 0 0; cursor: text; }
.pdf-textlayer ::selection { background: rgba(139, 92, 246, .45); }
.pdf-hl-layer { position: absolute; inset: 0; pointer-events: none; }
.pdf-hl { position: absolute; opacity: .4; mix-blend-mode: multiply; border-radius: 2px; }
.pdf-hud {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px; padding: 7px 12px;
  background: var(--glass-3); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke); border-radius: 999px; box-shadow: var(--shadow-2);
  font-size: 13px; color: var(--text-2); z-index: 6; white-space: nowrap;
}
.pdf-hud .iconbtn { width: 36px; height: 36px; font-size: 16px; }
.pdf-hud__sep { width: 1px; height: 20px; background: var(--stroke); }
.pdf-hud__page { width: 52px; min-height: 36px; text-align: center; background: rgba(0, 0, 0, .3); border: 1px solid var(--stroke); border-radius: 9px; color: var(--text); }
.pdf-hud select { min-height: 36px; }

/* loader */
.reader-loader {
  position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; gap: 16px;
  text-align: center; color: var(--text-2); font-size: 14.5px;
  background: rgba(8, 7, 15, .78); backdrop-filter: blur(8px);
}
.reader-loader__spinner {
  width: 44px; height: 44px; margin: 0 auto; border-radius: 50%;
  border: 3px solid rgba(139, 92, 246, .2); border-top-color: var(--acc);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* flèches de navigation */
.reader-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 6;
  width: 46px; height: 76px; border-radius: 14px;
  background: var(--glass-3); backdrop-filter: var(--blur-2); -webkit-backdrop-filter: var(--blur-2);
  border: 1px solid var(--stroke); color: var(--text-2); font-size: 24px;
  opacity: .5; transition: all .2s var(--ease);
}
.reader-nav:hover { opacity: 1; color: var(--text); border-color: var(--stroke-lit); }
.reader-nav--prev { left: 18px; } .reader-nav--prev::after { content: '‹'; }
.reader-nav--next { right: 18px; } .reader-nav--next::after { content: '›'; }

/* rail d'outils d'annotation permanent (dock bas) */
.tools-rail {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  background: var(--glass-3); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke-lit); border-radius: 999px;
  box-shadow: var(--shadow-3);
}
.tools-rail .iconbtn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; }
.tools-rail .iconbtn:hover { background: var(--glass-2); transform: none; }
.tools-rail .iconbtn.is-active { background: var(--acc-soft); color: #fff; box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .5); }
.tools-rail__sep { width: 1px; height: 24px; background: var(--stroke); margin: 0 3px; }
.hl-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; transition: all .15s var(--spring); }
.hl-dot:hover { transform: scale(1.12); }
.hl-dot.is-active { border-color: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .4); transform: scale(1.12); }
.hl-dot--yellow { background: var(--hl-yellow); }
.hl-dot--green { background: var(--hl-green); }
.hl-dot--blue { background: var(--hl-blue); }
.hl-dot--pink { background: var(--hl-pink); }

/* toolbar contextuelle de sélection */
.selection-toolbar {
  position: fixed; z-index: 70; display: flex; gap: 4px; padding: 6px;
  background: var(--glass-3); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke-lit); border-radius: 14px; box-shadow: var(--shadow-3);
  animation: pop .18s var(--spring) both;
}
.selection-toolbar .iconbtn { width: 40px; height: 40px; border: 0; background: transparent; }
.selection-toolbar .iconbtn:hover { background: var(--glass-2); transform: none; }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(4px); } }

/* panneaux latéraux */
.panel {
  position: absolute; top: 76px; bottom: 14px; width: min(370px, calc(100vw - 28px)); z-index: 30;
  background: var(--glass-3); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke-lit); border-radius: var(--r-l);
  box-shadow: var(--shadow-3); overflow: hidden; display: flex; flex-direction: column;
}
.panel--left { left: 14px; animation: slideL .28s var(--ease) both; }
.panel--right { right: 14px; animation: slideR .28s var(--ease) both; }
@keyframes slideL { from { opacity: 0; transform: translateX(-24px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(24px); } }
.panel__head {
  display: flex; align-items: center; gap: 10px; padding: 15px 18px 12px;
  border-bottom: 1px solid var(--stroke); flex-shrink: 0;
}
.panel__head b { font-family: var(--display); font-size: 17px; font-weight: 600; flex: 1; }
.panel__body { flex: 1; overflow-y: auto; padding: 14px 16px; scrollbar-width: thin; }
.panel__tabs { display: flex; gap: 4px; padding: 10px 16px 0; }
.panel__tab {
  min-height: 38px; padding: 0 14px; border-radius: 10px 10px 0 0;
  color: var(--text-3); font-weight: 600; font-size: 13.5px;
  border-bottom: 2px solid transparent;
}
.panel__tab.is-active { color: var(--text); border-bottom-color: var(--acc); }

/* dock TTS */
.tts-dock {
  position: absolute; right: 16px; bottom: 84px; z-index: 25; width: min(320px, calc(100vw - 32px));
  padding: 16px; border-radius: var(--r-l);
  background: var(--glass-3); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke-lit); box-shadow: var(--shadow-3);
}

/* ═══════════════════════ SURCOUCHES GLOBALES ═══════════════════════ */
/* palette ⌘K */
.palette-overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; justify-items: center;
  padding-top: min(16vh, 150px);
  background: rgba(5, 3, 12, .55); backdrop-filter: blur(5px);
}
.palette-overlay[hidden] { display: none !important; }
.palette {
  width: min(580px, calc(100vw - 32px)); max-height: 62vh; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--glass-3); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke-lit); border-radius: var(--r-l); box-shadow: var(--shadow-3);
  animation: pop .2s var(--spring) both;
}
.palette input {
  min-height: 56px; padding: 0 20px; background: transparent; border: 0;
  border-bottom: 1px solid var(--stroke); color: var(--text); font-size: 16px;
}
.palette input:focus { outline: none; }
.palette__results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.palette__item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px; border-radius: 11px; cursor: pointer; font-size: 14.5px;
}
.palette__item small { color: var(--text-3); flex-shrink: 0; }
.palette__item:hover, .palette__item.is-selected { background: var(--acc-soft); }
.palette__empty { padding: 22px; text-align: center; color: var(--text-3); }

/* modales */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: rgba(5, 3, 12, .6); backdrop-filter: blur(6px);
}
.modal-overlay[hidden] { display: none !important; }
.modal {
  width: min(640px, 100%); max-height: 86vh; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--glass-3); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke-lit); border-radius: var(--r-xl); box-shadow: var(--shadow-3);
  animation: pop .22s var(--spring) both;
}
.modal__head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--stroke); }
.modal__head b { font-family: var(--display); font-size: 20px; font-weight: 600; flex: 1; }
.modal__body { padding: 18px 22px 24px; overflow-y: auto; scrollbar-width: thin; }
.modal textarea, .modal input[type="text"], .modal input[type="search"] {
  width: 100%; padding: 13px 15px; background: rgba(0, 0, 0, .28);
  border: 1px solid var(--stroke); border-radius: 13px; color: var(--text); font-size: 14.5px;
  resize: vertical;
}
.modal textarea:focus, .modal input:focus { border-color: var(--acc); outline: none; }

/* toasts */
.toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 9px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 20px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: var(--glass-3); backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border: 1px solid var(--stroke-lit); box-shadow: var(--shadow-3);
  opacity: 0; transform: translateY(12px); transition: all .3s var(--spring);
  pointer-events: auto;
}
.toast.is-in { opacity: 1; transform: translateY(0); }
.toast--success::before { content: '✓'; color: var(--ok); font-weight: 700; }
.toast--error::before { content: '✕'; color: var(--err); font-weight: 700; }
.toast--warn::before { content: '!'; color: var(--warn); font-weight: 800; }

/* ═══════════════════════════ RESPONSIVE ═══════════════════════════ */
@media (max-width: 1020px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50; height: 100dvh; width: min(300px, 84vw);
    transform: translateX(-102%); transition: transform .3s var(--ease);
    background: rgba(14, 11, 26, .96); box-shadow: var(--shadow-3);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar__close { display: inline-flex; }
  .sidebar__close::after { content: '✕'; font-size: 15px; }
  .topbar__burger { display: inline-flex; }
  .topbar__burger::after { content: '☰'; font-size: 17px; }
  .main { padding: 12px 14px 90px; }
}

@media (max-width: 640px) {
  .topbar { top: 8px; padding: 9px 10px; gap: 9px; }
  .format-tabs { order: 3; flex-basis: 100%; }
  .btn--ask { padding: 0 13px; font-size: 13px; }
  .shelf__row { grid-auto-columns: minmax(228px, 84vw); }
  .lib-controls { margin-left: 0; width: 100%; }
  .books-grid { gap: 16px 11px; --card-min: 128px !important; }

  /* lecteur mobile : barre compacte, papier bord à bord, dock bas plein */
  .reader-bar { margin: 8px 8px 0; padding: 8px 10px; gap: 9px; }
  .reader-bar__progress { min-width: 48px; font-size: 12px; }
  .epub-host, .paper-page { inset: 8px 8px 76px; border-radius: 12px; }
  .pdf-host { inset: 8px 8px 116px; }
  .reader-nav { display: none; } /* navigation au tap/swipe sur mobile */
  .tools-rail { left: 8px; right: 8px; transform: none; bottom: 10px; justify-content: space-around; border-radius: 20px; overflow-x: auto; }
  .panel { top: 66px; bottom: 8px; width: calc(100vw - 16px); }
  .panel--left { left: 8px; } .panel--right { right: 8px; }
  .tts-dock { right: 8px; left: 8px; width: auto; bottom: 78px; }
  .toasts { bottom: 84px; }
}

/* mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
