/*
 * App web d'Inkarelle (inkarelle.com/app, docs/site.md) : la même app que sur le téléphone, mise en page pour un
 * ordinateur. Couleurs, polices et formes du design v2 (docs/design.md).
 *
 * Les jetons de couleur sont ceux de src/theme/colors.ts, sous leur nom en kebab-case (`textMuted` → --text-muted) :
 * un test (src/features/web/web-css.test.ts) vérifie qu'ils ont les mêmes valeurs, en clair et en sombre.
 */

@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/AtkinsonHyperlegibleNext_400Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/AtkinsonHyperlegibleNext_500Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/AtkinsonHyperlegibleNext_600SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/AtkinsonHyperlegibleNext_700Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Literata"; src: url("fonts/Literata_400Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Literata"; src: url("fonts/Literata_400Regular_Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }

/* ---------- Jetons (src/theme/colors.ts) ---------- */

:root {
  color-scheme: light;
  /* tokens:light */
  --background: #F0F0EE;
  --surface: #FFFFFF;
  --surface-inner: #F4F4F3;
  --border: #E2E3E5;
  --text: #16181D;
  --text-muted: #5E636B;
  --primary: #16181D;
  --on-primary: #FFFFFF;
  --primary-soft: #D3E2EE;
  --water: #4E86B4;
  --water-text: #3D6B91;
  --accent-blue: #DDE7EF;
  --on-accent-blue: #3E5A70;
  --accent-lilac: #E4E0EF;
  --on-accent-lilac: #5B4E80;
  --accent-sand: #F0E7D3;
  --on-accent-sand: #7A6337;
  --accent-blush: #F2E0D7;
  --on-accent-blush: #8A4E3C;
  --accent-green: #E7ECE3;
  --on-accent-green: #4E6647;
  --accent-sage: #DCE8DF;
  --on-accent-sage: #3D6352;
  --chart: #4E86B4;
  --chart-strong: #3D6B91;
  --track: #D3D5D9;
  /* accents:light (bookAccents) */
  --book-coral: #A65642;
  --book-blue: #4A6E8E;
  --book-sage: #4A7A5E;
  --book-lilac: #6F5F9E;
  --book-sand: #8A6E2F;
  --book-green: #577A4F;
  /* /tokens */
  --wash-body-opacity: 1;
  --wash-edge-opacity: 1;

  --font-ui: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-quote: "Literata", "Iowan Old Style", Georgia, serif;

  /* Tailles (src/theme/theme.ts) */
  --fs-overline: 12px;
  --fs-caption: 14px;
  --fs-secondary: 15px;
  --fs-body: 17px;
  --fs-subtitle: 19px;
  --fs-title: 32px;
  --r-small: 12px;
  --r-button: 18px;
  --r-card: 22px;
  --r-sheet: 28px;
  --r-pill: 999px;
  --touch: 48px;
  --ease: cubic-bezier(.33, 1, .68, 1);
  --nav-width: 248px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    /* tokens:dark */
    --background: #17191E;
    --surface: #23262C;
    --surface-inner: #2D3037;
    --border: #33373E;
    --text: #F3F2EF;
    --text-muted: #A6AAB2;
    --primary: #F3F2EF;
    --on-primary: #17191E;
    --primary-soft: #2E465B;
    --water: #9CC0DC;
    --water-text: #9CC0DC;
    --accent-blue: #304050;
    --on-accent-blue: #A9C3D4;
    --accent-lilac: #3D384F;
    --on-accent-lilac: #C3BAE0;
    --accent-sand: #443D2E;
    --on-accent-sand: #D9C49A;
    --accent-blush: #4A3833;
    --on-accent-blush: #E8A99A;
    --accent-green: #3A4236;
    --on-accent-green: #C2D4B4;
    --accent-sage: #33453A;
    --on-accent-sage: #A9C9B4;
    --chart: #9CC0DC;
    --chart-strong: #6890B4;
    --track: #3A3E46;
    /* accents:dark (bookAccents) */
    --book-coral: #E8A99A;
    --book-blue: #A9C3DC;
    --book-sage: #A9CDB2;
    --book-lilac: #C3B5E6;
    --book-sand: #E3CC94;
    --book-green: #C2D4B4;
    /* /tokens */
    --wash-body-opacity: .67;
    --wash-edge-opacity: .8;
  }
}

/* Même sombre, choisi à la main (réglage « inkarelle-theme » du site). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #17191E;
  --surface: #23262C;
  --surface-inner: #2D3037;
  --border: #33373E;
  --text: #F3F2EF;
  --text-muted: #A6AAB2;
  --primary: #F3F2EF;
  --on-primary: #17191E;
  --primary-soft: #2E465B;
  --water: #9CC0DC;
  --water-text: #9CC0DC;
  --accent-blue: #304050;
  --on-accent-blue: #A9C3D4;
  --accent-lilac: #3D384F;
  --on-accent-lilac: #C3BAE0;
  --accent-sand: #443D2E;
  --on-accent-sand: #D9C49A;
  --accent-blush: #4A3833;
  --on-accent-blush: #E8A99A;
  --accent-green: #3A4236;
  --on-accent-green: #C2D4B4;
  --accent-sage: #33453A;
  --on-accent-sage: #A9C9B4;
  --chart: #9CC0DC;
  --chart-strong: #6890B4;
  --track: #3A3E46;
  --book-coral: #E8A99A;
  --book-blue: #A9C3DC;
  --book-sage: #A9CDB2;
  --book-lilac: #C3B5E6;
  --book-sand: #E3CC94;
  --book-green: #C2D4B4;
  --wash-body-opacity: .67;
  --wash-edge-opacity: .8;
}

/* Couleur d'un livre : couverture générée (fond, encre), accent (barre de progression), lavis. */
.c-coral { --cover-bg: var(--accent-blush); --cover-ink: var(--on-accent-blush); --book: var(--book-coral); --wash: #E8A99A; --wash-edge: #A77A6F; }
.c-blue { --cover-bg: var(--accent-blue); --cover-ink: var(--on-accent-blue); --book: var(--book-blue); --wash: #A9C3DC; --wash-edge: #7A8C9E; }
.c-sage { --cover-bg: var(--accent-sage); --cover-ink: var(--on-accent-sage); --book: var(--book-sage); --wash: #A9CDB2; --wash-edge: #7A9480; }
.c-lilac { --cover-bg: var(--accent-lilac); --cover-ink: var(--on-accent-lilac); --book: var(--book-lilac); --wash: #C3B5E6; --wash-edge: #8C82A6; }
.c-sand { --cover-bg: var(--accent-sand); --cover-ink: var(--on-accent-sand); --book: var(--book-sand); --wash: #E3CC94; --wash-edge: #A3936B; }
.c-green { --cover-bg: var(--accent-green); --cover-ink: var(--on-accent-green); --book: var(--book-green); --wash: #C2D4B4; --wash-edge: #8C9982; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wash { --wash: #3E5266; --wash-edge: #3E5266; }
}
:root[data-theme="dark"] .wash { --wash: #3E5266; --wash-edge: #3E5266; }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.53;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
a.card, a.goal, a.current { text-decoration: none; color: inherit; }
a.card:hover { background: var(--surface); box-shadow: inset 0 0 0 2px var(--border); }
img { display: block; max-width: 100%; }

:focus-visible { outline: 2px solid var(--water); outline-offset: 3px; border-radius: 6px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 10;
  padding: 10px 16px; border-radius: var(--r-pill);
  background: var(--primary); color: var(--on-primary); text-decoration: none;
}
.skip:focus { top: 16px; }

.muted { color: var(--text-muted); }
.small { font-size: var(--fs-secondary); }
.caption { font-size: var(--fs-caption); }
.tabular { font-variant-numeric: tabular-nums; }
.quote-font { font-family: var(--font-quote); }

/* ---------- Coquille : barre de navigation et contenu ---------- */

.shell { display: flex; min-height: 100vh; }

.nav {
  position: sticky; top: 0;
  display: flex; flex-direction: column; gap: 4px;
  width: var(--nav-width); height: 100vh; flex: none;
  padding: 28px 16px;
  border-right: 1px solid var(--border);
}

.nav__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 24px;
  font-weight: 700; font-size: var(--fs-subtitle); text-decoration: none;
}
.nav__brand img { width: 28px; height: 28px; }

.nav__link {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--touch); padding: 0 14px;
  border-radius: var(--r-pill);
  color: var(--text-muted); text-decoration: none; font-weight: 500;
}
.nav__link svg { width: 22px; height: 22px; flex: none; }
.nav__link:hover { background: var(--surface); color: var(--text); }
.nav__link[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; }
.nav__spacer { flex: 1; }

.main {
  position: relative; isolation: isolate; overflow-x: clip;
  flex: 1; min-width: 0;
  padding: 40px clamp(16px, 4vw, 56px) 96px;
}
.main:focus { outline: none; }
.page { max-width: 1040px; margin: 0 auto; animation: fade .25s var(--ease) both; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .page, .toast { animation: none !important; transition: none !important; } }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .nav {
    position: fixed; inset: auto 0 0 0; z-index: 5;
    flex-direction: row; justify-content: space-around; gap: 0;
    width: auto; height: auto; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--border);
    background: var(--background);
  }
  .nav__brand, .nav__spacer { display: none; }
  .nav__link { flex-direction: column; gap: 2px; padding: 6px 4px; min-width: 56px; font-size: var(--fs-overline); justify-content: center; }
  .nav__link:hover, .nav__link[aria-current="page"] { background: none; }
  .nav__link[aria-current="page"] { color: var(--text); }
  .main { padding: 24px 16px 112px; }
}

/* Lavis d'aquarelle en haut d'un écran (deux images teintées, comme Wash dans l'app). Il s'étend sur toute la largeur
   du contenu, derrière lui, et ne reçoit aucun clic. */
.wash {
  position: absolute; z-index: -1; pointer-events: none;
  top: 0; left: 0; right: 0; height: 280px;
}
.wash::before, .wash::after {
  content: ""; position: absolute; inset: 0;
  -webkit-mask: url("img/wash-body.png") center / 100% 100% no-repeat;
  mask: url("img/wash-body.png") center / 100% 100% no-repeat;
  background: var(--wash, #A9C3DC);
  opacity: var(--wash-body-opacity);
}
.wash::after {
  -webkit-mask-image: url("img/wash-edge.png");
  mask-image: url("img/wash-edge.png");
  background: var(--wash-edge, #7A8C9E);
  opacity: var(--wash-edge-opacity);
}

/* ---------- En-têtes ---------- */

.header { margin-bottom: 28px; }
.header__over { color: var(--text-muted); font-size: var(--fs-secondary); margin-bottom: 4px; }
.title { font-size: var(--fs-title); line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.lead { margin-top: 8px; color: var(--text-muted); max-width: 60ch; }
.header--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.section-title { margin: 36px 0 12px; font-size: var(--fs-secondary); font-weight: 700; color: var(--text-muted); }
.section-title--row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--touch); height: var(--touch); margin-bottom: 16px;
  border-radius: 50%; background: var(--surface); color: var(--text); text-decoration: none;
}
.back svg { width: 22px; height: 22px; }

/* ---------- Tuiles ---------- */

.card { background: var(--surface); border-radius: var(--r-card); padding: 20px; }
.card--inner { background: var(--surface-inner); border-radius: var(--r-button); }
.grid { display: grid; gap: 16px; align-items: start; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }

.note-info { color: var(--text-muted); font-size: var(--fs-secondary); }
.note-info strong { color: var(--text); font-weight: 600; }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 28px;
  border: 0; border-radius: var(--r-pill);
  background: var(--surface); color: var(--text);
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: opacity .15s var(--ease);
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--tonal { background: var(--surface-inner); }
.btn--text { background: none; padding: 0 12px; color: var(--text-muted); font-weight: 500; }
.btn--compact { min-height: var(--touch); padding: 0 20px; font-size: var(--fs-secondary); }
.btn--block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--touch); height: var(--touch); flex: none;
  border: 0; border-radius: 50%; background: var(--surface-inner); color: var(--text); cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:disabled { opacity: .35; cursor: default; }

.link { color: var(--water-text); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Sélecteur à segments */
.seg {
  display: inline-flex; gap: 4px; padding: 4px;
  border-radius: var(--r-pill); background: var(--surface);
  max-width: 100%; overflow-x: auto;
}
.seg button {
  min-height: 40px; padding: 0 18px; border: 0; border-radius: var(--r-pill);
  background: none; color: var(--text-muted); font-weight: 500; font-size: var(--fs-secondary); cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); font-weight: 600; }

/* Pilules de filtre */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 40px; padding: 0 16px; border: 0; border-radius: var(--r-pill);
  background: var(--surface); color: var(--text); font-size: var(--fs-secondary); cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.chip__count { color: inherit; opacity: .7; font-variant-numeric: tabular-nums; }

/* ---------- Champs ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-caption); color: var(--text-muted); }
.input {
  height: 52px; padding: 0 16px;
  border: 2px solid transparent; border-radius: 14px;
  background: var(--surface); color: var(--text);
}
.input:focus { outline: none; border-color: var(--water); }
.input[aria-invalid="true"] { border-color: var(--on-accent-blush); }
.search {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 18px; border-radius: var(--r-pill); background: var(--surface);
}
.search svg { width: 20px; height: 20px; color: var(--text-muted); flex: none; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--touch); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

.error { padding: 12px 16px; border-radius: 14px; background: var(--accent-blush); color: var(--on-accent-blush); font-size: var(--fs-secondary); }
.banner { padding: 14px 18px; border-radius: var(--r-button); background: var(--primary-soft); color: var(--text); font-size: var(--fs-secondary); }

/* ---------- Connexion ---------- */

.login { position: relative; isolation: isolate; display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 48px 16px; }
.login__box { width: 100%; max-width: 440px; }
.login__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; font-weight: 700; text-decoration: none; }
.login__brand img { width: 32px; height: 32px; }
.login .title { font-size: 34px; }
.login form { margin-top: 28px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: var(--fs-caption); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login__help { margin-top: 28px; display: flex; flex-direction: column; gap: 10px; color: var(--text-muted); font-size: var(--fs-secondary); }

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

.cover {
  position: relative; overflow: hidden; flex: none;
  width: 96px; aspect-ratio: 2 / 3; border-radius: 10px;
  background: var(--cover-bg, var(--surface-inner)); color: var(--cover-ink, var(--text));
}
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.cover__gen { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 10%; }
.cover__title { font-family: var(--font-quote); font-size: 15px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.cover__author { font-weight: 700; font-size: 10px; letter-spacing: .04em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cover--sm { width: 44px; border-radius: 6px; }
.cover--sm .cover__title { font-size: 18px; text-align: center; }
.cover--lg { width: 148px; border-radius: 12px; }
.cover--lg .cover__title { font-size: 20px; }
.cover--lg .cover__author { font-size: 12px; }

/* ---------- Aujourd'hui ---------- */

.today-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.goal { display: flex; align-items: center; gap: 20px; }
.goal__big { font-size: 28px; font-weight: 700; line-height: 1.1; }
.goal__label { color: var(--text-muted); font-size: var(--fs-secondary); }

.ring { flex: none; }
.ring circle { fill: none; stroke-linecap: round; }

.current { display: flex; flex-direction: column; overflow: hidden; padding: 0; text-decoration: none; }
.current__band { display: flex; gap: 16px; align-items: center; padding: 18px 20px; background: var(--cover-bg); color: var(--cover-ink); }
.current__title { font-family: var(--font-quote); font-size: 22px; line-height: 1.2; }
.current__body { padding: 16px 20px 20px; }

.progress { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 3px; background: var(--book, var(--water)); }

/* ---------- Bibliothèque ---------- */

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px 20px; }
.book-tile { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; }
.book-tile .cover { width: 100%; border-radius: 12px; }
.book-tile .cover__title { font-size: 18px; }
.book-tile__title { font-weight: 600; line-height: 1.3; }
.book-tile__meta { color: var(--text-muted); font-size: var(--fs-caption); }
.book-tile:hover .cover { opacity: .92; }

.rows { display: flex; flex-direction: column; padding: 4px 0; }
.rows > a, .rows > div { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 10px 20px; text-decoration: none; color: inherit; }
.rows > * + * { border-top: 1px solid var(--border); }
.rows a:hover { background: var(--surface-inner); }
.rows__rank { width: 28px; flex: none; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rows__main { flex: 1; min-width: 0; }
.rows__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows__meta { color: var(--text-muted); font-size: var(--fs-caption); }
.rows__end { color: var(--text-muted); font-size: var(--fs-caption); flex: none; }

.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 28px; }
.empty .title { font-size: 26px; }

/* ---------- Fiche d'un livre ---------- */

.book-sheet { overflow: hidden; padding: 0; border-radius: var(--r-sheet); }
.book-sheet__top { display: flex; gap: 28px; align-items: flex-end; padding: 28px; background: var(--cover-bg); color: var(--cover-ink); flex-wrap: wrap; }
.book-sheet__title { font-family: var(--font-quote); font-size: var(--fs-title); line-height: 1.15; font-weight: 400; }
.book-sheet__by { margin-top: 6px; }
.book-sheet__by span + span::before { content: " · "; }
.book-sheet__bottom { padding: 20px 28px 24px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { padding: 16px 18px; border-radius: var(--r-button); background: var(--surface); }
.stat__value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat__label { color: var(--text-muted); font-size: var(--fs-caption); }

/* ---------- Notes ---------- */

.notes { display: flex; flex-direction: column; gap: 12px; }
.note { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; border-radius: var(--r-card); background: var(--surface); }
.note__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: var(--r-pill); background: var(--surface-inner); color: var(--text-muted); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.kind { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--fs-caption); font-weight: 600; }
.k-quote { background: var(--accent-sand); color: var(--on-accent-sand); }
.k-idea { background: var(--accent-blue); color: var(--on-accent-blue); }
.k-question { background: var(--accent-lilac); color: var(--on-accent-lilac); }
.k-definition { background: var(--accent-blush); color: var(--on-accent-blush); }
.note__quote { padding: 12px 14px; border-radius: 14px; font-family: var(--font-quote); font-size: 18px; line-height: 1.5; white-space: pre-wrap; }
.note__quote.k-quote, .note__quote.k-idea, .note__quote.k-question, .note__quote.k-definition { color: var(--text); }
.note__text { white-space: pre-wrap; }
.note__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { color: var(--text-muted); font-size: var(--fs-caption); }
.note__actions { display: flex; justify-content: flex-end; gap: 4px; margin: -4px -8px -6px 0; }
.note__actions .btn { min-height: 40px; }
mark { background: var(--primary-soft); color: inherit; border-radius: 3px; padding: 0 1px; }

.chapter { margin: 24px 0 10px; font-size: var(--fs-secondary); font-weight: 700; color: var(--text-muted); }
.book-group { margin-top: 28px; }
.book-group__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; text-decoration: none; color: inherit; }
.book-group__title { font-weight: 600; }

.toolbar { position: sticky; bottom: 16px; z-index: 2; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 28px; padding: 12px 12px 12px 20px; border-radius: var(--r-card); background: var(--surface); box-shadow: 0 6px 24px rgb(0 0 0 / .08); }
@media (max-width: 760px) { .toolbar { position: static; } }
.toolbar__options { display: flex; gap: 4px 16px; flex-wrap: wrap; align-items: center; color: var(--text-muted); font-size: var(--fs-secondary); }

/* ---------- Progrès ---------- */

.period { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.period__label { min-width: 180px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.big-number { font-size: 52px; font-weight: 600; line-height: 1.05; letter-spacing: -.01em; }
.figures { display: flex; flex-direction: column; margin-top: 16px; }
.figures > div { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--border); }
.figures dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.figures dt { color: var(--text-muted); }

.chart { display: block; width: 100%; height: auto; margin-top: 8px; }
.chart text { fill: var(--text-muted); font-size: 12px; font-family: var(--font-ui); }
.chart .is-current { fill: var(--text); font-weight: 700; }

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; max-width: 420px; }
.calendar__head { text-align: center; color: var(--text-muted); font-size: var(--fs-overline); }
.day { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 50%; font-size: var(--fs-caption); font-variant-numeric: tabular-nums; color: var(--text-muted); }
.day--reached { background: var(--primary-soft); color: var(--text); font-weight: 700; }
.day--hooked { border: 2px solid var(--water); color: var(--text); }
.day--today { border: 2px dashed var(--track); color: var(--text); }
.day--reached.day--is-today { box-shadow: inset 0 0 0 2px var(--text); }
.day--future { opacity: .45; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; color: var(--text-muted); font-size: var(--fs-caption); }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 50%; vertical-align: -1px; }

/* ---------- Divers ---------- */

.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 20;
  transform: translateX(-50%);
  padding: 12px 20px; border-radius: var(--r-pill);
  background: var(--primary); color: var(--on-primary); font-size: var(--fs-secondary);
  animation: fade .3s var(--ease) both;
}
@media (max-width: 760px) { .toast { bottom: 96px; } }

.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 60vh; color: var(--text-muted); }

.porthole { display: block; flex: none; }

.list-plain { margin: 0; padding: 0 0 0 20px; color: var(--text-muted); font-size: var(--fs-secondary); }
.list-plain li + li { margin-top: 6px; }

.footer-links { display: flex; gap: 8px 20px; flex-wrap: wrap; margin-top: 32px; font-size: var(--fs-caption); }
.footer-links a { color: var(--text-muted); }

@media print {
  .nav, .toolbar, .note__actions, .back { display: none !important; }
}
