/* Navigation et cadre de lecture */
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 750;
  font-display: swap;
}
@font-face {
  font-family: Lora;
  src: url("fonts/lora.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font-ui: "DM Sans", system-ui, sans-serif;
  --ui-serif: Lora, Georgia, serif;
  --bar-h: 4.25rem;
  --nav-h: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  --content-gutter: clamp(1rem, 4vw, 3rem);
  --content-max: 72rem;
  --touch-target: 44px;
  --radius-card: clamp(1rem, 2vw, 1.25rem);
  --bandink: #fff5f2;
  --burg: #752b47;
  --burg-ink: #fff;

  --bg-light: #f5f0e8;
  --bg-dark: #1b1718;
  --ink-light: #29221e;
  --ink-dark: #f5ebe2;
  --soft-light: #65584f;
  --soft-dark: #c6b8b0;
  --line-light: #dfd4c8;
  --line-dark: #4a3d3e;
  --card-light: #fffdf8;
  --card-dark: #282122;
  --rose-light: #f2e3e9;
  --rose-dark: #482d39;
  --rose2-light: #f7e9e4;
  --rose2-dark: #422d2c;
  --band-light: #752b47;
  --band-dark: #4e293a;
  --acc-light: #752b47;
  --acc-dark: #f0abc4;
  --on-acc-light: #fff;
  --on-acc-dark: #381a29;
  --teal-light: #335b46;
  --teal-dark: #a5c6ac;
  --wood-light: #bc9874;
  --wood-dark: #6c5341;
  --wood2-light: #8f6548;
  --wood2-dark: #503926;
  --glass-light: rgba(255, 253, 248, .96);
  --glass-dark: rgba(40, 33, 34, .94);
  --nav-surface-light: #fcf8f1;
  --nav-surface-dark: #231d1e;
  --outline-light: #88796f;
  --outline-dark: #b0a096;

  --bg: var(--bg-light);
  --ink: var(--ink-light);
  --soft: var(--soft-light);
  --line: var(--line-light);
  --card: var(--card-light);
  --rose: var(--rose-light);
  --rose2: var(--rose2-light);
  --band: var(--band-light);
  --acc: var(--acc-light);
  --on-acc: var(--on-acc-light);
  --teal: var(--teal-light);
  --wood: var(--wood-light);
  --wood2: var(--wood2-light);
  --glass: var(--glass-light);
  --nav-surface: var(--nav-surface-light);
  --outline: var(--outline-light);
}

:root[data-platform="android"] {
  --font-ui: Roboto, system-ui, sans-serif;
  --ui-serif: var(--font-ui);
  --touch-target: 48px;
  --radius-card: 1rem;
  --burg: #842646;
  --bg-light: #f5f5f7;
  --bg-dark: #121215;
  --card-light: #fff;
  --card-dark: #202025;
  --ink-light: #212127;
  --ink-dark: #f0edf1;
  --soft-light: #61616b;
  --soft-dark: #c7c2cb;
  --line-light: #e0dfe5;
  --line-dark: #424148;
  --rose-light: #f4e6ed;
  --rose-dark: #462a38;
  --acc-light: #842646;
  --acc-dark: #f3adc8;
  --nav-surface-light: #fff;
  --nav-surface-dark: #202025;
}
:root[data-platform="android"] .topbar-title { letter-spacing: -.025em; }
@media (max-width: 579px) {
  :root[data-platform="android"] { --bar-h: 3.65rem; }
  :root[data-platform="android"] .page-head h2 {
    font-size: clamp(1.65rem, 7vw, 2.1rem);
    letter-spacing: -.025em;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--bg-dark);
  --ink: var(--ink-dark);
  --soft: var(--soft-dark);
  --line: var(--line-dark);
  --card: var(--card-dark);
  --rose: var(--rose-dark);
  --rose2: var(--rose2-dark);
  --band: var(--band-dark);
  --acc: var(--acc-dark);
  --on-acc: var(--on-acc-dark);
  --teal: var(--teal-dark);
  --wood: var(--wood-dark);
  --wood2: var(--wood2-dark);
  --glass: var(--glass-dark);
  --nav-surface: var(--nav-surface-dark);
  --outline: var(--outline-dark);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: var(--bg-dark);
    --ink: var(--ink-dark);
    --soft: var(--soft-dark);
    --line: var(--line-dark);
    --card: var(--card-dark);
    --rose: var(--rose-dark);
    --rose2: var(--rose2-dark);
    --band: var(--band-dark);
    --acc: var(--acc-dark);
    --on-acc: var(--on-acc-dark);
    --teal: var(--teal-dark);
    --wood: var(--wood-dark);
    --wood2: var(--wood2-dark);
    --glass: var(--glass-dark);
    --nav-surface: var(--nav-surface-dark);
    --outline: var(--outline-dark);
  }
}

*, *::before, *::after { box-sizing: border-box; min-width: 0; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.5 var(--font-ui);
  display: grid;
  grid-template-areas: "notice" "header" "content" "navigation";
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  overscroll-behavior: none;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
h1, h2, h3 { font: 700 1.25rem/1.15 var(--font-ui); margin: 0; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
#modal { position: fixed; z-index: 45; }
.skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 100;
  padding: .65rem .85rem;
  background: var(--card);
  color: var(--acc);
  border-radius: .6rem;
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }


.maintenance-banner {
  grid-area: notice;
  background: var(--rose2);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: env(safe-area-inset-top, 0px) max(var(--content-gutter), env(safe-area-inset-right, 0px)) 0 max(var(--content-gutter), env(safe-area-inset-left, 0px));
  font: 600 .875rem/1.35 var(--font-ui);
}
.maintenance-text { flex: 1; padding-block: .45rem; }
.maintenance-close {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 1.125rem;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
}
.maintenance-banner:not([hidden]) + .topbar { --top-inset: 0px; }

.topbar {
  --top-inset: env(safe-area-inset-top, 0px);
  grid-area: header;
  min-height: calc(var(--bar-h) + var(--top-inset));
  padding: var(--top-inset) max(var(--content-gutter), env(safe-area-inset-right, 0px)) 0 max(var(--content-gutter), env(safe-area-inset-left, 0px));
  background: var(--card);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  border-bottom: 1px solid var(--line);
  z-index: 20;
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: clamp(.35rem, 2vw, .7rem);
  color: var(--acc);
  font: 700 clamp(1.125rem, 4.15vw, 1.48rem)/1.2 var(--ui-serif);
  letter-spacing: -.055em;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: clamp(1.55rem, 7vw, 2.45rem);
  aspect-ratio: 1;
  border-radius: 32%;
  background: var(--burg);
  color: var(--burg-ink);
}
.brand-mark::before {
  content: "";
  display: block;
  width: 28%;
  height: 47%;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 70%, 0 100%);
}
.topbar-actions { display: flex; align-items: center; gap: clamp(0px, 1.45vw, .6rem); }
.topbar-btn, .topbar-avatar {
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  padding: .35rem .55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border: 1px solid transparent;
  border-radius: .75rem;
  background: transparent;
  color: var(--ink);
  font: 700 .875rem/1.2 var(--font-ui);
  cursor: pointer;
}
.topbar-avatar { background: var(--rose); color: var(--acc); border-radius: 50%; }
.topbar-btn svg, .topbar-avatar svg { flex: none; }
.topbar-btn:active, .topbar-avatar:active { opacity: .76; }
.topbar-action-text { display: none; }
.topbar-scan { color: var(--acc); }

.topbar-title .brand-name { overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { flex: 0 0 auto; }
.topbar-notifications { position: relative; }
.notifications-badge {
  position: absolute;
  inset-block-start: .15rem;
  inset-inline-end: .1rem;
  min-inline-size: 1.16rem;
  padding: .15rem .22rem;
  border: 1px solid var(--card);
  border-radius: 999px;
  background: var(--burg);
  color: var(--burg-ink);
  font-size: .66rem;
  font-weight: 750;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 380px) {
  .topbar { --content-gutter: .75rem; }
  .topbar-title { font-size: clamp(.9rem, 4.6vw, 1.125rem); }
  .topbar-title .brand-mark { display: none; }
  .topbar-actions { gap: 0; }
}

.pages {
  grid-area: content;
  position: relative;
  min-height: 0;
  min-width: 0;
}
.page { display: none; position: absolute; inset: 0; }
.page.active { display: block; }
.page-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: clamp(1.35rem, 5vw, 3.5rem)
    max(var(--content-gutter), env(safe-area-inset-right, 0px), (100% - var(--content-max)) / 2)
    clamp(1.5rem, 6vw, 4rem)
    max(var(--content-gutter), env(safe-area-inset-left, 0px), (100% - var(--content-max)) / 2);
  -webkit-overflow-scrolling: touch;
}
.page-head { margin-bottom: clamp(1.2rem, 4vw, 2rem); }
.page-head h2 {
  font: 600 clamp(1.95rem, 6vw, 3.75rem)/1.1 var(--ui-serif);
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.page-sub { color: var(--soft); margin: .45rem 0 0; font-size: .9375rem; }

.bottomnav {
  grid-area: navigation;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  min-height: var(--nav-h);
  padding: .25rem max(.25rem, env(safe-area-inset-right, 0px))
    calc(.25rem + env(safe-area-inset-bottom, 0px)) max(.25rem, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--line);
  background: var(--nav-surface);
  z-index: 20;
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .28rem;
  min-height: var(--touch-target);
  background: transparent;
  color: var(--soft);
  border: 0;
  border-radius: .75rem;
  padding: .3rem 0;
  font: 650 .72rem/1.1 var(--font-ui);
  cursor: pointer;
  user-select: none;
}
.nav-btn.active { color: var(--acc); font-weight: 750; }
.nav-btn:active { opacity: .72; }
.nav-btn:focus-visible { outline-offset: -2px; }
.nav-icon { flex: none; }
.nav-glyph {
  width: clamp(2.8rem, 15vw, 3.7rem);
  min-height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
}
.nav-btn.active .nav-glyph { background: var(--rose); }

@media (hover: hover) {
  .topbar-btn:hover, .nav-btn:hover { background: var(--rose); color: var(--acc); }
}
@media (min-width: 580px) {
  .topbar-action-text { display: inline; }
  .topbar-scan { padding-inline: .9rem; background: var(--rose); }
}
@media (max-height: 480px) and (max-width: 899px) {
  :root { --bar-h: 3.25rem; --nav-h: calc(3.25rem + env(safe-area-inset-bottom, 0px)); }
  .nav-btn { flex-direction: row; gap: .25rem; }
  .nav-glyph { width: 1.65rem; }
  .nav-icon { width: 18px; height: 18px; }
}
@media (min-width: 900px) {
  body {
    grid-template-areas: "notice notice" "header header" "navigation content";
    grid-template-columns: clamp(10.5rem, 17vw, 14rem) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  :root { --bar-h: 4.8rem; --nav-h: 0px; }
  .bottomnav {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: .35rem;
    padding: clamp(1.25rem, 3vw, 2.2rem) clamp(.55rem, 1.7vw, 1.2rem);
    border-top: 0;
    border-right: 1px solid var(--line);
    overflow-y: auto;
  }
  .nav-btn { flex-direction: row; justify-content: start; gap: .65rem; padding: .5rem .8rem; font-size: .95rem; }
  .nav-btn.active { background: var(--rose); }
  .nav-glyph { width: 1.55rem; }
  .nav-btn.active .nav-glyph { background: none; }
}

/* ---- Shared card ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ============================================================
   PAGE AUJOURD'HUI
   ============================================================ */

.today-reading-card {
  background: var(--rose);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}
.today-reading-card-header, .today-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.today-reading-card-header { padding: 6px 14px; }
.today-reading-card-header h3, .today-section-head h3 { font-size: 20px; }
.today-reading-card-body {
  padding: 0 14px 14px;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.today-reading-card-info h4 { margin: 0 0 2px; }
.today-book-link {
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  text-align: start;
  min-height: 44px;
  padding: 0;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.today-reading-card-info .by { color: var(--soft); font-size: 14px; margin-bottom: 10px; }
.today-reading-card-footer { padding: 0 14px 14px; }
.today-continue-btn {
  width: 100%;
  background: var(--burg);
  color: var(--burg-ink);
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  padding: 8px 14px;
  min-height: 44px;
  cursor: pointer;
}
.today-continue-btn:active { opacity: .75; }

.today-goal-card {
  width: 100%;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  text-align: start;
  font: inherit;
  cursor: pointer;
}
.today-goal-ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: conic-gradient(var(--burg) var(--progress), var(--line) 0);
  color: var(--ink);
  display: grid;
  place-items: center;
  flex: none;
}
.today-goal-ring span {
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--card);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.today-goal-body { flex: 1; min-width: 0; }
.today-goal-label { display: block; font-weight: 600; }
.today-goal-progress { display: block; font-size: 14px; color: var(--soft); }

.today-section { margin-bottom: 24px; }
.today-section-head { margin-bottom: 6px; }
.today-section-head button.seeall, .today-reading-card-header button.seeall {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--burg);
  background: none;
  border: 0;
  padding: 4px;
  min-height: 44px;
  cursor: pointer;
  flex: none;
}
.today-book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(76px, 40%), 1fr));
  gap: 10px;
}
.today-book {
  min-width: 0;
  display: block;
  text-align: start;
  align-self: start;
  color: var(--ink);
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.today-book .book-card-cover { border-radius: 6px 10px 10px 6px; }
.today-book-title {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.today-section-empty { margin: 0; }

.today-progress {
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 4px;
  appearance: none;
  background: var(--line);
  accent-color: var(--burg);
}
.today-progress::-webkit-progress-bar { background: var(--line); border-radius: 4px; }
.today-progress::-webkit-progress-value { background: var(--burg); border-radius: 4px; }
.today-progress::-moz-progress-bar { background: var(--burg); border-radius: 4px; }
.today-progress-heading, .today-progress-acts, .today-empty-acts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.today-progress-heading { justify-content: space-between; }
.today-progress-acts { margin-top: 12px; }
.today-progress-acts .btn { min-width: 44px; }
.today-empty-acts { justify-content: center; margin-top: 12px; }

/* Carte inscription */
.signup-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--rose);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(125,29,44,.08);
}
.signup-card-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--burg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
  filter: grayscale(1) brightness(2);
}
.signup-card-body h3 { font-size: 18px; margin-bottom: 4px; }
.signup-card-body .muted { margin: 0 0 12px; }
.signup-card-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* État vide */
.today-empty {
  background: var(--rose);
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  padding: 24px 20px;
  color: var(--soft);
  text-align: center;
  margin-bottom: 16px;
}
.today-empty p { margin: 0 0 14px; }

/* ============================================================
   PAGE BIBLIOTHÈQUE
   ============================================================ */

/* Barre de recherche */
.search-row { margin-bottom: 14px; }
.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  min-height: 44px;
  cursor: text;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.search-icon { color: var(--soft); flex-shrink: 0; }
.search-input {
  flex: 1;
  font: 16px var(--font-ui);
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
  min-height: 40px;
  padding: 0;
}
.search-input::placeholder { color: var(--soft); }
.search-wrap:focus-within { outline: 2px solid var(--acc); outline-offset: 2px; }

/* Filtres + view toggle */
.filter-chips {
  margin-bottom: 14px;
}
.filter-chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 3px;
}
.filter-chips-row::-webkit-scrollbar { display: none; }
.library-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 8px;
}
.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--line);
  border-radius: 10px;
  padding: 2px;
  width: fit-content;
}
.view-btn {
  width: 48px; height: 48px;
  border: 0; background: transparent; border-radius: 8px;
  color: var(--soft); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.view-btn.active { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.result-count {
  font: 600 13px var(--font-ui);
  color: var(--soft);
  margin: 8px 0 12px;
}
.filter-chip {
  flex-shrink: 0;
  font: 600 14px var(--font-ui);
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--soft);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.filter-chip.active {
  background: var(--burg);
  color: var(--burg-ink);
  border-color: var(--burg);
}
.filter-chip-count { opacity: .8; }
.filter-chip:focus-visible,
.view-btn:focus-visible,
.book-card:focus-visible,
.book-row:focus-visible,
.book-spine:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }

/* Grille de livres */
.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (min-width: 480px) { .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 700px) { .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 900px) { .book-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.book-card,
.book-row {
  font: inherit;
  color: var(--ink);
  text-align: start;
}
.book-card {
  display: block;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.book-card:active { transform: scale(.97); box-shadow: 0 1px 2px rgba(0,0,0,.07); }
.book-card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 2/3;
  position: relative;
  overflow: hidden;
}
.book-card-cover-inner {
  background-image: linear-gradient(#0003, #0003);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 5px 0 0 rgba(0,0,0,.18);
}
.book-card-cover-inner::after {
  content: "";
  position: absolute;
  left: 5px; right: 5px; bottom: 10px;
  height: 2px;
  background: rgba(255,255,255,.45);
}
.book-card-cover-inner span {
  font: 400 11px/1.2 Georgia, serif;
  color: #fff;
  padding: 8px 7px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  z-index: 1;
  text-align: center;
}
.book-card-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}
.book-card-body { display: block; padding: 10px 10px 12px; }
.book-card-title { font-size: 14px; font-weight: 600; line-height: 1.3; margin-bottom: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-card-author { display: block; font-size: 12px; color: var(--soft); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-card-rating { display: block; color: var(--acc); font-size: 12px; margin-top: 4px; }
.book-favorite { color: var(--acc); font-size: 12px; }
.status-badge {
  display: inline-block;
  font: 600 11px var(--font-ui);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-badge.reading { background: #fce4e7; color: #7d1d2c; }
.status-badge.toread  { background: #e4f0fc; color: #1a4b7d; }
.status-badge.read    { background: #e4fce8; color: #1a5c27; }
.status-badge.wish    { background: #fce4f4; color: #6b1a5a; }
.status-badge.dropped { background: #f0f0f0; color: #555; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .status-badge.reading { background: #4a1020; color: #f4a7b3; }
  :root:not([data-theme="light"]) .status-badge.toread  { background: #0d2c47; color: #89c0f5; }
  :root:not([data-theme="light"]) .status-badge.read    { background: #0d3017; color: #7ed895; }
  :root:not([data-theme="light"]) .status-badge.wish    { background: #2f0a28; color: #e097d2; }
  :root:not([data-theme="light"]) .status-badge.dropped { background: #2a2628; color: #a09098; }
  :root:not([data-theme="light"]) .series-badge { background: #3a1a20; color: #f4a7b3; }
  :root:not([data-theme="light"]) .series-count { background: #3a1a20; color: #b7a9ad; }
}
[data-theme="dark"] .status-badge.reading { background: #4a1020; color: #f4a7b3; }
[data-theme="dark"] .status-badge.toread  { background: #0d2c47; color: #89c0f5; }
[data-theme="dark"] .status-badge.read    { background: #0d3017; color: #7ed895; }
[data-theme="dark"] .status-badge.wish    { background: #2f0a28; color: #e097d2; }
[data-theme="dark"] .status-badge.dropped { background: #2a2628; color: #a09098; }
[data-theme="dark"] .series-badge { background: #3a1a20; color: #f4a7b3; }
[data-theme="dark"] .series-count { background: #3a1a20; color: #b7a9ad; }

/* Series grouping in library */
.series-group {
  margin-bottom: 20px;
}
.series-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px 8px;
}
.series-name {
  font: 600 16px var(--font-ui);
  color: var(--ink);
}
.series-count {
  font: 600 12px var(--font-ui);
  color: var(--soft);
  background: var(--rose);
  padding: 3px 10px;
  border-radius: 999px;
}
.series-badge {
  display: inline-block;
  font: 700 10px var(--font-ui);
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--band);
  color: var(--bandink);
  margin-right: 4px;
  vertical-align: middle;
}
.series-separator {
  height: 1px;
  background: var(--line);
  margin: 8px 0 20px;
}

/* Book list view */
.book-list { display: flex; flex-direction: column; gap: 8px; }
.book-row {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.book-row:active { opacity: .8; }
.book-row-cover {
  width: 48px; height: 68px;
  border-radius: 3px 6px 6px 3px;
  overflow: hidden;
  box-shadow: inset 4px 0 0 rgba(0,0,0,.18);
  position: relative;
}
.book-row-cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.book-row-title { font: 600 15px/1.3 var(--font-ui); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.book-row-author { display: block; font-size: 13px; color: var(--soft); margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.book-row-pct { font: 700 14px var(--font-ui); color: var(--acc); }

/* Book shelf view (spines) */
.book-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  grid-auto-rows: 120px;
  gap: 20px 4px;
  padding: 4px 4px 16px;
  background: repeating-linear-gradient(to bottom, transparent 0 124px, var(--wood) 124px 130px, transparent 130px 140px);
}
.book-spine {
  background-image: linear-gradient(#0003, #0003);
  border: 0;
  padding: 0;
  border-radius: 2px 4px 4px 2px;
  box-shadow: inset 3px 0 0 rgba(0,0,0,.2), 1px 0 2px rgba(0,0,0,.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform .12s;
}
.book-spine:active { transform: translateY(-6px); }
.book-spine span {
  writing-mode: vertical-lr;
  text-orientation: mixed;
  font: 600 9px/1.1 var(--font-ui);
  color: #fff;
  padding: 6px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 100%;
}

/* ============================================================
   PAGE STATISTIQUES
   ============================================================ */

/* Grille de cartes de stats */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  position: relative;
  overflow: hidden;
}
.stat-card-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 8px;
}
.stat-card-label {
  font: 600 13px var(--font-ui);
  color: var(--soft);
  margin-bottom: 4px;
}
.stat-card-value {
  font: 750 2rem/1.1 var(--font-ui);
  color: var(--ink);
  margin-bottom: 4px;
}
.stat-card-sub {
  font-size: 12px;
  color: var(--soft);
}
.stat-card-arrow {
  position: absolute;
  top: 16px;
  right: 14px;
  color: var(--soft);
  font-size: 18px;
}
.stat-card.goal-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding-inline-end: 32px;
  color: var(--ink);
  text-align: start;
  font: inherit;
  cursor: pointer;
}
.stat-card.goal-card:active { opacity: .8; }
.stat-card.goal-card:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.stat-goal-ring {
  flex: none;
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 68px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--acc) var(--goal-percent), var(--line) 0);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.stat-goal-ring::before {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: -1;
  border-radius: 50%;
  background: var(--card);
}
.stat-goal-details > span { display: block; }
.stat-goal-details .stat-card-value { font-size: 24px; overflow-wrap: anywhere; }
.stat-goal-details .stat-card-sub { color: var(--acc); }
.stat-rating-scale { font-size: .55em; }

/* Graphique mensuel — barres CSS */
.chart-section { margin-bottom: 24px; }
.chart-section h3 { font-size: 20px; margin-bottom: 14px; }
.month-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 86px;
  gap: 12px 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 10px 0;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.month-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.month-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.month-bar {
  width: 70%;
  border-radius: 3px 3px 0 0;
  background: var(--acc);
  opacity: .72;
  transition: height .3s ease;
}
.month-bar.current { opacity: 1; }
.month-label {
  font-size: 9px;
  color: var(--soft);
  font-weight: 600;
  letter-spacing: .02em;
  padding-bottom: 6px;
  text-transform: uppercase;
  line-height: 1;
}
.month-count {
  font: 600 11px var(--font-ui);
  color: var(--soft);
  min-height: 14px;
  overflow-wrap: anywhere;
}
@media (max-width: 400px) {
  .month-chart { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Genres préférés — barres horizontales */
.genre-chart { margin-bottom: 20px; }
.genre-chart h3 { font-size: 20px; margin-bottom: 14px; }
.genre-rows {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.genre-row {
  display: grid;
  grid-template-columns: minmax(0, 7em) minmax(0, 1fr) minmax(2.2em, auto);
  gap: 10px;
  align-items: center;
  font-size: 14px;
}
.genre-row > span:first-child { overflow-wrap: anywhere; }
.genre-row-bar-wrap { background: var(--line); border-radius: 4px; height: 10px; overflow: hidden; }
.genre-row-bar { height: 100%; border-radius: 4px; background: var(--teal); }
.genre-row-count { text-align: right; color: var(--soft); font-weight: 600; font-size: 13px; }

/* ============================================================
   ÉLÉMENTS PARTAGÉS
   ============================================================ */

/* Barre de progression */
.pbar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--teal); border-radius: 4px; }
.prow { display: flex; justify-content: space-between; font-size: 13px; color: var(--soft); margin-top: 5px; font-variant-numeric: tabular-nums; }

/* Couverture */
.cover {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: 3px 7px 7px 3px;
  padding: 8px 7px;
  color: #fff;
  font: 400 11px/1.15 Georgia, serif;
  overflow: hidden;
  box-shadow: inset 6px 0 0 rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.2);
}
.cover::after {
  content: "";
  position: absolute;
  left: 6px; right: 6px; bottom: 10px;
  height: 2px;
  background: rgba(255,255,255,.55);
}
.cover span {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }

/* État vide générique */
.empty {
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  padding: 22px;
  color: var(--soft);
  text-align: center;
}
.empty p { margin: 0 0 14px; }

/* Boutons */
.btn {
  font: 600 15px var(--font-ui);
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  min-height: 44px;
  cursor: pointer;
  background: var(--acc);
  color: var(--on-acc);
  transition: opacity .15s;
}
.btn:active { opacity: .75; }
.btn.ghost  { background: transparent; color: inherit; border: 1.5px solid currentColor; }
.btn.quiet  { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: #b3261e; color: #fff; }
.btn.burg   { background: var(--burg); color: var(--burg-ink); }
.btn:focus-visible, .chip:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }

/* Chip */
.chip {
  font: 600 14px var(--font-ui);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 44px;
  cursor: pointer;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ============================================================
   MODALES & FICHE LIVRE
   ============================================================ */
.veil {
  position: fixed;
  inset: 0 0 var(--keyboard-inset, 0px);
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(20,10,12,.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 30;
}
.sheet {
  background: var(--bg);
  color: var(--ink);
  width: min(640px, 100%);
  max-height: 100%;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 28px max(20px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  position: relative;
}
.sheet::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 36px;
  height: 5px;
  margin-left: -18px;
  border-radius: 3px;
  background: var(--line);
}
@media (min-width: 700px) { .veil { align-items: center; } .sheet { border-radius: 20px; } }
.sheet h2 { font-size: 28px; }
.book-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.book-sheet-actions .btn,
.book-sheet .book-bottom-acts .btn,
.book-progress-open { min-height: 44px; }
.book-hero {
  display: grid;
  grid-template-columns: clamp(64px, 23vw, 100px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--rose);
}
.book-hero .cover {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
}
.book-hero .cover img + span { display: none; }
.book-hero-info h2 {
  font-size: clamp(20px, 5.5vw, 26px);
  line-height: 1.2;
  overflow-wrap: anywhere;
  margin-bottom: 4px;
}
.book-hero-author { color: var(--soft); font-size: 15px; margin-bottom: 10px; overflow-wrap: anywhere; }
.book-hero-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.genre-tag,
.book-favorite {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--soft);
}
.book-section-title {
  color: var(--ink);
  font: 600 16px system-ui, sans-serif;
  margin: 20px 0 10px;
}
.book-detail-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 16px 0 0;
  padding: 0 12px;
}
.book-detail-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 10px;
  padding: 10px 0;
}
.book-detail-list > div + div { border-top: 1px solid var(--line); }
.book-detail-list dt { color: var(--soft); }
.book-detail-list dd { margin: 0; overflow-wrap: anywhere; }
.book-review { white-space: pre-wrap; overflow-wrap: anywhere; }
.book-score { color: var(--acc); }
.book-progress-info { color: var(--soft); margin-bottom: 8px; }
.book-progress-open { margin-top: 10px; }
.book-edit-sheet .scan { margin-top: 12px; }
.book-scan-status { margin-top: 8px; }
.book-scan-status:empty { display: none; }
.book-edit-sheet .status-seg {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 6px;
}
.book-edit-sheet .status-seg-btn,
.book-step-btn {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  color: var(--ink);
  background: var(--card);
  font: 600 14px var(--font-ui);
  cursor: pointer;
}
.book-edit-sheet .status-seg-btn.active,
.book-step-btn:active { background: var(--burg); color: var(--burg-ink); }
.book-step-row,
.book-rating-row,
.book-del-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.book-step-btn { flex: 1; }
.book-dates-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(115px, 1fr)); gap: 12px; }
.book-isbn-row { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.book-isbn-field { flex: 1 1 110px; min-width: 0; }
.book-rating-row .rate { flex-wrap: wrap; }
.book-rating-row .btn { min-height: 44px; }
.book-bottom-acts { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.book-save-btn { width: 100%; }
.book-delete-confirm { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px; }
label { display: block; font: 600 12px var(--font-ui); color: var(--soft); margin-bottom: 2px; }
.book-date-body input[type="date"] { padding: 4px 0; border: 0; min-height: 28px; font-size: 14px; background: transparent; }
/* Book detail — rating */
.book-rating-row { display: flex; align-items: center; gap: 12px; }
/* Book detail — ISBN */
.book-isbn-row {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-top: 18px;
}
.book-isbn-icon { color: var(--soft); flex-shrink: 0; }
.book-isbn-field { flex: 1; min-width: 0; }
.book-isbn-label { display: block; font: 600 12px var(--font-ui); color: var(--soft); margin-bottom: 2px; }
.book-isbn-field input { border: 0; padding: 4px 0; min-height: 28px; background: transparent; }
/* Book detail — extra info (collapsible) */
.book-extra { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.book-extra summary {
  font: 600 15px var(--font-ui);
  padding: 14px 16px; cursor: pointer; color: var(--burg);
  list-style: none; display: flex; align-items: center; justify-content: space-between;
}
.book-extra summary::after { content: "›"; font-size: 20px; transition: transform .2s; }
.book-extra[open] summary::after { transform: rotate(90deg); }
.book-extra summary::-webkit-details-marker { display: none; }
.book-extra > :not(summary) { padding: 0 16px; }
.book-extra > :last-child { padding-bottom: 16px; }
/* Book detail — bottom actions */
.book-bottom-acts { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.book-save-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; }
.book-del-row { display: flex; gap: 8px; justify-content: center; }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 5px; }
input, select, textarea { width: 100%; font: 16px var(--font-ui); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
.two { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.rate { display: flex; gap: 2px; }
.rate button { font-size: 34px; line-height: 1; background: none; border: 0; color: var(--line); cursor: pointer; padding: 2px; width: 44px; height: 44px; }
.rate button.f { color: var(--acc); }
.rate button.h { background: linear-gradient(90deg, var(--acc) 50%, var(--line) 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; justify-content: space-between; }
.fav { background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--soft); min-width: 44px; min-height: 44px; }
.fav.on { color: #d0344c; }
.scan { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 6px; }
.scan .muted { flex: 1 1 180px; }
.muted { color: var(--soft); font-size: 14px; }
.by { color: var(--soft); font-size: 14px; margin: 2px 0 8px; }
.step { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--line); border-radius: 10px; padding: 2px; gap: 2px; margin-left: auto; }
.seg .chip { border: 0; border-radius: 8px; background: transparent; min-height: 36px; padding: 6px 16px; }
.seg .chip.on { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* ============================================================
   SCANNER CAMÉRA
   ============================================================ */
.scanner {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  padding: env(safe-area-inset-top, 0px) 0 max(env(safe-area-inset-bottom, 0px), var(--keyboard-inset, 0px));
  border: 0;
  background: var(--card);
  color: var(--ink);
}

.scanner-layout {
  display: grid;
  grid-template-rows: minmax(4rem, 1fr) auto;
  min-height: 100%;
}

.scanner-preview {
  position: relative;
  overflow: hidden;
  background: #111;
}

.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .aim {
  position: absolute;
  inset: 34% max(10%, calc((100% - 24rem) / 2));
  border: 3px solid #fff;
  border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45);
}

.scanner-controls {
  width: min(100%, 36rem);
  margin-inline: auto;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
}

.scanner-heading, .scanner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scanner-heading { justify-content: space-between; }
.scanner-heading h2 { margin: 0; }
.scanner-form { margin-block: 10px; }
.scanner-form label { display: block; margin-bottom: 4px; }
.scanner-form input { flex: 1 1 9rem; min-width: 0; width: auto; }
.scanner .btn { min-height: 44px; }
.scanner [aria-invalid="true"] { outline: 2px solid currentColor; outline-offset: 2px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + .75rem);
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 15px;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
}

/* ============================================================
   MENU PANNEAU LATÉRAL (compte, sauvegarde, réglages)
   ============================================================ */
.menu-panel {
  position: fixed;
  inset: 0 0 var(--keyboard-inset, 0px);
  z-index: 40;
  display: flex;
}
dialog.menu-panel {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  color: var(--ink);
  background: transparent;
}
dialog.menu-panel:not([open]) { display: none; }
dialog.menu-panel::backdrop { background: transparent; }
.menu-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.menu-heading .menu-panel-title { margin: 0; }
.menu-heading .btn { min-height: 44px; }
.backup-text { min-height: 180px; }
.acct-email { overflow-wrap: anywhere; }
.share-visibility { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.share-visibility input[type="checkbox"] { flex: 0 0 auto; width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--acc); }
#acShareStatus:empty, #backupStatus:empty, #acMsg:empty { display: none; }
.menu-panel-veil {
  position: absolute;
  inset: 0;
  background: rgba(20,10,12,.45);
}
.menu-panel-body {
  position: relative;
  width: min(320px, 90vw);
  height: 100%;
  background: var(--bg);
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 1.5rem) max(1.25rem, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 1.5rem) max(1.25rem, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: 4px 0 24px rgba(0,0,0,.18);
  animation: slideInLeft .22s ease;
}
@keyframes slideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.menu-panel-title {
  font: 750 1.625rem/1.1 var(--font-ui);
  color: var(--acc);
  margin-bottom: 24px;
}
.menu-section { margin-bottom: 20px; }
.menu-section-title {
  font: 700 12px var(--font-ui);
  color: var(--soft);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 10px;
  font: 600 15px var(--font-ui);
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background .12s;
}
.menu-item:active { background: var(--line); }
.menu-item-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--rose); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.menu-item.danger { color: #b3261e; }
.menu-item.danger .menu-item-icon { background: #fce4e4; }
.menu-divider { height: 1px; background: var(--line); margin: 8px 0; }
.acct-status { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.acct-status p { margin: 0 0 4px; font-size: 14px; }
.acct-status p:last-child { margin: 0; }
.acct-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sso-options { margin-block: 16px 8px; padding-block-start: 12px; border-top: 1px solid var(--line); }
.sso-options p { margin-block: 0 8px; }
.sso-buttons { display: grid; gap: 8px; }
.share-box { background: var(--rose); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.share-box p { margin: 4px 0 12px; font-size: 14px; }

/* Theme toggle */
.theme-toggle {
  display: flex;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
}
.theme-opt {
  flex: 1;
  font: 600 14px var(--font-ui);
  padding: 10px 8px;
  min-height: 44px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--soft);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.theme-opt:last-child { border-right: 0; }
.theme-opt.active { background: var(--acc); color: var(--on-acc); }

/* ---- Contrôles communs ---- */
button, input, select, textarea { font-family: var(--font-ui); }
.btn, .chip, input, select, .filter-chip, .theme-opt {
  min-height: var(--touch-target);
}
input, select, textarea {
  font-size: 1rem;
  border-color: var(--outline);
}
input[type="checkbox"], input[type="radio"] { min-height: 1em; }
.menu-panel-body, .sheet, .page-scroll { overscroll-behavior-y: contain; }

html.hig .btn { font-size: 1rem; }
html.hig .chip { font-size: .9375rem; }
html.hig .muted { font-size: .9375rem; }

/* ---- Friends page ---- */
.friends-empty {
  text-align: center;
  padding: 32px 20px;
}
.friends-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.friends-empty h3 {
  font-size: 22px;
  margin-bottom: 8px;
}
.friends-empty .muted {
  margin: 0 0 20px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}
.friends-empty-acts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* Coins adaptés à la feuille Android. */
:root[data-platform="android"] .sheet { border-radius: 24px 24px 0 0; }
@media (min-width: 700px) {
  :root[data-platform="android"] .sheet { border-radius: 24px; }
}

@media (max-width: 400px) {
  .stat-card-value { font-size: 28px; }
}
@media (max-width: 340px) {
  .stat-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
