/* Couleurs : toujours via ces variables. Clair par défaut, sombre si le système le demande ou si on le choisit
   (data-theme sur <html>). Une seule couleur d'accent ; les univers ont chacun leur teinte (--u). */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #efede7;
  --border: #e3e0d8;
  --text: #17161a;
  --text-2: #6d6a73;
  --accent: #e0344d;
  --accent-text: #ffffff;
  --danger: #c62f2f;
  --logo: #013f3e;
  --shadow: 0 1px 2px rgb(23 22 26 / 0.06), 0 8px 24px rgb(23 22 26 / 0.08);
  --shadow-cover: 0 1px 2px rgb(0 0 0 / 0.12), 0 6px 16px rgb(0 0 0 / 0.12);
  --radius: 14px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --page: none; /* plein écran : la bibliothèque prend toute la largeur à côté du menu */
  --gutter: clamp(1.25rem, 2.4vw, 2.75rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113;
    --surface: #19191c;
    --surface-2: #232327;
    --border: #2f2f35;
    --text: #f2f0ea;
    --text-2: #9d9aa4;
    --accent: #ff4f68;
    --accent-text: #ffffff;
    --danger: #ff6b6b;
    --logo: #7fd4c8;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
    --shadow-cover: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 20px rgb(0 0 0 / 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111113;
  --surface: #19191c;
  --surface-2: #232327;
  --border: #2f2f35;
  --text: #f2f0ea;
  --text-2: #9d9aa4;
  --accent: #ff4f68;
  --accent-text: #ffffff;
  --danger: #ff6b6b;
  --logo: #7fd4c8;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  --shadow-cover: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 20px rgb(0 0 0 / 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
a { color: inherit; }
.meta { color: var(--text-2); font-size: 0.85rem; margin: 0; }
.error { color: var(--danger); min-height: 1.4em; margin: 0; font-size: 0.9rem; }
.error:empty { min-height: 0; }
.spacer { flex: 1; }

/* Logo : l'image sert de masque, sa couleur suit le thème (--logo). */
.logo { display: inline-block; flex: none; background: var(--logo); mask: var(--logo-file) center / contain no-repeat; -webkit-mask: var(--logo-file) center / contain no-repeat; }
.logo-mark { --logo-file: url(logo-mark.png); width: 34px; height: 40px; }
.logo-full { --logo-file: url(logo-full.png); width: 170px; height: 200px; }

/* Icônes au trait */
.icon { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* Champs et boutons */
input, select, button, .button {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.8rem;
}
select { padding-right: 2rem; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, .button:focus-within, tr:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button, .button { cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.4rem; justify-content: center; text-decoration: none; }
button:disabled { opacity: 0.55; cursor: default; }
.primary { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.ghost { background: transparent; }
.ghost:hover:not(:disabled) { background: var(--surface-2); }
.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.danger-text { color: var(--danger); }
.pill { border-radius: 999px; padding: 0.3rem 0.9rem; font-size: 0.85rem; font-weight: 600; border-color: var(--text); background: transparent; }
.pill:hover { background: var(--text); color: var(--bg); }
.linkbtn { border: 0; background: none; padding: 0.3rem 0.2rem; color: var(--text-2); font-size: 0.85rem; }
.linkbtn:hover { color: var(--accent); }
.iconbtn { width: 38px; height: 38px; padding: 0; border-radius: 999px; background: transparent; border-color: transparent; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn .icon { width: 20px; height: 20px; }
.spinning .icon { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
label { display: grid; gap: 0.3rem; color: var(--text-2); font-size: 0.88rem; }
label input { color: var(--text); font-size: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; color: var(--text); font-size: 0.95rem; }
.check input { margin-top: 0.25rem; accent-color: var(--accent); }
.check small { display: block; color: var(--text-2); }
.check.inline { align-items: center; font-size: 0.88rem; color: var(--text-2); }
.check.inline input { margin: 0; }

/* Connexion */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background:
    radial-gradient(circle at 15% 20%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 40%),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, #3d52c4 10%, transparent), transparent 40%), var(--bg);
}
.login-card { width: min(400px, 100%); display: grid; gap: 1.5rem; padding: 2.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
.login-brand { display: grid; justify-items: center; gap: 0.7rem; font-weight: 600; }
.login-brand b, .brand b { color: var(--logo); }
.login-form { display: grid; gap: 1rem; }
.login-form h1 { font-size: 1.6rem; }
.login-form a.meta { text-align: center; }

/* Coquille : le menu des bibliothèques à gauche, la bibliothèque ouverte à droite. Sur petit écran, le menu est un
   tiroir qu'ouvre le bouton de la bibliothèque, en haut à gauche. */
.shell { --shelf-w: 252px; min-height: 100dvh; }
.shell-main { min-width: 0; }
.shelf {
  position: sticky; top: 0; align-self: start; height: 100dvh; z-index: 25; display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.9rem 0.7rem; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; scrollbar-width: thin;
}
.shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.1rem 0.35rem 0.8rem; }
.shelf-brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; text-decoration: none; font-weight: 600; white-space: nowrap; }
.shelf-close { display: none; }
.shelf-title { margin: 0.3rem 0 0.2rem; padding: 0 0.75rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-2); }
.shelf-nav { display: grid; gap: 0.15rem; }
.shelf-lib, .shelf-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 0.75rem; width: 100%; min-height: 40px; padding: 0.4rem 0.75rem;
  border: 0; border-radius: 10px; background: none; color: var(--text-2); font-weight: 600; font-size: 0.92rem; text-align: left;
  text-decoration: none; white-space: nowrap;
}
.shelf-lib .icon, .shelf-item .icon { flex: none; width: 20px; height: 20px; }
.shelf-lib:hover, .shelf-item:hover { color: var(--text); background: var(--surface-2); }
.shelf-lib[aria-current] { color: var(--text); background: var(--surface-2); }
.shelf-lib[aria-current] .icon { color: var(--accent); }
.shelf-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.shelf-count { margin-left: auto; font-size: 0.75rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.shelf-sub { display: grid; gap: 0.1rem; margin: 0.15rem 0 0.45rem 1.45rem; padding-left: 0.55rem; border-left: 1px solid var(--border); }
.shelf-sub .shelf-item { min-height: 34px; font-size: 0.86rem; font-weight: 500; }
.shelf-sub .shelf-item .icon { width: 17px; height: 17px; }
.shelf-sub .shelf-item[aria-current] { color: var(--accent); font-weight: 650; }
.shelf-foot { margin-top: auto; display: grid; gap: 0.15rem; padding-top: 0.7rem; border-top: 1px solid var(--border); }
.shelf-section { margin-top: 0.9rem; }
.shelf-lib, .shelf-item { position: relative; }
/* Nouveautés de l'actu depuis la dernière visite */
.shelf-new {
  margin-left: auto; min-width: 1.35rem; padding: 0 0.4rem; border-radius: 999px; background: var(--accent); color: var(--accent-text);
  font-size: 0.7rem; font-weight: 700; line-height: 1.3rem; text-align: center; font-variant-numeric: tabular-nums;
}
.shelf-fold .icon { transition: transform 0.2s; }
.libbtn {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.75rem 0.25rem 0.35rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 700; font-size: 0.95rem;
}
.libbtn .logo { width: 26px; height: 30px; }
.libbtn::after { content: ""; width: 6px; height: 6px; margin: -3px 0 0 0.1rem; border: solid currentColor; border-width: 0 1.7px 1.7px 0; transform: rotate(45deg); opacity: 0.65; }
.libbtn:hover { border-color: var(--text-2); }
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--shelf-w) minmax(0, 1fr); }
  .libbtn, .mainnav { display: none !important; } /* le menu de gauche les remplace */
  .shelf-shade { display: none !important; }
  /* Replié : les icônes seules, les noms en bulle d'aide */
  :root[data-shelf="folded"] .shell { --shelf-w: 74px; }
  :root[data-shelf="folded"] .shelf { padding-inline: 0.55rem; }
  :root[data-shelf="folded"] :is(.shelf-label, .shelf-count, .shelf-title) { display: none; }
  :root[data-shelf="folded"] :is(.shelf-lib, .shelf-item) { justify-content: center; gap: 0; padding-inline: 0; }
  :root[data-shelf="folded"] .shelf-head { justify-content: center; padding-inline: 0; }
  :root[data-shelf="folded"] .shelf-sub { margin-left: 0; padding-left: 0; border-left: 0; }
  :root[data-shelf="folded"] .shelf-fold .icon { transform: scaleX(-1); }
  :root[data-shelf="folded"] .shelf-new { position: absolute; top: 5px; right: 12px; min-width: 0; width: 10px; height: 10px; padding: 0; font-size: 0; border: 2px solid var(--surface); }
}
@media (max-width: 1023.98px) {
  .shelf {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: auto; z-index: 40; box-shadow: var(--shadow);
    transform: translateX(-102%); visibility: hidden; transition: transform 0.24s ease, visibility 0s linear 0.24s;
  }
  .shell[data-drawer] .shelf { transform: none; visibility: visible; transition: transform 0.24s ease; }
  .shelf-close { display: inline-flex; }
  .shelf-fold { display: none; }
  .shelf-shade { position: fixed; inset: 0; z-index: 39; background: rgb(0 0 0 / 0.4); }
}
@media (prefers-reduced-motion: reduce) { .shelf, .shell[data-drawer] .shelf { transition: none; } }

/* Barre du haut : la recherche, les outils et le compte. Les univers dessous. */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.topbar-row { max-width: var(--page); margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: 0.7rem var(--gutter) 0.45rem; }
.brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; font-weight: 600; white-space: nowrap; }
.mainnav { display: flex; gap: 0.2rem; }
.mainnav a { text-decoration: none; font-weight: 600; font-size: 0.92rem; padding: 0.35rem 0.7rem; border-radius: 8px; color: var(--text-2); }
.mainnav a:hover { color: var(--text); }
.mainnav a[aria-current] { color: var(--text); background: var(--surface-2); }
.findbar { flex: 1; max-width: 680px; margin-right: auto; position: relative; display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.searchbox { flex: 1; min-width: 0; position: relative; display: block; }
/* Bouton « Collections » à côté de la recherche, et sa liste */
.findbtn { flex: none; display: inline-flex; align-items: center; gap: 0.4rem; height: 38px; padding: 0 0.95rem; border: 1px solid transparent; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.findbtn:hover, .findbtn[aria-expanded="true"] { border-color: var(--border); background: var(--surface); }
.findbtn .icon { width: 16px; height: 16px; color: var(--text-2); }
.collections-pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: min(360px, calc(100vw - 2rem)); max-height: min(70vh, 520px); display: flex; flex-direction: column; gap: 0.5rem; padding: 0.7rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 18px 44px -12px rgb(0 0 0 / 0.35); }
.collections-pop[hidden] { display: none; }
.collections-pop input { width: 100%; }
.collections-pop ul { margin: 0; padding: 0; list-style: none; overflow-y: auto; }
.collections-pop li a { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.55rem; border-radius: 8px; color: inherit; text-decoration: none; font-size: 0.9rem; }
.collections-pop li a:hover, .collections-pop li a:focus-visible { background: var(--surface-2); outline: none; }
.collections-pop li a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collections-pop li a small { color: var(--text-2); font-variant-numeric: tabular-nums; }
.collections-pop li.other a span { font-style: italic; }
.collections-pop footer { display: flex; justify-content: space-between; gap: 0.5rem; padding-top: 0.45rem; border-top: 1px solid var(--border); font-size: 0.84rem; }
.collections-pop footer a, .collections-pop footer button { color: var(--text); font-weight: 600; text-decoration: none; background: none; border: 0; padding: 0.3rem 0.2rem; cursor: pointer; font-size: inherit; }
.searchbox .icon { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--text-2); }
.searchbox input { width: 100%; padding-left: 2.3rem; border-radius: 999px; background: var(--surface-2); border-color: transparent; font-size: 0.92rem; }
.searchbox input:focus { background: var(--surface); border-color: var(--border); }
.tools { display: flex; gap: 0.2rem; }
body:not(.is-admin) .admin-only { display: none !important; }
.account { position: relative; }
.avatar { width: 36px; height: 36px; padding: 0; border-radius: 999px; background: var(--text); color: var(--bg); border: 0; font-weight: 700; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 0.4rem; display: grid; z-index: 30; }
.menu-head { margin: 0; padding: 0.5rem 0.7rem 0.6rem; display: grid; border-bottom: 1px solid var(--border); margin-bottom: 0.3rem; }
.menu a, .menu button { text-align: left; justify-content: flex-start; border: 0; background: none; padding: 0.55rem 0.7rem; border-radius: 8px; text-decoration: none; font-size: 0.92rem; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }

.chips { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.topbar .chips { max-width: var(--page); margin: 0 auto; padding: 0.15rem var(--gutter) 0.6rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; text-decoration: none;
  font-size: 0.82rem; color: var(--text-2); padding: 0.25rem 0.7rem; border-radius: 999px; border: 1px solid transparent; background: none;
}
.chip .icon { color: var(--u, currentColor); width: 15px; height: 15px; }
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip[aria-current="true"], .chip[aria-pressed="true"] { color: var(--text); border-color: var(--text); }
.sync-status { margin: 0 auto; max-width: var(--page); padding: 0.5rem var(--gutter); color: var(--text-2); font-size: 0.85rem; }
.sync-status.err { color: var(--danger); }

/* Écran de choix : la barre du haut ne garde que le bouton du menu et le compte. */
body[data-library=""] :is(.mainnav, .tools, #online-link, .findbtn), body[data-library=""]:not(.on-news) .searchbox { display: none !important; }
body[data-library=""] .account { margin-left: auto; }
.picker { display: grid; justify-items: center; gap: 1.6rem; padding: 2rem 0; text-align: center; }
.picker h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
.picker .logo-full { width: 120px; height: 142px; }
.library-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 1.4rem; width: 100%; max-width: 1640px; }
.library-card { display: grid; gap: 0.35rem; justify-items: start; align-content: start; text-align: left; padding: 1.6rem; text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; transition: transform 0.2s, box-shadow 0.2s; }
.library-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.library-card .stack { width: 100%; }
.library-card strong { font-size: 1.25rem; letter-spacing: -0.015em; }
.library-count { margin-top: 0.5rem; font-size: 0.85rem; font-weight: 600; color: var(--logo); }
.library-empty { height: 170px; margin-bottom: 0.7rem; display: grid; place-items: center; width: 100%; color: var(--logo); }
.library-empty .icon { width: 84px; height: 84px; }

/* Mise en page */
.page { max-width: var(--page); margin: 0 auto; padding: 1.5rem var(--gutter) 4rem; display: grid; gap: 3.2rem; }
.section { display: grid; gap: 1.1rem; min-width: 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; min-width: 0; }
.section-head > div { min-width: 0; max-width: 100%; }
.section-head h2 { font-size: 1.3rem; }
.see-all { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.82rem; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.see-all:hover { color: var(--accent); }
.see-all .icon { width: 14px; height: 14px; }
.tabs { display: flex; gap: 1.4rem; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 0 0 0.45rem; border-radius: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.015em; color: var(--text-2); position: relative; }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; bottom: 0; width: 28px; height: 3px; border-radius: 2px; background: var(--accent); }
.loading { display: flex; align-items: center; gap: 0.7rem; color: var(--text-2); padding: 4rem 0; justify-content: center; }
.loading-die { width: 28px; height: 28px; color: var(--accent); animation: spin 1.4s linear infinite; }
.empty { display: grid; justify-items: center; gap: 0.8rem; text-align: center; color: var(--text-2); padding: 4rem 1rem; }
.empty-icon { width: 56px; height: 56px; color: var(--accent); }
.empty h1 { color: var(--text); }

/* Couvertures et cartes */
.cover {
  position: relative; aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; background: var(--surface-2);
  box-shadow: var(--shadow-cover); display: grid;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .placeholder {
  display: grid; align-content: space-between; gap: 0.5rem; padding: 0.8rem; color: #fff; font-weight: 700; font-size: 0.85rem; line-height: 1.25;
  background: linear-gradient(160deg, color-mix(in oklab, var(--u) 85%, white), color-mix(in oklab, var(--u) 75%, black));
  overflow: hidden;
}
.cover .placeholder .icon { width: 22px; height: 22px; opacity: 0.85; }
.eyebrow { font-size: 0.75rem; color: var(--text-2); display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--u, var(--accent)); flex: none; }

.card { display: grid; gap: 0.3rem; text-decoration: none; min-width: 0; align-content: start; }
.card-cover { position: relative; margin-bottom: 0.45rem; }
.card .cover { transition: transform 0.2s, box-shadow 0.2s; }
.card:hover .cover { transform: translateY(-4px); box-shadow: 0 2px 4px rgb(0 0 0 / 0.12), 0 14px 28px rgb(0 0 0 / 0.18); }
.card-title { font-weight: 600; font-size: 0.88rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { font-size: 0.76rem; }
/* Collections (accueil et page) : « Indé & autres » se distingue d'un trait */
.shelf-tile.shelf-other strong { font-style: italic; }
.shelf-grid { margin-top: 1.2rem; }
/* Lu / pas lu : une pastille sur la couverture. Visible au survol (toujours au doigt), pleine quand c'est lu. */
.card-read {
  position: absolute; top: 6px; left: 6px; z-index: 2; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1.5px solid rgb(255 255 255 / 0.85); border-radius: 50%; background: rgb(0 0 0 / 0.45); color: #fff;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.3); cursor: pointer; opacity: 0; transition: opacity 0.15s, transform 0.12s, background-color 0.15s;
}
.card-read .icon { width: 17px; height: 17px; }
.card:hover .card-read, .card:focus-within .card-read, .card-read:focus-visible, .card-read.on { opacity: 1; }
.card-read:hover { transform: scale(1.08); background: rgb(0 0 0 / 0.65); }
.card-read.on { border-color: transparent; background: var(--accent); color: var(--accent-text, #fff); }
.card-read:disabled { opacity: 0.5; cursor: progress; }
@media (hover: none) { .card-read { opacity: 0.85; } } /* une série en ligne : son dernier chapitre */
.badge { position: absolute; top: 7px; right: 7px; padding: 0.05rem 0.45rem; border-radius: 6px; font-size: 0.7rem; font-weight: 600; background: rgb(0 0 0 / 0.62); color: #fff; backdrop-filter: blur(4px); }
.cover-progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 2px; background: rgb(255 255 255 / 0.45); overflow: hidden; }
.cover-progress > i { display: block; height: 100%; background: var(--accent); }
.bar { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* Rangées qui défilent */
.rail-wrap { position: relative; min-width: 0; }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: 152px; gap: 1.3rem; overflow-x: auto; scroll-snap-type: x proximity; padding: 0.4rem 0.2rem 0.6rem; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
.rail-arrow { position: absolute; top: calc(50% - 40px); width: 36px; height: 36px; border-radius: 999px; padding: 0; background: var(--surface); box-shadow: var(--shadow); border-color: var(--border); z-index: 2; }
.rail-arrow .icon { width: 18px; height: 18px; }
.rail-arrow.prev { left: -14px; }
.rail-arrow.next { right: -14px; }
@media (hover: none) { .rail-arrow { display: none; } }

/* Accueil : reprise de lecture */
.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 190px minmax(0, 1fr) 300px; gap: 2.2rem; align-items: center;
  padding: 2rem; border-radius: 22px; background: var(--surface); border: 1px solid var(--border);
}
.hero-art { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(50px) saturate(1.3); opacity: 0.22; pointer-events: none; }
.hero > :not(.hero-art) { position: relative; }
.hero-cover { text-decoration: none; } /* une couverture absente : son titre de remplacement n'est pas souligné comme un lien */
.hero-cover .cover { box-shadow: 0 2px 6px rgb(0 0 0 / 0.15), 0 20px 40px rgb(0 0 0 / 0.25); transform: rotate(-2deg); transition: transform 0.25s; }
.hero-cover:hover .cover { transform: rotate(0) scale(1.02); }
.hero-body { display: grid; gap: 0.7rem; align-content: center; min-width: 0; }
.hero-body h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.hero-sub { margin: 0; color: var(--text-2); }
.hero-progress { display: grid; grid-template-columns: minmax(80px, 260px) auto; align-items: center; gap: 0.8rem; font-size: 0.85rem; color: var(--text-2); }
.hero-progress .bar { height: 6px; }
.hero-desc { margin: 0; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 62ch; }
.hero-side { display: grid; gap: 0.6rem; align-self: stretch; align-content: start; padding-left: 1.6rem; border-left: 1px solid var(--border); }
.hero-side h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-2); }
.mini { display: grid; grid-template-columns: 44px 1fr; gap: 0.8rem; align-items: center; text-decoration: none; padding: 0.35rem; margin: -0.35rem; border-radius: 10px; }
.mini:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.mini .cover { border-radius: 4px; }
.mini-body { display: grid; gap: 0.25rem; min-width: 0; }
.mini-title { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.welcome { grid-template-columns: minmax(0, 1fr) auto; padding: 2.5rem; }
.welcome-die { width: 140px; height: 140px; color: var(--accent); opacity: 0.9; margin-right: 1rem; }

/* Accueil : le grimoire du jour */
.grimoire { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 3rem; align-items: center; padding: 1.5rem 0; border-block: 1px solid var(--border); }
.grimoire-body { display: grid; gap: 0.8rem; min-width: 0; }
.grimoire-label { margin: 0; display: flex; align-items: center; gap: 0.45rem; color: var(--accent); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.grimoire h2 { font: 600 clamp(1.8rem, 4vw, 3rem)/1.08 var(--serif); letter-spacing: -0.02em; }
.grimoire h2 a { text-decoration: none; }
.grimoire h2 a:hover { color: var(--accent); }
.grimoire-desc { margin: 0; max-width: 68ch; color: var(--text-2); font: 1.05rem/1.6 var(--serif); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.grimoire-cover .cover { box-shadow: 0 3px 8px rgb(0 0 0 / 0.16), 0 24px 44px rgb(0 0 0 / 0.26); transform: rotate(2.5deg); transition: transform 0.25s; }
.grimoire-cover:hover .cover { transform: rotate(0) scale(1.02); }

/* Accueil : ce soir, on joue à quoi ? */
.choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7rem; }
.choice { display: grid; justify-content: stretch; gap: 0.1rem; text-align: left; padding: 0.75rem 0.9rem; border-radius: 12px; background: transparent; white-space: normal; }
.choice strong { font-size: 0.95rem; }
.choice span { font-size: 0.78rem; color: var(--text-2); }
.choice:hover { background: var(--surface-2); }
.choice[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.choice[aria-selected="true"] span { color: inherit; opacity: 0.72; }
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.3rem; }
.features > :nth-child(n+3) { display: none; } /* la 3e fiche n'a sa place que sur grand écran */
@media (min-width: 1680px) {
  .features { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .features > :nth-child(3) { display: grid; }
  .hero { grid-template-columns: 210px minmax(0, 1fr) 360px; }
}
.feature { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 1.1rem; padding: 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.feature-body { display: grid; gap: 0.45rem; align-content: start; min-width: 0; }
.feature h3 { font-size: 1.02rem; }
.feature h3 a { text-decoration: none; }
.feature h3 a:hover { color: var(--accent); }
.feature-desc { margin: 0; font-size: 0.85rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.feature-actions { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.3rem; flex-wrap: wrap; }

/* Accueil : gammes (piles de couvertures en éventail) */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.6rem 1.3rem; }
.game { display: grid; gap: 0.25rem; text-decoration: none; }
.stack { position: relative; height: 170px; margin-bottom: 0.7rem; }
.stack .cover { position: absolute; bottom: 0; width: 108px; transition: transform 0.25s; }
.stack .cover:nth-last-child(1) { left: 0; z-index: 3; }
.stack .cover:nth-last-child(2) { left: 34px; transform: rotate(5deg); z-index: 2; }
.stack .cover:nth-last-child(3) { left: 66px; transform: rotate(10deg); z-index: 1; }
.game:hover .stack .cover:nth-last-child(2) { transform: rotate(8deg) translateX(8px); }
.game:hover .stack .cover:nth-last-child(3) { transform: rotate(15deg) translateX(16px); }
.game strong { font-size: 0.95rem; }
.game:hover strong { color: var(--accent); }
/* Nouvelle collection (collections.js) : une pile vide, en pointillés, à la suite des collections */
.game-new { padding: 0; border: 0; background: none; color: var(--text-2); font: inherit; text-align: left; cursor: pointer; }
.game-new .stack { display: grid; place-items: center; width: 108px; border: 2px dashed var(--border); border-radius: 8px; }
.game-new .stack .icon { width: 30px; height: 30px; }
.game-new:hover .stack { border-color: var(--accent); color: var(--accent); }
.explore-tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.saga-dialog { width: min(560px, calc(100% - 2rem)); }
.saga-form .meta { margin: 0; }
.saga-list { display: grid; gap: 0.15rem; max-height: min(46vh, 420px); overflow-y: auto; padding: 0.35rem 0.6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.saga-series { padding: 0.35rem 0; }
.saga-series[hidden] { display: none; }
.saga-series span { min-width: 0; overflow-wrap: anywhere; }
/* Lecture en ligne (online.js) : le tampon de la barre du haut, le kiosque (#/manga/en-ligne) et la page d'une série.
   Mise en page ici ; le thème Manga (manga.css) l'encre. */
.online-link { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.25rem 0.7rem 0.25rem 0.3rem; color: inherit; font-size: 0.86rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.online-link[hidden] { display: none; }
.online-seal, .ol-seal { display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--accent); border-radius: 4px; color: var(--accent); font: 700 0.95rem/1 var(--jp, serif); transform: rotate(-4deg); }
.online-link:hover .online-seal, .online-link[aria-current] .online-seal { background: var(--accent); color: var(--accent-text); }
.ol-page { display: grid; gap: 1.8rem; min-width: 0; }
.ol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 1.4rem 1.1rem; }
.ol-grid-row { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.ol-card { display: grid; gap: 0.35rem; align-content: start; min-width: 0; color: inherit; text-decoration: none; }
.ol-card-art { position: relative; display: block; }
.ol-cover { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.ol-cover-empty { display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.ol-cover-empty .icon { width: 32px; height: 32px; }
.ol-card-title { font-size: 0.98rem; line-height: 1.25; overflow-wrap: anywhere; }
.ol-card:hover .ol-card-title { color: var(--accent); }
.ol-card-count { font-size: 0.76rem; }
.ol-card-new .ol-cover-empty { border: 2px dashed var(--border); background: none; }
.ol-card-new:hover .ol-cover-empty { border-color: var(--accent); color: var(--accent); }
.ol-badges { position: absolute; top: 0.45rem; left: 0.45rem; right: 0.45rem; display: flex; justify-content: space-between; gap: 0.3rem; pointer-events: none; }
.ol-lang, .ol-new { padding: 0.08rem 0.4rem; border: 1.5px solid var(--text); background: var(--surface); color: var(--text); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; }
.ol-new { display: inline-flex; gap: 0.2rem; border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.ol-progress { display: block; height: 5px; overflow: hidden; background: var(--surface-2); }
.ol-progress > span { display: block; height: 100%; background: var(--accent); }
.ol-resume { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 0.8rem; }
.ol-resume-card { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 0.8rem; padding: 0.6rem; border: 1px solid var(--border); background: var(--surface); color: inherit; text-decoration: none; }
.ol-resume-card:hover { border-color: var(--accent); }
.ol-mini { width: 56px; aspect-ratio: 2 / 3; object-fit: cover; }
.ol-resume-body { display: grid; gap: 0.25rem; min-width: 0; }
.ol-resume-body strong, .ol-resume-body > span:not(.ol-progress) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-resume-body > span:not(.ol-progress) { color: var(--text-2); font-size: 0.85rem; }
.ol-go .icon { width: 18px; height: 18px; }
.ol-search-form { display: flex; gap: 0.6rem; max-width: 640px; }
.ol-search-form input { flex: 1; min-width: 0; }
.ol-search .error:empty { display: none; }
.ol-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 0.9rem; }
.ol-result { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 0.9rem; padding: 0.7rem; border: 1px solid var(--border); background: var(--surface); }
.ol-result .cover { width: 84px; aspect-ratio: 2 / 3; object-fit: cover; }
.ol-result-body { display: grid; gap: 0.25rem; align-content: start; min-width: 0; }
.ol-desc { margin: 0.15rem 0 0; color: var(--text-2); font-size: 0.86rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ol-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin-top: 0.35rem; }
.ol-note { display: flex; gap: 0.5rem; align-items: flex-start; max-width: 80ch; margin: 0; }
.ol-note .icon { flex: none; width: 18px; height: 18px; margin-top: 0.1rem; }
.ol-back { display: inline-flex; align-items: center; gap: 0.3rem; justify-self: start; color: var(--text-2); font-weight: 600; text-decoration: none; }
.ol-back:hover { color: var(--accent); }
.ol-hero { display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr); gap: 1.6rem; align-items: start; }
.ol-hero-art { position: relative; }
.ol-hero-cover { width: 100%; }
.ol-hero-body { display: grid; gap: 0.6rem; min-width: 0; }
.ol-hero-body h1 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); line-height: 1.1; overflow-wrap: anywhere; }
.ol-hero-desc { -webkit-line-clamp: 6; max-width: 75ch; }
.ol-hero .ol-progress { max-width: 340px; }
.ol-kicker { margin: 0; display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text-2); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.ol-filter { margin-bottom: 0.4rem; }
.ol-chapters { list-style: none; margin: 0; padding: 0; display: grid; }
.ol-chapters li[hidden] { display: none; }
.ol-ch { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) auto auto; align-items: center; gap: 0.9rem; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.ol-ch:hover { background: var(--surface-2); }
.ol-num { display: grid; place-items: center; min-height: 2.3rem; padding: 0 0.3rem; background: var(--text); color: var(--surface); font-weight: 800; font-variant-numeric: tabular-nums; }
.ol-ch-body { display: grid; gap: 0.1rem; min-width: 0; }
.ol-ch-title { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.ol-ch .meta { overflow: hidden; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.ol-state { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.1rem 0.45rem; border: 1.5px solid var(--text-2); color: var(--text-2); font-size: 0.72rem; font-weight: 800; white-space: nowrap; }
.ol-state.is-read { border-color: var(--accent); color: var(--accent); transform: rotate(-3deg); }
.ol-state.is-new { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.ol-ch.is-read .ol-num { background: var(--surface-2); color: var(--text-2); }
.ol-ch.is-read .ol-ch-title { color: var(--text-2); }
.ol-ch.is-away .ol-num { background: none; color: var(--text-2); outline: 1.5px dashed var(--text-2); outline-offset: -1.5px; }
.ol-ch.is-away .ol-ch-title { color: var(--text-2); font-weight: 600; }
@media (max-width: 720px) {
  .online-label { display: none; }
}
@media (max-width: 640px) {
  .ol-hero { grid-template-columns: 110px minmax(0, 1fr); gap: 1rem; }
  .ol-ch { grid-template-columns: 3.2rem minmax(0, 1fr) auto; gap: 0.6rem; }
  .ol-ch .ol-go { display: none; }
  .ol-result { grid-template-columns: 64px minmax(0, 1fr); }
  .ol-result .cover { width: 64px; }
}

/* Accueil : le dé du destin */
.dice { grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); align-items: center; gap: 2rem; padding: 2rem; border-radius: 22px; background: var(--surface-2); }
.dice-intro { display: flex; align-items: center; gap: 1.3rem; }
.d20 { position: relative; width: 108px; height: 108px; flex: none; padding: 0; border: 0; background: none; color: var(--accent); transition: transform 0.2s; }
.d20 .icon { width: 100%; height: 100%; }
.d20:hover { transform: rotate(-12deg) scale(1.05); }
.d20.rolling { animation: roll 0.75s cubic-bezier(.3, .7, .4, 1); }
@keyframes roll { 0% { transform: rotate(0) scale(1); } 40% { transform: rotate(320deg) scale(0.85); } 100% { transform: rotate(720deg) scale(1); } }
.d20-face { position: absolute; left: 0; right: 0; top: 54%; transform: translateY(-50%); text-align: center; font: 700 0.95rem var(--sans); color: var(--text); }
.dice-result { display: grid; gap: 0.6rem; min-width: 0; }
.dice-verdict { margin: 0; font-weight: 700; color: var(--accent); }

/* Explorateur */
.explore-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.explore-head h1 { font-size: 2rem; }
.page:has(.explore-head) { gap: 1.1rem; }
.filter-chips .chip { border-color: var(--border); padding: 0.3rem 0.8rem; font-size: 0.85rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.toolbar select { max-width: 240px; font-size: 0.9rem; padding-top: 0.4rem; padding-bottom: 0.4rem; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 3px; background: var(--surface); }
.segmented button { border: 0; border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.85rem; background: none; color: var(--text-2); }
.segmented button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.results { margin-top: 0.8rem; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2rem 1.3rem; }
.grid-heading { grid-column: 1 / -1; font-size: 1.05rem; padding-top: 0.6rem; border-top: 1px solid var(--border); margin-top: 0.4rem; }
.grid-heading:first-child { border-top: 0; padding-top: 0; margin-top: 0; }


/* Liste */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.list { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.list th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); font-weight: 600; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--border); }
.list td { padding: 0.45rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: var(--surface-2); }
.list tr:last-child td { border-bottom: 0; }
.list .thumb { width: 52px; }
.list .thumb .cover { width: 34px; border-radius: 3px; }
.list .thumb .placeholder { padding: 0; }
.list .num { text-align: right; font-variant-numeric: tabular-nums; }
.list td .icon { color: var(--text-2); }
.list .group-row th { background: var(--surface-2); color: var(--text); font-size: 0.8rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--u); margin-right: 0.45rem; }
.list-progress { display: inline-grid; grid-template-columns: 60px auto; gap: 0.5rem; align-items: center; color: var(--text-2); }

/* Fiche (panneau latéral) */
dialog { color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0; width: min(460px, calc(100% - 2rem)); }
dialog::backdrop { background: rgb(10 10 12 / 0.5); backdrop-filter: blur(2px); }
dialog form { display: grid; gap: 0.9rem; padding: 1.5rem; }
dialog footer { display: flex; gap: 0.5rem; margin-top: 0.3rem; }
.sheet {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(540px, 100vw); max-width: 100vw;
  border-radius: 20px 0 0 20px; border-right: 0; overflow-y: auto; animation: slide-in 0.22s ease-out;
}
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.sheet-hero { position: relative; overflow: hidden; display: grid; place-items: center; padding: 2.6rem 1rem 1.6rem; background: color-mix(in oklab, var(--u) 20%, var(--surface)); }
.sheet-art { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(40px) saturate(1.3); opacity: 0.45; }
.sheet-hero .cover { position: relative; width: 170px; box-shadow: 0 4px 10px rgb(0 0 0 / 0.2), 0 24px 48px rgb(0 0 0 / 0.3); }
.sheet-close { position: absolute; top: 12px; right: 12px; z-index: 2; background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--text); }
.sheet-main { display: grid; gap: 0.9rem; padding: 1.4rem 1.6rem 2rem; }
.sheet-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.sheet-tags .chip { border-color: var(--border); }
.sheet-main h2 { font-size: 1.5rem; }
.sheet-sub { margin: -0.5rem 0 0; color: var(--text-2); }
.sheet-desc { margin: 0; color: var(--text-2); line-height: 1.6; }
.sheet-keywords { margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sheet-keywords span { font-size: 0.75rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem 1.2rem; margin: 0.3rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.facts dt { font-size: 0.75rem; color: var(--text-2); }
.facts dd { margin: 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.files h3 { font-size: 0.95rem; margin: 0.6rem 0 0.6rem; }
.files ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.files li { display: flex; align-items: center; gap: 0.5rem; }
.file { flex: 1; min-width: 0; display: grid; grid-template-columns: 36px 1fr; gap: 0.7rem; align-items: center; text-align: left; justify-content: stretch; border: 1px solid transparent; background: none; padding: 0.35rem; border-radius: 10px; white-space: normal; }
.file:hover { background: var(--surface-2); }
.file[aria-current="true"] { border-color: var(--border); background: var(--surface-2); }
.file .cover { border-radius: 3px; }
.file .placeholder { padding: 0; }
.file-body { display: grid; gap: 0.15rem; min-width: 0; }
.file-title { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Envois en cours */
.uploads { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: 0.5rem; width: min(340px, calc(100% - 2rem)); z-index: 40; }
.upload { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.8rem; box-shadow: var(--shadow); font-size: 0.85rem; display: grid; gap: 0.35rem; }
.upload.err { border-color: var(--danger); }
.upload .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload .state { color: var(--text-2); }
.upload.err .state { color: var(--danger); }
.drop-hint { position: fixed; inset: 0.75rem; z-index: 50; display: grid; place-items: center; pointer-events: none; border: 3px dashed var(--accent); border-radius: 18px; font-size: 1.4rem; font-weight: 700; background: color-mix(in srgb, var(--bg) 82%, transparent); }

.crash { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 60; margin: 0; padding: 0.8rem 1rem; background: var(--surface); color: var(--danger); border: 1px solid var(--danger); border-radius: 10px; box-shadow: var(--shadow); }

/* Écrans moyens et petits */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 160px minmax(0, 1fr); }
  .hero-side { grid-column: 1 / -1; border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 1.2rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .hero-side h2 { grid-column: 1 / -1; }
  .features { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023.98px) {
  .mainnav { margin-right: auto; }
  .findbar { margin-right: 0; }
}
@media (max-width: 760px) {
  .topbar-row { flex-wrap: wrap; gap: 0.6rem 0.8rem; padding: 0.6rem 1rem 0.4rem; }
  .brand-name { display: none; }
  .library-cards { grid-template-columns: minmax(0, 1fr); }
  .findbar { order: 5; flex-basis: 100%; max-width: none; margin-left: 0; }
  .topbar .chips { padding: 0.1rem 1rem 0.5rem; }
  .page { padding: 1rem 1rem 3rem; gap: 2.4rem; }
  .hero { grid-template-columns: 96px minmax(0, 1fr); gap: 1rem 1.2rem; padding: 1.2rem; align-items: start; }
  .hero-body h1 { font-size: 1.3rem; }
  .hero-desc { display: none; }
  .hero-body .actions { grid-column: 1 / -1; }
  .hero-progress { grid-template-columns: 1fr; gap: 0.3rem; }
  .welcome { grid-template-columns: 1fr; }
  .welcome-die { display: none; }
  .grimoire { grid-template-columns: minmax(0, 1fr) 96px; gap: 1rem; align-items: start; }
  .grimoire-body { display: contents; }
  .grimoire-label, .grimoire h2, .grimoire .hero-sub, .grimoire-desc, .grimoire .actions { grid-column: 1 / -1; }
  .grimoire-cover { grid-column: 2; grid-row: 1 / span 2; }
  .grimoire-label, .grimoire h2 { grid-column: 1; }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .features { grid-auto-flow: column; grid-auto-columns: 86%; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .features > * { scroll-snap-align: start; }
  .feature { grid-template-columns: 96px minmax(0, 1fr); }
  .rail { grid-auto-columns: 124px; gap: 0.9rem; }
  .tabs { gap: 1rem; }
  .tabs button, .section-head h2 { font-size: 1.1rem; }
  .games { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .stack { height: 140px; }
  .stack .cover { width: 86px; }
  .stack .cover:nth-last-child(2) { left: 26px; }
  .stack .cover:nth-last-child(3) { left: 50px; }
  .dice { grid-template-columns: 1fr; padding: 1.3rem; }
  .d20 { width: 84px; height: 84px; }
  .explore-head h1 { font-size: 1.5rem; }
  .segmented span { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 1.4rem 0.9rem; }
  .sheet { width: 100vw; border-radius: 0; }
  .facts { grid-template-columns: minmax(0, 1fr); }
}

/* Réglages */
.settings-top { max-width: 900px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: 0.8rem 1.25rem; }
/* Toute la largeur de l'écran : les blocs se rangent en colonnes d'au moins 470 px (une sur téléphone, deux sur un
   portable, trois sur un grand écran), chacun d'un seul tenant. */
.settings { padding: 1.25rem var(--gutter) 4rem; columns: 470px; column-gap: 1.25rem; }
.settings > .panel { break-inside: avoid; margin: 0 0 1.25rem; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem 1.5rem; display: grid; gap: 0.8rem; }
.panel h2 { font-size: 1.15rem; }
.panel h3 { font-size: 0.92rem; margin: 0.5rem 0 0; color: var(--text-2); font-weight: 600; }
.meter { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.meter > i.full { background: var(--danger); }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.8rem; margin: 0; }
.figures div { background: var(--surface-2); border-radius: 10px; padding: 0.6rem 0.8rem; }
.figures dt { color: var(--text-2); font-size: 0.8rem; }
.figures dd { margin: 0; font-weight: 600; }
.stored { list-style: none; margin: 0; padding: 0; display: grid; max-height: 420px; overflow: auto; }
.stored li { display: flex; align-items: center; gap: 0.8rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.stored li:last-child { border-bottom: 0; }
.stored li a { flex: 1; min-width: 0; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stored li a:hover { color: var(--accent); }
.stored li button, .stored li select { padding: 0.2rem 0.6rem; font-size: 0.82rem; }
.token-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.token-form input { flex: 1 1 220px; }
.new-token { display: grid; gap: 0.7rem; padding: 1rem; border: 1px solid var(--accent); border-radius: 10px; }
.new-token p { margin: 0; }
.copy-row { display: flex; gap: 0.5rem; align-items: flex-start; }
.copy-row input, .copy-row textarea { flex: 1; min-width: 0; font: 0.85rem/1.4 ui-monospace, monospace; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; }
.token-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
code { font: 0.88rem ui-monospace, monospace; background: var(--surface-2); padding: 0.1rem 0.4rem; border-radius: 4px; }
.drive-path { margin: 0; font-size: 0.9rem; color: var(--text-2); }
.drive-folder { color: var(--text); font-size: 0.95rem; }
.password-form { display: grid; gap: 0.7rem; max-width: 380px; }

/* Réglages › Traduction */
.tr-settings { display: flex; flex-wrap: wrap; gap: 0.8rem 1.2rem; align-items: end; margin: 0.6rem 0; }
.tr-settings label { flex: 1 1 260px; }
.tr-settings select { max-width: 100%; }
#tr-key-status:empty { display: none; }
.sub-steps { display: grid; gap: 0.6rem; margin: 0.6rem 0; padding-left: 1.3rem; }
.sub-steps .token-form { margin: 0; }
.sub-manual { margin: 0.4rem 0; font-size: 0.9rem; }
.sub-manual summary { cursor: pointer; color: var(--text-2); }
.sub-manual form { margin-top: 0.5rem; }
#translation h3 { margin: 1.1rem 0 0.4rem; font-size: 1rem; }
#sub-status:empty, #sub-limits:empty { display: none; }

/* L'actu (news.js) : les nouvelles des sites suivis, par jour. Images et textes viennent des sites : cartes sobres,
   sans grand aplat de couleur (Gabe n'en veut pas sur l'accueil). */
.news { display: grid; gap: 1.3rem; min-width: 0; }
.news-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; }
.news-heading { display: grid; gap: 0.35rem; min-width: 0; }
.news-kicker { margin: 0; display: inline-flex; align-items: center; gap: 0.45rem; color: var(--accent); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.news-kicker .icon { width: 15px; height: 15px; }
.news-head h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.news-status { min-height: 1.3em; }
.news-filters { padding: 0.1rem 0 0.2rem; }
/* Onglets de l'actu : tout, puis une catégorie par bibliothèque */
.news-tabs { display: flex; gap: 0.2rem; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.news-tabs::-webkit-scrollbar { display: none; }
.news-tab {
  display: inline-flex; align-items: center; gap: 0.45rem; flex: none; margin-bottom: -1px; padding: 0.55rem 0.95rem 0.6rem;
  border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 600; font-size: 0.93rem; text-decoration: none; white-space: nowrap;
}
.news-tab .icon { width: 17px; height: 17px; }
.news-tab:hover { color: var(--text); }
.news-tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.news-tab[aria-current="page"] .icon { color: var(--accent); }
.news-tab .shelf-new { margin-left: 0; }
.news-filters .chip.has-error::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); flex: none; }
.news-list { display: grid; gap: 2rem; min-width: 0; }
.news-day { display: grid; gap: 0.8rem; min-width: 0; }
.news-date { display: flex; align-items: center; gap: 0.8rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-2); }
.news-date::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 1rem; min-width: 0; }
.news-card {
  display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 0.95rem; align-items: start; min-width: 0; padding: 0.85rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: inherit; text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
a.news-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.news-card.is-fresh { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.news-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: var(--surface-2); color: var(--text-2); }
.news-thumb .icon { width: 26px; height: 26px; opacity: 0.55; }
.news-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.news-body { display: grid; gap: 0.3rem; min-width: 0; }
.news-source { display: flex; align-items: center; gap: 0.25rem 0.5rem; flex-wrap: wrap; min-width: 0; font-size: 0.75rem; color: var(--text-2); }
.news-feed { font-weight: 650; color: var(--accent); min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-favicon { width: 14px; height: 14px; border-radius: 3px; object-fit: contain; }
.news-lib { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 600; color: var(--text); }
.news-lib .icon { width: 13px; height: 13px; }
.news-new { padding: 0.02rem 0.45rem; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 0.68rem; font-weight: 700; }
.news-title { font-weight: 650; font-size: 0.98rem; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-summary { font-size: 0.85rem; line-height: 1.45; color: var(--text-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.1rem; }
.news-tags span { font-size: 0.7rem; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.news-more { justify-self: center; }
.news-empty .danger-text { margin: 0; font-size: 0.88rem; }
.news-ideas { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.5rem; max-width: 760px; margin-top: 0.4rem; }
.news-ideas .meta { width: 100%; }
.news-strip .news-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.news-cta { display: inline-flex; align-items: center; gap: 0.45rem; margin-top: -0.6rem; padding: 0.4rem 0.9rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 0.88rem; font-weight: 600; text-decoration: none; }
.news-cta:hover { color: var(--text); border-color: var(--text-2); }
.news-cta .icon:first-child { color: var(--accent); }
.news-kind { padding: 0 0.45rem; border: 1px solid currentColor; border-radius: 999px; color: var(--accent); font-size: 0.68rem; font-weight: 700; }
.news-tags .news-price { font-weight: 700; color: var(--text); }

/* Vitrines de l'actu (offerCard) : nouveautés, précommandes, financements. Les images viennent des sites : une couverture
   de livre (plus haute que large) se montre entière sur un fond flouté d'elle-même, une bannière remplit le cadre. */
.news-kinds { padding: 0 0 0.2rem; }
.chip-count { color: var(--text-2); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.news-shelves { display: grid; gap: 1.8rem; min-width: 0; }
.news-shelf { display: grid; gap: 0.8rem; min-width: 0; }
.news-shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.news-shelf-head h2, .news-part { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 1.15rem; }
.news-shelf-head h2 .icon, .news-part .icon { width: 18px; height: 18px; color: var(--accent); }
.news-part { margin-top: 0.3rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 1rem; min-width: 0; }
.offer {
  display: grid; grid-template-rows: auto 1fr; min-width: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: inherit; text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
a.offer:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.offer.is-fresh { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.offer-cover { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); color: var(--text-2); }
.offer-cover > .icon { width: 30px; height: 30px; opacity: 0.5; }
.offer-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.offer-cover img.is-tall { object-fit: contain; padding: 0.55rem 0; }
.offer-cover .offer-backdrop { filter: blur(16px) saturate(1.2); transform: scale(1.25); opacity: 0.6; }
.offer.is-ended .offer-cover img:not(.offer-backdrop) { filter: grayscale(0.75); opacity: 0.8; }
.offer-badges { position: absolute; top: 0.5rem; left: 0.5rem; right: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.offer-badge { padding: 0.12rem 0.55rem; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 0.7rem; font-weight: 700; box-shadow: var(--shadow-cover); }
.offer-badge.is-new, .offer-badge.is-preorder { background: var(--accent); color: var(--accent-text); }
.offer-badge.is-campaign { background: var(--text); color: var(--surface); }
.offer.is-ended .offer-badge.is-campaign { background: var(--surface); color: var(--text-2); }
.offer-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; padding: 0.7rem 0.8rem 0.75rem; }
.offer-title { font-weight: 650; font-size: 0.93rem; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.offer-meta { overflow: hidden; color: var(--text-2); font-size: 0.74rem; text-overflow: ellipsis; white-space: nowrap; }
.offer-bar { height: 4px; margin-top: 0.15rem; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.offer-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.offer-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-top: auto; padding-top: 0.15rem; font-size: 0.82rem; }
.offer-price { overflow: hidden; font-weight: 700; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.offer-time { flex: none; color: var(--text-2); font-size: 0.74rem; }
@media (max-width: 640px) {
  .news-card { grid-template-columns: 64px minmax(0, 1fr); gap: 0.75rem; padding: 0.7rem; }
  .news-summary { -webkit-line-clamp: 2; }
  .news-strip .news-card:nth-child(n+3) { display: none; }
  .offer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
  .offer-body { padding: 0.55rem 0.6rem 0.6rem; }
  .offer-title { font-size: 0.86rem; }
}

/* Sources de l'actu (administrateur) */
.news-sources { width: min(780px, calc(100% - 2rem)); }
.news-sources-body { display: grid; gap: 1.2rem; padding: 1.3rem 1.5rem 1.6rem; }
.news-sources-body > .error:empty { display: none; }
.news-sources-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.news-sources-head h2 { font-size: 1.3rem; }
.news-add {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 190px) minmax(0, 160px) auto; gap: 0.6rem 0.8rem; align-items: end; padding: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.news-add input, .news-add select { width: 100%; }
.news-add-hint, .news-add .error { grid-column: 1 / -1; }
.news-sources-part { display: grid; gap: 0.8rem; }
.news-sources-part > h3 { font-size: 1rem; }
.news-sources-group { display: grid; gap: 0.2rem; }
.news-sources-group h4 { margin: 0; display: flex; align-items: center; gap: 0.45rem; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.news-sources-group h4 .icon { width: 15px; height: 15px; color: var(--accent); }
.news-sources-group ul { list-style: none; margin: 0; padding: 0; display: grid; }
.news-source-row, .news-idea { display: grid; align-items: center; gap: 0.4rem 0.7rem; padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--border); }
.news-source-row { grid-template-columns: minmax(0, 1fr); }
.news-source-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.7rem; }
.news-source-controls select { width: auto; max-width: 100%; }
.news-source-controls .iconbtn { margin-left: auto; }
.news-idea { grid-template-columns: minmax(0, 1fr) auto; }
.news-source-row:last-child, .news-idea:last-child { border-bottom: 0; }
.news-source-info { display: grid; gap: 0.1rem; min-width: 0; }
.news-source-info .meta { overflow-wrap: anywhere; }
.news-source-info a { color: var(--text-2); }
.news-source-row select { padding-block: 0.3rem; font-size: 0.85rem; }
@media (max-width: 640px) {
  .news-sources-body { padding: 1.1rem 1rem 1.3rem; }
  .news-add { grid-template-columns: 1fr; }
}
