/* AbracadaBook — feuille de style */
/* L'ambiance suit l'heure : html[data-light] = dawn | day | dusk | night (posé par app.js) */
:root {
  color-scheme: light;
  /* interface */
  --bg: #E6E3D3;
  --bar: rgba(236, 233, 220, .72);
  --paper: rgba(252, 251, 246, .88);
  --paper-line: rgba(255, 255, 255, .6);
  --surface: #FFFFFF;
  --surface-2: #F5F4EE;
  --ink: #1F2420;
  --muted: #5C6459;
  --line: #DAD8CB;
  --accent: #2F6B4F;
  --accent-ink: #FFFFFF;
  --accent-soft: #E0ECE2;
  --ok: #5A5596;
  --ok-soft: #E8E6F4;
  --danger: #B3261E;
  --spoiler: #E8E7DE;
  --shadow: 0 1px 2px rgba(40, 35, 20, .06), 0 6px 20px rgba(40, 35, 20, .08);
  /* décor */
  --wall: #E6E3D3; --wall2: #D8D3BC; --frame: #F6F3E8;
  --floor: #B08D6A; --floor2: #97754F; --rug: #C9A27E;
  --sky1: #8EC5E8; --sky2: #DCEFF6; --hill: #8FB39A; --hill2: #7AA387;
  --orb: #FFF3C4; --orb-x: 395px; --orb-y: 205px; --moon: 0;
  --stars: 0; --lamp: 0; --lights: .15;
  --beamc: #FFF7DA; --beamop: .45;
  --leaf1: #3E7A4D; --leaf2: #5C9A5E; --leaf3: #2D5C3D;
  --pot: #C8775A; --pot2: #B5664B; --wood: #8A6446; --shade: #EAD9B8;
  --wash: rgba(0, 0, 0, 0);
  --f-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-read: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
html[data-light="dawn"] {
  --bg: #EAD8CD; --bar: rgba(240, 224, 214, .72); --paper: rgba(255, 250, 246, .88); --surface: #FFFBF8;
  --wall: #EAD8CD; --wall2: #DCC5B6; --frame: #F8EFE8;
  --sky1: #F4B49A; --sky2: #C6D2EC; --hill: #A3A6BA; --hill2: #8E93AB;
  --orb: #FFE1B0; --orb-x: 150px; --orb-y: 440px;
  --beamc: #FFD9C4; --beamop: .35; --lights: .25;
  --wash: rgba(255, 160, 130, .07);
}
html[data-light="dusk"] {
  --bg: #D9B593; --bar: rgba(226, 196, 168, .74); --paper: rgba(255, 248, 239, .88); --surface: #FFFBF5;
  --wall: #D9B593; --wall2: #C89E7B; --frame: #F1E2D0; --floor: #8E6647; --floor2: #795539;
  --sky1: #5A4A8A; --sky2: #F29A62; --hill: #6C5970; --hill2: #574660;
  --orb: #FF9F5F; --orb-x: 430px; --orb-y: 450px;
  --beamc: #FFB374; --beamop: .5; --lamp: .55; --lights: .7;
  --wash: rgba(255, 120, 40, .09);
}
html[data-light="night"] {
  color-scheme: dark;
  --bg: #1B1F2E; --bar: rgba(22, 26, 40, .74); --paper: rgba(26, 30, 44, .88); --paper-line: rgba(255, 255, 255, .06);
  --surface: #232839; --surface-2: #2A3043; --ink: #ECE9E1; --muted: #A4A9B6; --line: #373D52;
  --accent: #8FCBA5; --accent-ink: #10251A; --accent-soft: #243A2E;
  --ok: #B7B2EC; --ok-soft: #2F2D4A; --danger: #F08A80; --spoiler: #2D3346;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .3);
  --wall: #262B3E; --wall2: #1F2335; --frame: #3A4058; --floor: #3B302D; --floor2: #2F2624; --rug: #4A3A3A;
  --sky1: #0B1030; --sky2: #2B3368; --hill: #1B2040; --hill2: #151935;
  --orb: #F2F0DF; --orb-x: 380px; --orb-y: 215px; --moon: 1;
  --stars: 1; --lamp: 1; --lights: 1;
  --beamc: #9DB0FF; --beamop: .12;
  --leaf1: #24462F; --leaf2: #33603F; --leaf3: #1A3526;
  --pot: #7A4A3A; --pot2: #6A3E31; --wood: #4E3A2C; --shade: #F3D29A;
  --wash: rgba(10, 14, 40, .2);
}
/* V1.6.2 : ambiance selon l'heure (maquettes validées par Max le 30/09, 22 h 50, AMBIANCES-PROPOSITION.md).
   Le jour, la répartition d'aujourd'hui (beige majoritaire, touches de vert) ; seule la teinte du « verre » (--glass : page,
   cartes, barres sur le décor photo) suit le moment ; texte secondaire et vert foncés d'un cran pour rester lisibles à 80 %.
   Le soir, le bleu nuit d'aujourd'hui ; après minuit (nuit profonde), la même nuit en plus doux. data-phase est posé par light.js. */
html[data-phase="aube"], html[data-phase="matin"], html[data-phase="midi"], html[data-phase="apres-midi"], html[data-phase="coucher"] { --muted: #414943; --accent: #285E45; }
html[data-phase="aube"] { --glass: #FBEFEA; }
html[data-phase="matin"] { --glass: #FAF8F0; }
html[data-phase="midi"] { --glass: #FCFBF6; }
html[data-phase="apres-midi"] { --glass: #FBF1E0; }
html[data-phase="coucher"] { --glass: #FBE7D8; }
html[data-phase="crepuscule"], html[data-phase="nuit"] { --glass: #1A1E2C; }
html[data-phase="nuit-profonde"] {
  --glass: #161720; --surface: #1C1D28; --surface-2: #232431;
  --ink: #D8D4CB; --muted: #A6A49D; --accent: #7DAE90; --accent-ink: #0F1F16; --accent-soft: #1F2E26;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.app-installed { touch-action: pan-x pan-y; } /* 1.6.3 (décision de Max, 02/10) : appli installée, pas de zoom au pincement ; le défilement reste */
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 15px/1.5 var(--f-ui);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
.dialog:focus { outline: none; } /* le focus posé sur la fenêtre elle-même (lecteurs d'écran, Échap) ne dessine pas de cadre */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; } /* lu par les lecteurs d'écran seulement */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
/* coupure des mots trop longs seulement là où un titre de membre peut arriver (V1.5.3) ; jamais sur les titres de page */
.notice .grow, .scard .grow { overflow-wrap: anywhere; }
/* 1.6.3 (audit du 01/10, 3.1 et 3.2) : dans une bannière ou une note de forum, le texte garde au moins 200 px et les boutons passent
   dessous s'il le faut ; avant, « flex: 1 » + « min-width: 0 » laissaient les boutons écraser le texte en colonne d'une lettre (320 px) */
.notice .grow, .compose-note .grow { flex: 1 1 200px; }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---------- Barre du haut ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bar);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.top-in {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
}
/* Police du nom du site : « Citadel of Blackrose » (BlackFridayFont), sous-ensemble latin, hébergée avec le site
   (font-src 'self'). Réservée au titre : trop calligraphique pour le texte courant. Licence : 2 € par projet, à
   acheter avant la V2.0 si elle est retenue au playtest (voir ROADMAP). */
@font-face { font-family: 'Citadel of Blackrose'; src: url('fonts/citadel-of-blackrose.woff') format('woff'); font-weight: 400; font-style: normal; font-display: swap; }
.brand {
  display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink);
  font: normal 400 27px/1 'Citadel of Blackrose', var(--f-read); letter-spacing: 0;
}
.brand svg { flex: none; width: 1.12em; height: 1.12em; } /* logo V1.6 : suit la taille du titre (en-tête, téléphone, connexion) */
/* logo V1.6 : couverture vert forêt, pages crème, or ; les couleurs suivent le moment de la journée (et les jours spéciaux) */
.brand { --logo-cover: #1F3D33; --logo-page: #FCFBF6; --logo-gold: #C9A86A; }
[data-light="dawn"] .brand { --logo-cover: #3B3148; --logo-page: #FFF6F0; --logo-gold: #C99A6A; }
[data-light="dusk"] .brand { --logo-cover: #4A2E1E; --logo-page: #FFF3E4; --logo-gold: #D9954A; }
[data-light="night"] .brand { --logo-cover: #ECE9E1; --logo-page: #2A3043; --logo-gold: #E0C284; }
.brand .lg-c { fill: var(--logo-cover); }
.brand .lg-p { fill: var(--logo-page); stroke: var(--logo-cover); }
.brand .lg-l { fill: none; stroke: var(--logo-cover); opacity: .45; }
.brand .lg-o { fill: var(--logo-gold); }
.brand svg path { transition: fill 2.5s ease, stroke 2.5s ease; }
.brand-link { text-decoration: none; color: inherit; }
.tools { display: flex; gap: 4px; flex-wrap: wrap; }
.tool {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 7px 12px; border-radius: 999px; display: inline-flex; gap: 7px; align-items: center;
}
.tool:hover { color: var(--ink); background: var(--surface-2); }
.tool[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.tool[aria-disabled="true"] { opacity: .45; cursor: default; }
.tool[aria-disabled="true"]:hover { background: none; color: var(--muted); }
.badge {
  background: var(--accent); color: var(--accent-ink); border-radius: 999px;
  font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-grid; place-items: center;
}
.me { margin-left: auto; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; }

main {
  width: calc(100% - 24px); max-width: 1080px; margin: 20px auto 48px; padding: 28px 24px 40px;
  background: var(--paper); border: 1px solid var(--paper-line); border-radius: 18px;
  backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: 0 12px 48px rgba(30, 25, 15, .14);
}
@media (max-width: 520px) { main { padding: 20px 14px 32px; margin-top: 12px; border-radius: 14px; } }

/* ---------- Décor photo : image du moment, fondu enchaîné ---------- */
#bg { position: fixed; inset: 0; z-index: -1; background: var(--wall); }
.bg-layer { position: absolute; inset: 0; background-size: cover; background-position: 36% center; opacity: 0; transition: opacity 2.5s ease; }
.bg-layer.show { opacity: 1; }
html[data-bg="photo"] #scene { display: none; }

/* V1.6.2 : page et barres à 80 %, cartes à 90 % (étaient 84 %, 92 %, 82 %), teintées selon le moment (--glass) */
html[data-bg="photo"] main { background: color-mix(in srgb, var(--glass, var(--surface)) 80%, transparent); }
html[data-bg="photo"] .card, html[data-bg="photo"] .person, html[data-bg="photo"] .stat, html[data-bg="photo"] .forum, html[data-bg="photo"] .sitem, html[data-bg="photo"] .badge-card { background: color-mix(in srgb, var(--glass, var(--surface)) 90%, transparent); }
html[data-bg="photo"] .top, html[data-bg="photo"] .tabbar { background: color-mix(in srgb, var(--glass, var(--surface)) 80%, transparent); }
html[data-bg="photo"] .login-card { background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
@media (prefers-reduced-motion: reduce) { .bg-layer { transition: none; } }

/* ---------- Décor : intérieur végétal ---------- */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; pointer-events: none; }
#scene .f-wall { fill: var(--wall); } #scene .f-wall2 { fill: var(--wall2); } #scene .f-frame { fill: var(--frame); }
#scene .f-floor { fill: var(--floor); } #scene .st-floor { stroke: var(--floor2); stroke-width: 3; fill: none; }
#scene .f-rug { fill: var(--rug); } #scene .f-hill { fill: var(--hill); } #scene .f-hill2 { fill: var(--hill2); }
#scene .s-sky1 { stop-color: var(--sky1); } #scene .s-sky2 { stop-color: var(--sky2); } #scene .s-beam { stop-color: var(--beamc); }
#scene .orb { transform: translate(var(--orb-x), var(--orb-y)); } #scene .f-orb { fill: var(--orb); }
#scene .moonshade { fill: var(--sky1); opacity: var(--moon); } #scene .stars { fill: #FFFFFF; opacity: var(--stars); }
#scene .beam { opacity: var(--beamop); } #scene .glow { opacity: var(--lamp); } #scene .bulb { fill: #FFD27A; opacity: var(--lights); }
#scene .f-l1 { fill: var(--leaf1); } #scene .f-l2 { fill: var(--leaf2); } #scene .f-l3 { fill: var(--leaf3); }
#scene .st-stem { stroke: var(--leaf3); stroke-width: 4; fill: none; stroke-linecap: round; }
#scene .st-vine { stroke: var(--leaf3); stroke-width: 2.5; fill: none; }
#scene .slit { stroke: var(--wall); stroke-width: 5; stroke-linecap: round; }
#scene .f-pot { fill: var(--pot); } #scene .f-pot2 { fill: var(--pot2); } #scene .f-wood { fill: var(--wood); }
#scene .st-wood { stroke: var(--wood); stroke-width: 2; } #scene .f-shade { fill: var(--shade); }
#scene .wash { fill: var(--wash); }
#scene .sway { transform-origin: 170px 0; animation: sway 7s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-1.2deg); } to { transform: rotate(1.2deg); } }

/* ---------- Titres de page ---------- */
.page-head { display: flex; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font: 600 30px/1.1 var(--f-read); letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head > .grow { flex: 1 1 240px; } /* titre et sous-titre gardent leur largeur : les boutons passent dessous sur téléphone */
.sec-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 28px 0 12px; }
.sec-title:first-child { margin-top: 0; }

/* ---------- Boutons, champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.danger { color: var(--danger); background: transparent; border-color: transparent; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.linkbtn { background: none; border: 0; padding: 6px 4px; margin: -6px -4px; color: var(--muted); font-size: 12px; min-height: 32px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
@media (hover: hover) { .linkbtn:hover { color: var(--danger); } } /* écran tactile : pas de survol collant sur le bouton suivant */
.linkbtn[data-armed] { color: var(--danger); font-weight: 600; text-decoration: none; }

.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 14px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 600; font-size: 13px; padding: 0; margin-bottom: 2px; }
input[type="text"], input[type="email"], input[type="number"], input:not([type]), input[type="search"], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 8px; padding: 9px 11px; min-width: 0;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check, .radio { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); }
.radio { align-items: flex-start; }
.radio input { margin-top: 3px; }
.choices { display: grid; gap: 8px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }

/* ---------- Pastilles ---------- */
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.reading { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.paused { background: #F3E7C9; color: #7A5A12; border-color: transparent; }
.pill.dropped { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
html[data-light="night"] .pill.paused { background: #4A3B18; color: #F2D48A; }
.pill.priv { border-style: dashed; }
.pill.visit { background: var(--surface-2); color: var(--ink); border-color: transparent; font-style: italic; } /* V1.6 : visiteur d'une lecture publique */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Avatars ---------- */
.av {
  --c: #7B2D5B;
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: var(--c); color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
}
.av.lg { width: 44px; height: 44px; font-size: 18px; }
/* icône de profil (V1.6) : au trait, blanche, 62 % du rond */
.av svg { width: 62%; height: 62%; display: block; }
/* profil : choix de la couleur et de l'icône (aperçu dans la couleur choisie : --pc) */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; display: inline-grid; cursor: pointer; border-radius: 50%; }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch .av { width: 40px; height: 40px; font-size: 16px; transition: box-shadow .15s; }
.swatch .av.pc { background: var(--pc, #7B2D5B); }
.swatch input:checked + .av { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.swatch input:focus-visible + .av { outline: 2px solid var(--accent); outline-offset: 5px; }
.swatches.icons { gap: 8px 8px; }
.swatch-fam { flex-basis: 100%; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.swatch-fam:first-child { margin-top: 0; }
fieldset[disabled] .swatch { cursor: not-allowed; opacity: .5; }
.avs { display: inline-flex; }
.avs .av { box-shadow: 0 0 0 2px var(--surface); }
.avs .av + .av { margin-left: -6px; }

/* ---------- Couvertures générées ----------
   Une couverture = un style (data-style) + une couleur (--cloth, --cloth2, --ink-c).
   Styles : cloth (toile), leather (cuir doré), band (broché à bande), stripes (poche rayé), stars (constellations), deco (art déco). */
.cover {
  --cloth: #264A41; --cloth2: #1B352F; --gold: #D9B96A; --ink-c: #F3EEE4;
  position: relative; aspect-ratio: 2 / 3; width: 100%; max-width: 100%;
  border-radius: 3px 7px 7px 3px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.32) 0, rgba(255,255,255,.10) 4%, rgba(0,0,0,0) 8%, rgba(0,0,0,0) 94%, rgba(0,0,0,.12) 100%),
    var(--cloth);
  color: var(--ink-c); box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 16% 12% 12% 16%; overflow: hidden;
}
.cover::after { content: ""; position: absolute; inset: 7px 7px 7px 11px; border: 1px solid rgba(243,238,228,.28); border-radius: 2px; pointer-events: none; }
.cover::before { content: ""; position: absolute; inset: 0; pointer-events: none; }
.c-title { position: relative; font: italic 600 clamp(14px, 2.2vw, 19px)/1.15 var(--f-read); overflow-wrap: anywhere; hyphens: auto; -webkit-hyphens: auto; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.c-author { position: relative; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; opacity: .8; overflow-wrap: anywhere; }
.ribbon { position: absolute; top: 0; right: 16%; width: 11px; height: 30%; background: #C0487F; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%); z-index: 1; }

/* couverture officielle : photo du catalogue, titre caché sauf si l'image manque */
.cover.photo { background: var(--surface-2); padding: 0; }
.cover.photo::after { border-color: rgba(0,0,0,.15); }
.cover.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover.photo .c-title, .cover.photo .c-author { display: none; }
.cover.photo.broken { --cloth: #264A41; background: var(--cloth); padding: 16% 12% 12% 16%; }
.cover.photo.broken img { display: none; }
.cover.photo.broken .c-title { display: -webkit-box; } .cover.photo.broken .c-author { display: block; }
.cover.photo.broken.sm .c-author, .cover.photo.broken.xs .c-author { display: none; }
.cover-pick .cover.photo .c-title { display: none; }

/* cuir : grain + double filet doré, titre doré */
.cover[data-style="leather"] { color: var(--gold); background: linear-gradient(90deg, rgba(0,0,0,.4) 0, rgba(255,255,255,.08) 4%, rgba(0,0,0,0) 8%, rgba(0,0,0,0) 94%, rgba(0,0,0,.15) 100%), radial-gradient(circle at 30% 20%, rgba(255,255,255,.08), transparent 60%), var(--cloth2); }
.cover[data-style="leather"]::after { inset: 6px 6px 6px 10px; border: 2px double var(--gold); opacity: .8; }
.cover[data-style="leather"], .cover[data-style="deco"] { padding-left: 11%; padding-right: 8%; }
.cover[data-style="leather"] .c-title { font-style: normal; text-transform: uppercase; letter-spacing: .02em; font-size: clamp(10px, 1.5vw, 13px); text-align: center; overflow-wrap: anywhere; hyphens: auto; -webkit-hyphens: auto; }
.cover[data-style="leather"] .c-author { text-align: center; }
/* broché à bande : fond clair, bande de couleur, titre sombre */
.cover[data-style="band"] { background: linear-gradient(90deg, rgba(0,0,0,.18) 0, rgba(255,255,255,.2) 4%, transparent 8%), #F1EBDD; color: #23201A; }
.cover[data-style="band"]::before { display: none; }
.cover[data-style="band"] { justify-content: flex-start; padding-top: 22%; }
.cover[data-style="band"]::after { border-color: rgba(0,0,0,.12); }
.cover[data-style="band"] .c-title { color: #FBF8F0; font-style: normal; font-weight: 700; margin: 0 -12% 0 -16%; padding: 9% 12% 9% 16%; background: var(--cloth); min-height: 30%; display: flex; align-items: center; box-sizing: border-box; -webkit-line-clamp: unset; }
.cover[data-style="band"] .c-author { margin-top: auto; }
.cover.sm[data-style="band"] .c-title, .cover.xs[data-style="band"] .c-title { margin: 0 -8px 0 -11px; padding: 6px 8px 6px 11px; }
.cover.xs[data-style="band"] .c-title { margin: 0 -5px 0 -8px; padding: 4px 5px 4px 8px; }
.cover[data-style="band"] .c-author { color: #4A443A; }
/* rayures : rayures diagonales fines, titre sur cartouche */
.cover[data-style="stripes"] { background: linear-gradient(90deg, rgba(0,0,0,.3) 0, rgba(255,255,255,.1) 4%, transparent 8%), repeating-linear-gradient(135deg, var(--cloth) 0 10px, var(--cloth2) 10px 20px); }
.cover[data-style="stripes"] .c-title { background: rgba(20,16,12,.55); padding: 5px 6px; font-size: clamp(13px, 2vw, 17px); border-radius: 3px; font-style: normal; align-self: flex-start; max-width: 100%; }
.cover[data-style="stripes"] .c-author { background: rgba(20,16,12,.45); padding: 3px 6px; border-radius: 3px; align-self: flex-start; }
/* constellations : nuit profonde, étoiles, titre fin */
.cover[data-style="stars"] { background: linear-gradient(90deg, rgba(0,0,0,.35) 0, rgba(255,255,255,.08) 4%, transparent 8%), radial-gradient(circle at 70% 25%, var(--cloth) 0, var(--cloth2) 70%); }
.cover[data-style="stars"]::before { background:
  radial-gradient(circle at 20% 18%, #fff 0 1.2px, transparent 2px), radial-gradient(circle at 76% 12%, #fff 0 1px, transparent 2px),
  radial-gradient(circle at 60% 32%, #fff 0 1.4px, transparent 2.4px), radial-gradient(circle at 34% 44%, #fff 0 .9px, transparent 1.8px),
  radial-gradient(circle at 82% 52%, #fff 0 1.1px, transparent 2px), radial-gradient(circle at 24% 70%, #fff 0 1px, transparent 2px),
  radial-gradient(circle at 66% 78%, #fff 0 1.3px, transparent 2.2px), radial-gradient(circle at 48% 90%, #fff 0 .9px, transparent 1.8px),
  radial-gradient(circle at 88% 86%, #fff 0 1px, transparent 2px); opacity: .85; }
.cover[data-style="stars"] .c-title { font-weight: 400; letter-spacing: .02em; }
/* art déco : éventail doré en haut, titre centré capitales */
.cover[data-style="deco"] { color: var(--gold); background: linear-gradient(90deg, rgba(0,0,0,.35) 0, rgba(255,255,255,.08) 4%, transparent 8%), var(--cloth2); }
.cover[data-style="deco"]::before { background:
  repeating-conic-gradient(from 240deg at 50% -10%, var(--gold) 0 3deg, transparent 3deg 12deg);
  -webkit-mask: linear-gradient(180deg, #000 0 28%, transparent 46%); mask: linear-gradient(180deg, #000 0 28%, transparent 46%); opacity: .5; }
.cover[data-style="deco"]::after { border: 1px solid var(--gold); inset: 6px 6px 6px 10px; opacity: .7; }
.cover[data-style="deco"] .c-title { font-style: normal; text-transform: uppercase; letter-spacing: .02em; text-align: center; font-weight: 700; font-size: clamp(10px, 1.5vw, 13px); overflow-wrap: anywhere; hyphens: auto; -webkit-hyphens: auto; margin-top: 34%; background: var(--cloth2); padding: 6px 5px; box-shadow: 0 0 0 1px var(--gold); align-self: center; max-width: 100%; }
.cover[data-style="deco"] .c-author { text-align: center; }

.cover.sm { width: 64px; padding: 10px 8px 8px 11px; }
.cover.sm .c-title { font-size: 10px !important; -webkit-line-clamp: 4; padding: 2px 4px; }
.cover.sm .c-author, .cover.xs .c-author { display: none; }
.cover.sm::after, .cover.xs::after { inset: 3px 3px 3px 6px; }
.cover.xs { width: 44px; padding: 6px 5px 5px 8px; }
.cover.xs .c-title { font-size: 8px !important; -webkit-line-clamp: 4; padding: 1px 3px; }
.cover.xs[data-style="deco"] .c-title, .cover.sm[data-style="deco"] .c-title { margin-top: 20%; }
.cover.md { width: 120px; }

/* grille de choix de couverture */
.cover-pick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cover-pick label { position: relative; cursor: pointer; display: block; }
.cover-pick input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.cover-pick .cover { width: 100%; padding: 12% 10% 10% 14%; }
.cover-pick .cover .c-title { font-size: 8px !important; -webkit-line-clamp: 3; }
.cover-pick .cover .c-author { display: none; }
.cover-pick input:checked + .cover { outline: 3px solid var(--accent); outline-offset: 2px; }
.cover-pick input:focus-visible + .cover { outline: 3px solid var(--accent); outline-offset: 2px; }
.cover-pick .auto { aspect-ratio: 2 / 3; border: 2px dashed var(--line); border-radius: 6px; display: grid; place-items: center; text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px; }
.cover-pick input:checked + .auto { outline: 3px solid var(--accent); outline-offset: 2px; color: var(--ink); }
.pick-styles { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---------- Grille de livres ---------- */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 28px 20px; }
.book { display: grid; gap: 10px; align-content: start; min-width: 0; }
/* 1.6.3 (audit QA 1, 4, 5) : un titre ou une note sans espace (adresse web collée) ne doit jamais élargir la page : repli partout
   où un texte de membre arrive hors des cartes de collection (envies en grille, liste « Ma collection » de Nouvelle lecture, en-tête des feuilles) */
.book .si-title, .book .si-meta, .book > p, .catalog-item, .catalog-item strong, .catalog-item span, .sheet-book, .sheet-book .grow { overflow-wrap: anywhere; min-width: 0; }
.b-title { font: 600 16px/1.25 var(--f-read); overflow-wrap: anywhere; }
.b-author { color: var(--muted); font-size: 13px; }
.b-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.b-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bar { --c: var(--accent); height: 6px; border-radius: 999px; background: var(--line); position: relative; overflow: visible; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: 999px; }
.bar.lg { height: 8px; }
.bar .thr { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .5; border-radius: 1px; }

/* ---------- Cartes génériques ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.empty { text-align: center; padding: 40px 20px; border: 1px dashed var(--line); border-radius: 12px; display: grid; gap: 10px; justify-items: center; color: var(--muted); }
.empty h2 { font: 600 20px/1.2 var(--f-read); color: var(--ink); }
.empty p { max-width: 46ch; }
.notice { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; font-size: 14px; }

/* ---------- Accueil ---------- */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "main side"; gap: 32px; align-items: start; }
.home-main { grid-area: main; min-width: 0; }
.home-side { grid-area: side; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; min-width: 0; } /* titre très long : la colonne ne s'élargit pas */
@media (max-width: 860px) { .home { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "main"; } }
.people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.person { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.person-top { display: flex; gap: 8px; align-items: center; }
/* Choisir avec qui lire : champ avec autocomplétion (V1.5.4) */
.pp { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-chips:empty { display: none; }
.pp-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 2px 3px 4px; font-weight: 600; font-size: 14px; }
.pp-chip > span:not(.av) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-x { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.pp-x:hover, .pp-x:focus-visible { background: var(--line); color: var(--ink); }
.pp-sugg { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.pp-opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; }
.pp-opt:hover, .pp-opt:focus-visible { background: var(--surface-2); }
.pp-opt[disabled] { opacity: .55; cursor: not-allowed; }
.pp-opt .small { flex: none; }
.pp-none { padding: 8px; }
.people-more .btn { width: 100%; justify-content: center; }
.feed-more { display: flex; margin: 10px auto 0; }
.pr { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
.pr-top { display: flex; gap: 8px; align-items: baseline; }
.pr-title { flex: 1; min-width: 0; font: 600 14px/1.3 var(--f-read); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed li:last-child { border-bottom: 0; }
.feed p { min-width: 0; overflow-wrap: anywhere; }
.feed a { color: inherit; font-weight: 600; }
.newform { max-width: 620px; }
.choices.cols { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.sitem-link { color: inherit; text-decoration: none; overflow-wrap: anywhere; }
/* V1.6.2 (retour de Max) : toucher n'importe où sur la carte d'une lecture l'ouvre (lien étiré) ; boutons et liens restent au-dessus */
.sitem, .scard { position: relative; }
.sitem .sitem-link::after, .scard .sitem-link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.sitem button, .sitem a:not(.sitem-link), .scard button, .scard a:not(.sitem-link), .sitem .sitem-acts, .scard .b-actions { position: relative; z-index: 1; }
.sitem-link:hover { text-decoration: underline; }

/* ---------- Liste des lectures ---------- */
.slist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.sitem { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: inherit; flex-wrap: wrap; }
a.sitem:hover { border-color: var(--muted); }
.sitem-main { flex: 1 1 220px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.sitem-main strong { font: 600 16px/1.25 var(--f-read); overflow-wrap: anywhere; }
.sitem-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.sitem-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.minibars { display: grid; gap: 4px; width: 140px; flex: none; }
.minibars .bar { height: 4px; }
@media (max-width: 560px) { .minibars { width: 100%; } }

/* ---------- Vue lecture (forum) ---------- */
.back { display: inline-flex; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.sv-grid { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 820px) { .sv-grid { grid-template-columns: minmax(0, 1fr); } }
.sv-side { display: grid; gap: 16px; }
.sv-head { display: flex; gap: 14px; }
.sv-head h1 { font: 600 22px/1.2 var(--f-read); overflow-wrap: anywhere; }
.sv-head-txt { display: grid; gap: 6px; align-content: start; min-width: 0; }
.sv-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.panel-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.mine-row { display: flex; gap: 8px; align-items: center; }
.mine-row input[type="number"] { width: 96px; }
.mine-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.lanes { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 14px; }
.lane { display: grid; gap: 6px; }
.lane-top { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.lane-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.forum { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-height: 420px; }
.forum-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.forum-head h2 { font: 600 18px/1.2 var(--f-read); }
.msgs { flex: 1; overflow-y: auto; max-height: min(62vh, 640px); padding: 8px 16px; display: grid; gap: 2px; align-content: start; }
.msg { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.msg:last-child { border-bottom: 0; }
.m-body { min-width: 0; flex: 1; display: grid; gap: 4px; }
.m-meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.m-text { font: 16px/1.55 var(--f-read); white-space: pre-wrap; overflow-wrap: anywhere; }
.ptag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.ptag.gen { font-weight: 600; }
.spoiler {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; color: var(--muted);
  background: repeating-linear-gradient(135deg, var(--spoiler) 0 8px, transparent 8px 16px), var(--surface-2);
  border: 1px dashed var(--line);
}
.msgs-empty { color: var(--muted); padding: 30px 0; text-align: center; }
.compose { border-top: 1px solid var(--line); padding: 12px 16px 14px; display: grid; gap: 8px; }
.compose textarea { min-height: 64px; }
.compose-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.compose-row select { width: auto; flex: 1 1 180px; }
.compose-row input[type="number"] { width: 90px; }
.compose-hint { margin: 8px 0 0; }
.rate-note { margin: 12px 0 0; }
.rate-note label { font-size: 13px; font-weight: 600; }
.rate-note textarea { width: 100%; min-height: 60px; }
/* 1.6.3 (retour de Max, 02/10 : bouton mal placé) : « Enregistrer la note » prend la forme des actions de la fiche, collé sous la note, en vert ;
   il n'apparaît que quand la note a changé. Les actions de la fiche gardent 16 px d'air sous la note (audit 3.3). */
.rate-note-act { margin-top: 8px; }
.rate-note-act:has(button[hidden]) { display: none; }
.rate-note ~ .acts:not(.rate-note-act) { margin-top: 16px; }
.track-more { margin-top: 10px; }
.compose-note { padding: 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 14px; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px; box-shadow: var(--shadow); display: grid; gap: 16px; }
.login-card .brand { font-size: 36px; }
.login-card h1 { font: 600 20px/1.25 var(--f-read); }
.code-input { font: 600 24px/1 var(--f-ui) !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.err { color: var(--danger); font-size: 14px; }
.login-note { background: var(--accent-soft); color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.login-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }

/* ---------- Fenêtre modale ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 14, 20, .5); z-index: 50; display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; padding: 22px; box-shadow: var(--shadow); }
.dialog h2 { font: 600 21px/1.2 var(--f-read); margin-bottom: 16px; }
.m-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .row2 { grid-template-columns: 1fr; }
  .books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .page-head h1 { font-size: 25px; }
  .me span.me-name { display: none; }
  .tool span:not(.badge) { display: none; }
  .tool { padding: 8px 10px; }
  .top-in { flex-wrap: nowrap; }
  .brand { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- Mobile d'abord (80 % des visites) ---------- */
input, select, textarea { font-size: 16px; } /* évite le zoom automatique d'iOS */
.av.sm { width: 24px; height: 24px; font-size: 11px; }
.tabbar, .seg { display: none; }
details.track > summary { cursor: pointer; list-style-position: inside; }
details.track > summary::-webkit-details-marker { color: var(--muted); }
details.track:not([open]) > summary { margin-bottom: 0; }
.sum-note { text-transform: none; letter-spacing: 0; font-weight: 600; }
details.track[open] .sum-note { display: none; }

@media (max-width: 820px) {
  /* V1.6.2 (retour de Max) : le bandeau (logo et nom de l'appli) reste en haut quand on fait défiler (il était « static »).
     Relecture de Fable (01/10, 1 h 45, capture de Max en prod) : en « sticky », l'appli installée sur iPhone ouvrait la page en position
     de rebond (bandeau et contenu descendus d'un bloc jusqu'au premier défilement, barre du bas bien placée) ; le bandeau est donc en
     « fixed », comme la barre du bas, éprouvée. Le corps réserve sa hauteur (44 px + zone d'encoche). */
  .top { position: fixed; top: 0; left: 0; right: 0; z-index: 10; background: var(--bar); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px) saturate(1.1); -webkit-backdrop-filter: blur(12px) saturate(1.1); }
  .top .tools, .top .me { display: none; }
  .top-in { padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 10px; }
  .top { padding-top: 0; }
  body { padding-top: var(--top-h, calc(45px + env(safe-area-inset-top, 0px))); padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); } /* --top-h : hauteur réelle du bandeau (app.js), plus haut pendant une fête */
  body[data-route="session"] { padding-top: 0; } /* le bandeau y est masqué (plus bas) */
  body.typing .top { position: absolute; } /* clavier ouvert (Nouvelle lecture, profil) : iOS déplace les éléments fixes, le bandeau suit la page à la place */
  body[data-route="home"] main { margin-top: 36px; }
  body.typing { padding-bottom: 0; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--bar); border-top: 1px solid var(--line);
    backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .tabbar > a, .tabbar > span, .tabbar > button {
    flex: 1; position: relative; min-height: 52px; border-radius: 12px; border: 0; background: transparent; font-family: inherit; cursor: pointer; padding: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar > a, .tabbar > span, .tabbar > button { font-size: 12px; } /* 1.6.3 (audit 2.1) : 12 px minimum */
  #toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } /* 1.6.3 (audit 4.3) : au-dessus de la barre du bas, qui reste touchable */
  body.typing #toast { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  /* 1.6.3 (audit 2.3, 2.4) : au coucher du soleil, le vert actif de la barre et le mot « Bronze » passaient juste sous 4,5:1 sur le verre abricot */
  .tabbar [aria-current="page"] { color: var(--accent); }
  html[data-phase="coucher"] .tabbar [aria-current="page"] { color: #224F3A; }
  .tabbar [aria-current="page"] .av { box-shadow: 0 0 0 2px var(--accent); }
  .tabbar [aria-disabled="true"] { opacity: .4; }
  .tabbar .badge { position: absolute; top: 4px; left: calc(50% + 5px); }
  .tabbar > button.lire i { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink, #fff); margin-top: -22px; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); border: 3px solid var(--surface); }
  .tabbar > button.lire span { color: var(--accent); font-weight: 700; }
  .tabbar > button.lire.on i { animation: breathe 2.4s ease-in-out infinite; }
  body.timer-on:not(.timer-open) main { padding-bottom: 150px; }
  body.timer-on:not(.timer-open) #sv-compose { bottom: calc(134px + env(safe-area-inset-bottom, 0px)); }
  body.typing #timer .mini { display: none; }
  body.typing .tabbar { display: none; }

  .seg { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 18px; }
  .seg button { flex: 1; border: 0; background: transparent; min-height: 40px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
  .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
  .home[data-tab="feed"] .home-main, .home[data-tab="books"] .home-side, .home[data-tab="sessions"] .home-main { display: none; }
  .home[data-tab="feed"] .home-sessions, .home[data-tab="sessions"] .home-now, .home[data-tab="sessions"] .home-feed { display: none; }

  .forum { min-height: 0; }
  .msgs { max-height: none; overflow: visible; padding: 4px 14px; }
  #sv-compose { position: sticky; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); z-index: 5; }
  body.typing #sv-compose { bottom: 0; }
  .compose { background: var(--surface); border-radius: 0 0 12px 12px; box-shadow: 0 -8px 18px rgba(0, 0, 0, .08); padding: 10px 12px; gap: 8px; }
  .compose > label, .compose-row > label, .compose-hint { display: none; }
  .compose textarea { min-height: 46px; height: 46px; }
  .compose textarea:focus, .compose textarea:not(:placeholder-shown) { height: 96px; } /* V1.6.2 : pas de saut tant qu'un brouillon est là */

  .btn.sm, .chip { min-height: 36px; }
  .overlay { align-items: end; padding: 0; }
  .dialog { border-radius: 18px 18px 0 0; max-height: 92vh; max-height: 92dvh; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
}
.sv-card { display: grid; gap: 14px; }
.launched { flex-basis: 100%; }
.more > summary { list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more[open] > summary { background: var(--surface-2); color: var(--ink); }
.more-menu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.more { flex-basis: auto; }
@media (max-width: 820px) {
  .sv-side { gap: 10px; }
  .sv-side .card { padding: 12px 14px; }
  .sv-card { gap: 10px; }
  .sv-head { gap: 12px; align-items: center; }
  .sv-head .cover.sm { width: 46px; padding: 7px 6px 6px 9px; }
  .sv-head .cover.sm .c-title { font-size: 8px; }
  .sv-head h1 { font-size: 19px; }
  .sv-head-txt { gap: 4px; }
  .more[open] { flex-basis: 100%; }
  #pg-range { display: none; }
  .mine-quick { margin-top: 8px; }
  .panel-title { margin-bottom: 8px; }
  details.track:not([open]) { padding-block: 10px; }
  .back { margin-bottom: 10px; }
}
@media (max-width: 820px) {
  body[data-route="session"] .top, body[data-route="session"] .back { display: none; }
  body[data-route="session"] main { margin-top: 10px; }
  .sv-card { position: relative; }
  .sv-card .sv-head-txt { padding-right: 44px; }
  .more-btn { position: absolute; top: 8px; right: 8px; letter-spacing: 1px; }
  .launched { display: none; }
  #sv-mine .panel-title { display: none; }
  #sv-mine .mine-row label { display: none; }
  #sv-mine .mine-row input[type="number"] { width: 84px; }
}

/* ---------- V1.1 : profils, badges, streaks ---------- */
.person-top { text-decoration: none; color: inherit; }
a.person-top:hover strong { text-decoration: underline; }
.feed-av, .feed-name { text-decoration: none; color: inherit; }
.feed-name:hover { text-decoration: underline; }
.streak { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--muted); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.streak.hot { color: #9A4414; border-color: transparent; background: #FBE7D6; } /* contraste AA (5,4:1) */
html[data-light="night"] .streak.hot { color: #FFB27A; background: #4A2E1E; }
.member-head { align-items: center; }
.friend-top { display: flex; gap: 12px; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.stat b { font: 600 24px/1.1 var(--f-read); }
.stat span { font-size: 12px; color: var(--muted); }
.badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.badge-card { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.badge-card > div { display: grid; gap: 2px; min-width: 0; }
.badge-card strong { font-size: 15px; }
.badge-card .tier { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.badge-card.locked .badge-ic { opacity: .5; } /* 1.6.3 (audit 2.2) : seul l'hexagone est grisé ; le texte « dès 500 » reste lisible (était toute la carte à .55 : 2,7:1) */
.badge-card.locked .tier { color: var(--muted); }
.badge-card.locked .badge-ic .hex { fill: var(--line); } .badge-card.locked .badge-ic .hex2 { fill: var(--surface-2); } .badge-card.locked .badge-ic .glyph { fill: var(--muted); }
.badge-card.t1 .tier { color: #9A5B2C; } .badge-card.t2 .tier { color: #5E6670; } .badge-card.t3 .tier { color: #8A6508; } .badge-card.t4 .tier { color: #2E7179; } .badge-card.t5 .tier { color: #1A7248; } .badge-card.t6 .tier { color: #4A5CC4; } .badge-card.t7 .tier { color: #2A2A36; }
/* niveaux de badge lisibles la nuit (contraste AA, V1.5.5) */
html[data-light="dusk"] .badge-card.t1 .tier { color: #8A4F24; }
html[data-light="night"] .badge-card.t1 .tier { color: #D49A6A; } html[data-light="night"] .badge-card.t2 .tier { color: #B4BCC6; } html[data-light="night"] .badge-card.t3 .tier { color: #E0B84A; } html[data-light="night"] .badge-card.t4 .tier { color: #6FC3CB; } html[data-light="night"] .badge-card.t5 .tier { color: #6FD6A0; } html[data-light="night"] .badge-card.t6 .tier { color: #9AA8F0; } html[data-light="night"] .badge-card.t7 .tier { color: #D8D8E8; }

/* médaillons : hexagone métal + glyphe */
.badge-ic { flex: none; vertical-align: middle; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.badge-ic .hex { fill: #8A6A4A; } .badge-ic .hex2 { fill: #C08A5A; } .badge-ic .glyph { fill: #FFF3E3; }
.badge-ic.t1 .hex { fill: #7A4E2A; } .badge-ic.t1 .hex2 { fill: #C48A5B; } .badge-ic.t1 .glyph { fill: #FFF2E0; }
.badge-ic.t2 .hex { fill: #6B7280; } .badge-ic.t2 .hex2 { fill: #C9CED6; } .badge-ic.t2 .glyph { fill: #2B2F36; }
.badge-ic.t3 .hex { fill: #A67C0F; } .badge-ic.t3 .hex2 { fill: #F1C548; } .badge-ic.t3 .glyph { fill: #4A3500; }
.badge-ic.t4 .hex { fill: #2E6F76; } .badge-ic.t4 .hex2 { fill: #8FD5DB; } .badge-ic.t4 .glyph { fill: #0F3A3E; }
/* V1.6 : Émeraude (5), Diamant (6, l'ancien palier 5), Diamant noir (7) */
.badge-ic.t5 .hex { fill: #1E6F48; } .badge-ic.t5 .hex2 { fill: #7FD9A8; } .badge-ic.t5 .glyph { fill: #0B3A24; }
.badge-ic.t6 .hex { fill: #3F52B8; } .badge-ic.t6 .hex2 { fill: #B9C4FF; } .badge-ic.t6 .glyph { fill: #1B2570; }
.badge-ic.t7 .hex { fill: #121218; } .badge-ic.t7 .hex2 { fill: #3C3C4E; } .badge-ic.t7 .glyph { fill: #F4F1FF; }
.badge-ic.t7 { filter: drop-shadow(0 0 3px rgba(190, 170, 255, .55)) drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stat b { font-size: 20px; } .badges { grid-template-columns: 1fr; } .cover-pick { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- V1.3 : ISBN, historique ---------- */
.isbn-line { display: flex; gap: 8px; }
.isbn-line input { flex: 1; }
.catalog-results { display: grid; gap: 6px; margin: -6px 0 14px; }
.catalog-item { display: flex; gap: 10px; align-items: center; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.catalog-item:hover { border-color: var(--accent); }
.catalog-item img { width: 36px; height: 54px; object-fit: cover; border-radius: 3px; flex: none; }
.catalog-item .cover.xs { width: 36px; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; }
.hist li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hist li:last-child { border-bottom: 0; }
.hist li.corr { color: var(--muted); font-style: italic; }

/* ---------- V1.4 : mode lecture ---------- */
@keyframes breathe { 0%, 100% { box-shadow: 0 6px 16px rgba(0, 0, 0, .25), 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 50% { box-shadow: 0 6px 16px rgba(0, 0, 0, .25), 0 0 0 10px transparent; } }
.tool.lire { border: 0; background: var(--accent); color: var(--accent-ink, #fff); font-family: inherit; cursor: pointer; }
.tool.lire:hover { background: var(--accent); color: var(--accent-ink, #fff); filter: brightness(1.08); }
.tool.lire.on { animation: breathe 2.4s ease-in-out infinite; }
:root { --mood: var(--accent); --mood-ink: var(--accent-ink, #fff); }
html[data-light="dusk"] { --mood: #E5915A; --mood-ink: #2B1608; }
html[data-light="night"] { --mood: #8FCBA5; --mood-ink: #10251A; }
html[data-light="dawn"] { --mood: #D98A93; --mood-ink: #2B0F14; }
.cover-btn { border: 0; padding: 0; background: transparent; cursor: pointer; text-align: left; display: block; width: 100%; border-radius: 6px; -webkit-tap-highlight-color: transparent; }
.cover-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pace { margin-top: -4px; }
.b-actions .btn svg { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }
.live { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent); font-weight: 600; white-space: nowrap; overflow: hidden; min-width: 0; margin-top: -4px; }
/* V1.6.2 (relecture de Fable, 01/10) : avec un titre long, c'est le titre qui se coupe (…), la durée « 3 min » reste visible ;
   avant, la ligne entière se coupait et la durée disparaissait sur téléphone (balayage : .dur à 394 px sur 390) */
.live em { font-style: normal; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.live .dur { flex: none; }
.live-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 2px; vertical-align: 1px; animation: breathe-dot 2s ease-in-out infinite; }
@keyframes breathe-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.person { min-width: 0; }
/* accueil : lectures communes en cours */
.sess { display: grid; gap: 10px; }
.scard { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.scard .row { display: flex; align-items: center; gap: 10px; }
.scard .row.small { font-size: 13px; }
.scard .bar { height: 6px; }
.cover-link { display: block; }
.sess-new { justify-content: center; }
.sess-new svg { width: 16px; height: 16px; margin-right: 4px; }
/* feuille d'actions (en bas sur mobile) */
.sheet-wrap { align-items: end; padding: 0; }
.sheet { border-radius: 18px 18px 0 0; max-width: none; padding: 18px 20px calc(24px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 821px) { .sheet-wrap { place-items: center; padding: 16px; } .sheet { border-radius: 14px; max-width: 520px; padding: 22px; } }
/* V1.6.2 : poignée des fenêtres sur téléphone (on les ferme en les glissant vers le bas) */
@media (max-width: 820px) { #modal .dialog::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--muted); opacity: .4; margin: -8px auto 12px; } }
.sheet-book { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.acts { display: grid; gap: 8px; }
.acts > button, .acts > a { width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: 600 16px/1.2 var(--f-ui, inherit); font-family: inherit; text-align: left; padding: 8px 14px; display: flex; gap: 12px; align-items: center; cursor: pointer; text-decoration: none; }
.acts > button.primary { background: var(--accent); color: var(--accent-ink, #fff); border-color: transparent; }
.acts > button:disabled { opacity: .5; cursor: default; }
.acts > button small { margin-left: auto; font-weight: 500; font-size: 12px; opacity: .8; }
.acts > button svg { flex: none; width: 20px; height: 20px; }
.acts.pick > button { min-height: 64px; }
.acts.pick .cover.xs, .acts .auto-ic { flex: none; }
.auto-ic { width: 38px; height: 54px; border: 2px dashed var(--line); border-radius: 4px; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
/* Lire : avec ou sans chrono (V1.6) */
.mode-book { margin: 4px 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.mode-book strong { display: block; overflow-wrap: anywhere; }
.modes { display: grid; gap: 10px; }
.mode { width: 100%; min-height: 84px; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.mode:active { transform: scale(.99); }
.mode:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .mode:not(:disabled):hover { border-color: var(--accent); } }
.mode:disabled { opacity: .55; cursor: default; box-shadow: none; }
.mode-ic { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.mode-ic svg { width: 24px; height: 24px; }
.mode-tx { flex: 1; min-width: 0; display: grid; gap: 3px; }
.mode-tx strong { font-family: var(--f-read); font-size: 19px; font-weight: 600; line-height: 1.2; }
.mode-tx span { font-size: 14px; line-height: 1.35; color: var(--muted); }
.mode-go { flex: none; font-size: 26px; line-height: 1; color: var(--muted); }
/* fin de séance */
.stepper { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0; }
.stepper button { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 24px; cursor: pointer; }
.stepper input { width: 120px; text-align: center; font-size: 34px; font-weight: 700; border: 0; border-bottom: 2px solid var(--line); background: transparent; color: var(--ink); border-radius: 0; padding: 4px; }
.stepper input:focus { outline: none; border-bottom-color: var(--accent); }
.kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 16px; }
.kpi div { background: var(--surface-2); border-radius: 10px; padding: 8px; text-align: center; display: grid; gap: 2px; }
.kpi b { font-size: 18px; } .kpi span { font-size: 12px; color: var(--muted); }
/* chrono : pastille repliée */
#timer .mini { position: fixed; left: 12px; width: calc(100% - 24px); box-sizing: border-box; bottom: calc(74px + env(safe-area-inset-bottom, 0px)); z-index: 30; display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 14px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#timer .mini .t { border: 0; background: transparent; color: inherit; font-family: inherit; cursor: pointer; text-align: left; padding: 6px 10px; min-height: 44px; border-radius: 10px; }
#timer .mini .pp { border: 0; cursor: pointer; font-family: inherit; }
@media (min-width: 821px) { #timer .mini { left: auto; right: 24px; bottom: 24px; width: 340px; } }
#timer .mini .t { flex: 1; min-width: 0; display: grid; overflow: hidden; }
#timer .mini .t strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#timer .mini .t span { font-size: 12px; color: var(--muted); }
#timer .mini .time { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
#timer .mini .pp { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 14px; }
/* chrono : plein écran */
#timer .chrono { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top, 0px)) 24px calc(36px + env(safe-area-inset-bottom, 0px)); color: #fff; text-align: center; background: linear-gradient(180deg, rgba(10, 14, 20, .25), rgba(10, 14, 20, .55) 60%, rgba(10, 14, 20, .78)); animation: fadein .35s ease; }
html:not([data-bg="photo"]) #timer .chrono { background: linear-gradient(180deg, rgba(10, 14, 20, .55), rgba(10, 14, 20, .85)); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
body.timer-open #app { opacity: 0; transition: opacity .4s ease; pointer-events: none; }
#app { transition: opacity .4s ease; }
body.timer-open { overflow: hidden; }
#timer .grab { width: 44px; height: 24px; border: 0; background: transparent; cursor: pointer; position: relative; }
#timer .grab::before { content: ''; position: absolute; left: 4px; right: 4px; top: 10px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .55); }
#timer .c-mid { display: grid; gap: 4px; justify-items: center; }
#timer .big { font-size: 72px; font-weight: 300; letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 2px 18px rgba(0, 0, 0, .5); }
#timer .chrono.paused .big { opacity: .6; }
#timer .clock { font-size: 15px; opacity: .8; margin-top: 8px; }
#timer .c-book { font-family: var(--f-read); font-size: 22px; margin-top: 26px; text-shadow: 0 1px 10px rgba(0, 0, 0, .6); max-width: 90vw; }
#timer .c-meta { font-size: 15px; opacity: .9; margin-top: 4px; }
#timer .c-hint { font-size: 14px; opacity: .8; margin-top: 16px; }
#timer .c-bottom { display: grid; gap: 18px; justify-items: center; }
#timer .ctl { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
/* V1.6 : libellés explicites (« Mettre en pause », « Terminer la séance ») dans des boutons en pilule */
#timer .ctl button { min-width: 150px; height: 56px; padding: 0 20px; gap: 8px; margin: 0; display: inline-flex; align-items: center; justify-content: center; text-align: center; white-space: nowrap; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .14); color: #fff; font: 600 15px/1 inherit; font-family: inherit; letter-spacing: -.01em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); cursor: pointer; -webkit-appearance: none; appearance: none; }
#timer .ctl button svg { width: 18px; height: 18px; flex: none; }
#timer .ctl button.stop { background: var(--mood); color: var(--mood-ink); border-color: transparent; box-shadow: 0 0 0 6px color-mix(in srgb, var(--mood) 25%, transparent); }
#timer .c-strk { font-size: 13px; opacity: .8; }
/* V1.6 : animation douce pendant la séance (halo qui respire, poussières de lumière), à l'arrêt pendant une pause */
#timer .c-aura { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; transition: opacity 1.2s ease; }
#timer .chrono > :not(.c-aura) { position: relative; z-index: 1; }
#timer .c-aura .halo { position: absolute; left: 50%; top: 40%; width: min(86vw, 520px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--mood, #FFE2A8) 42%, transparent) 0%, color-mix(in srgb, var(--mood, #FFE2A8) 12%, transparent) 45%, transparent 70%); transform: translate(-50%, -50%) scale(.92); opacity: .45; animation: aura-breathe 8s ease-in-out infinite; }
@keyframes aura-breathe { 0%, 100% { transform: translate(-50%, -50%) scale(.92); opacity: .45; } 50% { transform: translate(-50%, -50%) scale(1.06); opacity: .9; } }
#timer .c-aura i { position: absolute; bottom: -12px; border-radius: 50%; background: rgba(255, 244, 214, .8); box-shadow: 0 0 10px rgba(255, 236, 190, .85); opacity: 0; animation-name: aura-drift; animation-timing-function: linear; animation-iteration-count: infinite; }
@keyframes aura-drift { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: .7; } 80% { opacity: .45; } 100% { transform: translate(var(--dx, 0), -104vh); opacity: 0; } }
#timer .chrono.paused .c-aura { opacity: .35; }
#timer .chrono.paused .c-aura * { animation-play-state: paused; }
#timer .mini .pulse { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: soft-pulse 4s ease-in-out infinite; }
#timer .mini .pulse.off { animation: none; opacity: .35; }
@keyframes soft-pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { #timer .c-aura .halo, #timer .mini .pulse { animation: none; } #timer .c-aura i { display: none; } }
#timer .c-strk .linkbtn { color: inherit; opacity: .9; }
.stats-timer { margin-top: -2px; }
@media (prefers-reduced-motion: reduce) { .tabbar > button.lire.on i, .tool.lire.on { animation: none; } #timer .chrono { animation: none; } body.timer-open #app { transition: none; } #app { transition: none; } }

/* ---------- V1.4.1 : retours ---------- */
.fb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fb-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.fb-item.new { border-color: var(--accent); background: var(--accent-soft); }
.fb-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fb-item p { white-space: pre-wrap; margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.me .badge { position: static; margin-left: 6px; }
.pill.bug { background: #F8E1DE; color: #8A2A22; border-color: transparent; }
html[data-light="night"] .pill.bug { background: #4A2622; color: #F2B3AB; }

/* ---------- V1.4.5 : choix du livre (Nouvelle lecture), actions du livre dans une lecture ---------- */
.book-pick { display: grid; gap: 10px; }
.src-toggle { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.src-toggle label { flex: 1; position: relative; }
.src-toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.src-toggle span { display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 8px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); text-align: center; line-height: 1.2; }
.src-toggle input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.src-toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
#sf-q { width: 100%; margin-bottom: 8px; }
#sf-sugg { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
#sf-sugg .catalog-item { width: 100%; }
.catalog-item.chosen { cursor: default; border-color: var(--accent); }
.catalog-item.chosen:hover { border-color: var(--accent); }
.catalog-item .grow { min-width: 0; }
.sv-book { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sv-book .small { flex-basis: 100%; }
.end-warn { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); color: var(--ink); border-radius: 10px; padding: 8px 10px; font-size: 14px; margin: 8px 0; }

/* ---------- V1.5 : rayons (Mes livres, Toutes les lectures) ---------- */
.shelf { margin-top: 22px; }
.page-head + .shelf { margin-top: 6px; }
.shelf-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.shelf-h h2 { margin: 0; font: 600 20px/1.2 var(--f-read); }
.shelf-h .n { color: var(--muted); font-size: 14px; }
.shelf-add { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; }
.shelf-add svg { width: 18px; height: 18px; }
.shelf-wrap { position: relative; }
/* 1.6.3 (retour de Palakoslip, 02/10 : « on peut dézoomer sur le profil ») : le rayon est le repère de ce qu'il contient. Sans cela, le texte
   invisible « Avis : J'adore » d'un livre noté (position absolue, .sr-only) prenait pour repère .shelf-wrap, échappait au rognage du rayon
   et élargissait la page jusqu'au dernier livre noté (685 px au lieu de 390) : iOS laissait alors dézoomer. */
.shelf-track { position: relative; display: flex; align-items: flex-start; gap: 14px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-left: 0; padding: 2px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.shelf-track::-webkit-scrollbar { display: none; }
.shelf-wrap.more-right .shelf-track { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 64px), transparent); }
.shelf-wrap.more-right.more-left .shelf-track { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 64px), transparent); }
.shelf-wrap.more-left:not(.more-right) .shelf-track { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px); mask-image: linear-gradient(90deg, transparent, #000 40px); }
.shelf-item { flex: 0 0 132px; scroll-snap-align: start; display: grid; gap: 6px; align-content: start; min-width: 0; }
.shelf-item.wide { flex-basis: min(300px, 82vw); }
.shelf-item.wide > .card { box-sizing: border-box; margin: 0; }
.shelf-item .si-title { font: 600 14px/1.25 var(--f-read); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.shelf-item .si-meta { font-size: 12px; }
.shelf-item .bar { height: 4px; }
.shelf-item .si-lire { justify-self: start; margin-top: 2px; }
.si-tag { justify-self: start; font-size: 11px; font-weight: 600; color: #8A5A1E; background: #F6E6C8; border-radius: 999px; padding: 2px 8px; }
.shelf-empty { margin: 4px 0 0; }
.shelf-more { display: flex; justify-content: center; margin-top: 8px; }
.shelf-arrow { display: none; position: absolute; top: 38%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-size: 20px; line-height: 1; cursor: pointer; z-index: 2; }
.shelf-arrow.prev { left: -8px; } .shelf-arrow.next { right: -8px; }
@media (hover: hover) and (pointer: fine) { .shelf-arrow:not([hidden]) { display: grid; place-items: center; } }
@media (prefers-reduced-motion: reduce) { .shelf-track { scroll-behavior: auto; } }
@media (max-width: 820px) {
  .shelf-arrow { display: none !important; }
  .shelf-item { flex-basis: 108px; }
  .shelf-item .si-title { font-size: 13px; }
  .seg button { white-space: nowrap; padding: 0 4px; font-size: 15px; }
  .seg button .badge { margin-left: 2px; }
}

/* ---------- V1.5 : envies ---------- */
.acts > button.danger { color: var(--danger); }
.pill.wish-pill { background: #F6E6C8; color: #8A5A1E; border-color: transparent; }
.sf-copy { margin-top: 10px; align-items: flex-start; }
.sf-copy input { margin-top: 3px; }
.sf-have { margin-top: 8px; }
.book.wish .cover-btn { cursor: pointer; }

/* ---------- V1.5 : étiquettes et tirage ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 7px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag.priv { color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line); }
.tag-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 6px 8px; min-height: 44px; }
.tag-box:focus-within { border-color: var(--accent); }
.tag-box input { flex: 1 1 120px; min-width: 100px; border: 0 !important; background: transparent !important; padding: 4px 2px !important; outline: none; box-shadow: none !important; }
.tag-pill { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 4px 2px 2px; }
.tag-pill.priv { background: var(--surface); color: var(--ink); border: 1px dashed var(--muted); }
.tag-pill button { border: 0; background: transparent; color: inherit; cursor: pointer; width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; padding: 0; font-size: 16px; line-height: 1; }
.tag-pill button:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.tag-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-sugg:empty { display: none; }
.tag-chips { margin-top: -6px; }
.sec-row { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin: 28px 0 12px; }
.sec-row .sec-title { flex: 1 1 auto; min-width: 0; margin: 0; }
.sec-row .btn { flex: none; white-space: nowrap; }
@media (max-width: 820px) { .sec-row .btn { flex: 1 1 100%; min-height: 40px; } }
.draw-opts { display: grid; gap: 10px; margin: 10px 0 14px; }
.draw-stage { min-height: 150px; display: grid; place-items: center; }
.draw-go { min-height: 48px; padding: 0 22px; }
.draw-shuffle { width: 88px; transform: rotate(-3deg); transition: transform .12s; }
.draw-shuffle.land { transform: rotate(0) scale(1.06); transition: transform .3s cubic-bezier(.2, 1.4, .4, 1); }
.draw-result { display: flex; gap: 14px; align-items: flex-start; width: 100%; margin-bottom: 12px; }
.draw-result > .cover { width: 76px; flex: none; }
.draw-shuffle > .cover { width: 100%; }
.draw-result > div:last-child { display: grid; gap: 4px; min-width: 0; }
.draw-stage .acts { width: 100%; }
@media (prefers-reduced-motion: reduce) { .draw-shuffle, .draw-shuffle.land { transition: none; transform: none; } }

/* ---------- V1.5.1 : chacun son exemplaire ---------- */
.sheet-book.foreign { align-items: flex-start; }
.sheet-book.foreign > .cover { width: 76px; flex: none; }
.sheet-book.foreign > div { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.check.off { opacity: .6; cursor: not-allowed; }
.check.off input { cursor: not-allowed; }
.sf-missing { margin-top: 10px; }
.b-actions > .pill { align-self: center; }

/* Installer l'appli (V1.6) */
.install { display: grid; gap: 10px; }
.install .chips { margin: 0; }
.install-steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; line-height: 1.45; }
.install-steps .inl { width: 18px; height: 18px; vertical-align: -3px; }
.install-hint .btn { flex: none; }

/* ---------- Jours spéciaux (V1.6) : police du titre, couleur, teinte du bandeau, puce et motif ----------
   Polices libres (SIL Open Font License, fichiers OFL-*.txt à côté), sous-ensemble latin, chargées seulement pendant la fête. */
@font-face { font-family: 'Cinzel Decorative F'; src: url('fonts/fetes/cinzel-decorative.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Great Vibes F'; src: url('fonts/fetes/great-vibes.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Pacifico F'; src: url('fonts/fetes/pacifico.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'IM Fell SC F'; src: url('fonts/fetes/im-fell-sc.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Cinzel F'; src: url('fonts/fetes/cinzel.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Monoton F'; src: url('fonts/fetes/monoton.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Poiret One F'; src: url('fonts/fetes/poiret-one.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Caveat F'; src: url('fonts/fetes/caveat.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Creepster F'; src: url('fonts/fetes/creepster.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Sniglet F'; src: url('fonts/fetes/sniglet.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Berkshire Swash F'; src: url('fonts/fetes/berkshire-swash.woff') format('woff'); font-display: swap; }
html[data-fete="nouvel-an"] { --fete-font: 'Cinzel Decorative F'; --fete-a: #7A5A12; --fete-an: #F2CF7A; --fete-tint: rgba(201,168,106,.20); --fete-gold: #C9A86A; }
html[data-fete="valentin"] { --fete-font: 'Great Vibes F'; --fete-a: #A3264F; --fete-an: #F49AB8; --fete-tint: rgba(220,90,130,.14); --fete-gold: #E07A9A; }
html[data-fete="printemps"] { --fete-font: 'Pacifico F'; --fete-a: #2E6F39; --fete-an: #9ADBA6; --fete-tint: rgba(120,200,120,.16); --fete-gold: #E7B6D2; }
html[data-fete="livre"] { --fete-font: 'IM Fell SC F'; --fete-a: #6B3F1D; --fete-an: #E8C39A; --fete-tint: rgba(170,120,70,.14); --fete-gold: #C9A86A; }
html[data-fete="europe"] { --fete-font: 'Cinzel F'; --fete-a: #1F3F8F; --fete-an: #A9BEF7; --fete-tint: rgba(60,90,200,.14); --fete-gold: #E3C04D; }
html[data-fete="musique"] { --fete-font: 'Monoton F'; --fete-a: #7A2E8C; --fete-an: #E0A6EE; --fete-tint: rgba(170,80,190,.14); --fete-gold: #E07ADB; }
html[data-fete="etoiles"] { --fete-font: 'Poiret One F'; --fete-a: #2F3D8A; --fete-an: #C9D2FF; --fete-tint: rgba(80,90,200,.16); --fete-gold: #E6D38A; }
html[data-fete="langues"] { --fete-font: 'Caveat F'; --fete-a: #0F6464; --fete-an: #8FD9D6; --fete-tint: rgba(40,160,160,.14); --fete-gold: #E3B04D; }
html[data-fete="halloween"] { --fete-font: 'Creepster F'; --fete-a: #A93C0C; --fete-an: #FF9A4D; --fete-tint: rgba(230,110,30,.18); --fete-gold: #FF8A1F; }
html[data-fete="gentillesse"] { --fete-font: 'Sniglet F'; --fete-a: #9C4219; --fete-an: #F7B38A; --fete-tint: rgba(240,150,100,.14); --fete-gold: #F2A64D; }
html[data-fete="solstice"] { --fete-font: 'Berkshire Swash F'; --fete-a: #245C8A; --fete-an: #BFE0FF; --fete-tint: rgba(120,180,240,.16); --fete-gold: #F2D98A; }
html[data-fete] { --fete-c: var(--fete-a); }
html[data-fete][data-light="night"] { --fete-c: var(--fete-an); }
html[data-fete] .top { background-image: linear-gradient(100deg, var(--fete-tint), transparent 75%); }
html[data-fete] .brand { font-family: var(--fete-font), 'Citadel of Blackrose', var(--f-read); color: var(--fete-c); --logo-cover: var(--fete-c); --logo-gold: var(--fete-gold); }
html[data-fete="musique"] .brand { letter-spacing: .02em; font-size: .9em; }
html[data-fete="langues"] .brand { font-size: 1.22em; }
html[data-fete="valentin"] .brand { font-size: 1.3em; }
.fete-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; padding: 4px 11px 4px 8px; border-radius: 999px; font: 600 13px/1.2 var(--f-ui); color: var(--fete-c); background: color-mix(in srgb, var(--fete-c) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--fete-c) 30%, transparent); }
.fete-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fete-chip svg { flex: none; width: 16px; height: 16px; }
.fete-motif { order: 3; flex: 1 1 60px; min-width: 0; height: 30px; display: flex; align-items: center; justify-content: space-evenly; overflow: hidden; color: var(--fete-c); pointer-events: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); }
.fete-motif svg { flex: none; opacity: .32; animation: fete-float 9s ease-in-out infinite; }
.fete-motif .m0 { width: 14px; height: 14px; transform: rotate(-12deg); }
.fete-motif .m1 { width: 20px; height: 20px; animation-delay: -2s; }
.fete-motif .m2 { width: 12px; height: 12px; transform: rotate(18deg); animation-delay: -4s; }
.fete-motif .m3 { width: 18px; height: 18px; transform: rotate(-6deg); animation-delay: -6s; }
.fete-motif .m4 { width: 13px; height: 13px; animation-delay: -1s; }
@keyframes fete-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
.top .tools { order: 2; } .top .me { order: 4; }
@media (max-width: 820px) {
  html[data-fete] .top-in { flex-wrap: wrap; row-gap: 6px; }
  .fete-chip { order: 5; font-size: 12px; } /* téléphone : le message passe sous le titre, en entier */
  .fete-motif { height: 24px; }
  html[data-fete] body[data-route="home"] main { margin-top: 22px; }
}
@media (max-width: 380px) { .fete-motif { display: none; } }
@media (prefers-reduced-motion: reduce) { .fete-motif svg { animation: none; } }


/* Avis sur un livre (V1.6) : pastille en bas à droite de la couverture, choix dans la feuille du livre */
.rate-pin { position: absolute; right: 6%; bottom: 5%; z-index: 2; width: 30%; max-width: 30px; min-width: 15px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: #FFFDF8; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); --pin-bg: #FFFDF8; }
.rate-pin svg { width: 64%; height: 64%; }
.r-love { color: #C2185B; } .r-ok { color: #2F7A4F; } .r-neutral { color: #5E6670; } .r-notok { color: #A65B12; } .r-dislike { color: #7E2A3A; }
.rate-pin .crack, .rate-opt .crack { stroke: var(--pin-bg, #FFFDF8); }
.rate-label { margin: 0 0 6px; }
.rate-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.rate-opt { display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font: 600 12px/1.2 var(--f-ui); color: var(--ink); cursor: pointer; text-align: center; --pin-bg: var(--surface-2); }
.rate-opt svg { width: 26px; height: 26px; }
.rate-opt span { color: var(--ink); }
.rate-opt[aria-pressed="true"] { border-color: currentColor; background: color-mix(in srgb, currentColor 12%, var(--surface)); box-shadow: inset 0 0 0 1px currentColor; --pin-bg: color-mix(in srgb, currentColor 12%, var(--surface)); }
html[data-light="night"] .r-love { color: #F48FB1; } html[data-light="night"] .r-ok { color: #8FCBA5; } html[data-light="night"] .r-neutral { color: #B4BCC6; } html[data-light="night"] .r-notok { color: #F0B35A; } html[data-light="night"] .r-dislike { color: #E88A9A; }
html[data-light="night"] .rate-pin.r-love { color: #C2185B; } html[data-light="night"] .rate-pin.r-ok { color: #2F7A4F; } html[data-light="night"] .rate-pin.r-neutral { color: #5E6670; } html[data-light="night"] .rate-pin.r-notok { color: #A65B12; } html[data-light="night"] .rate-pin.r-dislike { color: #7E2A3A; }
/* Pause vue par les autres (V1.6) et correction d'une séance */
.live.paused { color: #7A5A12; } /* V1.6.2 : en pause en orange, comme la pastille « En pause » d'un livre (décision de Max, 30/09) */
.live.paused .live-dot { background: #C9A86A; animation: none; box-shadow: none; }
html[data-light="night"] .live.paused { color: #F2D48A; }
.se-times { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 10px 0 2px; }
.se-times .field { margin: 0; min-width: 0; } /* V1.6.2 : sur iPhone, la case « Fin » débordait du bord (retour de Palakoslip) */
.se-times input { width: 100%; min-width: 0; box-sizing: border-box; -webkit-appearance: none; appearance: none; padding-left: 8px; padding-right: 8px; }
.hist .hist-edit { grid-column: 1 / -1; justify-self: start; font-size: 13px; padding: 0; margin-top: -4px; }
@media (max-width: 380px) { .se-times { grid-template-columns: 1fr 1fr; } .se-times .field:first-child { grid-column: 1 / -1; } }
