/* CollecBook — thème « bibliothèque » : papier crème, vert bouteille et bordeaux, titres à empattements,
   livres posés sur une étagère. Sobre : deux couleurs d'accent, aucune image décorative. */
/* CollecBook — « bibliothèque de famille » chaleureuse et ludique : crème lumineux, corail, moutarde, bleu canard,
   une couleur par membre, étagères en bois, petites célébrations. Ludique sans surcharge : animations courtes,
   désactivées si l'appareil demande moins de mouvement. */
:root {
  --paper: #fff8ee;
  --paper2: #fbeedb;
  --card: #ffffff;
  --ink: #3a2e28;
  --muted: #8a7768;
  --line: rgba(120, 80, 40, 0.12);
  --coral: #ff6b5b;
  --mustard: #f4b63f;
  --teal: #1f8a8a;
  --plum: #7a5cc7;
  --green: var(--teal);
  --green2: #26a69a;
  --bordeaux: var(--coral);
  --gold: var(--mustard);
  --wish: #e85d9b;
  --danger: #d6342c;
  --wood: #c98b4f;
  --wood2: #a86d36;
  --radius: 16px;
  --shadow: 0 8px 22px rgba(160, 90, 40, 0.13);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #221c1a; --paper2: #2d2522; --card: #2f2724; --ink: #fbefe4; --muted: #c4ad9b;
    --line: rgba(255, 220, 190, 0.1); --coral: #ff8576; --mustard: #ffc75a; --teal: #4cc2bb; --green2: #4cc2bb;
    --wish: #ff8cc0; --wood: #8a5a32; --wood2: #6d4425; --shadow: 0 8px 22px rgba(0, 0, 0, 0.45); color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  background-image: radial-gradient(circle at 10% 0%, rgba(255, 107, 91, 0.10), transparent 40%),
                    radial-gradient(circle at 95% 10%, rgba(31, 138, 138, 0.10), transparent 35%);
  background-attachment: fixed;
  color: var(--ink);
}
a { color: var(--bordeaux); }
h1, h2, h3 { font-family: var(--serif); letter-spacing: 0.005em; }
h2 { font-size: 1.5rem; margin: 6px 0 14px; }
h3 { font-size: 1.08rem; margin: 0 0 8px; }
.hidden { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 18px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255, 248, 238, 0.86); color: var(--ink); position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(10px); border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--coral), var(--mustard), var(--teal), var(--plum)) 1;
}
@media (prefers-color-scheme: dark) { .topbar { background: rgba(34, 28, 26, 0.88); } }
.brand { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--teal); }
.brand b { color: var(--coral); }
.brand .logo { display: inline-block; transform: rotate(-8deg); }
.who { display: flex; align-items: center; gap: 6px; }
.who-email { font-size: 0.82rem; opacity: 0.8; }
@media (max-width: 640px) { .who-email { display: none; } }
.icon-btn { position: relative; background: none; border: none; font-size: 1.25rem; cursor: pointer; padding: 6px; border-radius: 10px; }
.icon-btn:hover { background: var(--paper2); }
.dot { position: absolute; top: 0; right: 0; background: var(--coral); color: #fff; font-size: 0.65rem; font-weight: 700;
  border-radius: 999px; padding: 1px 5px; }
.topbar .btn.ghost { color: var(--ink); }

main { padding: 16px 14px 100px; max-width: 1180px; margin: 0 auto; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 430px; margin: 40px auto; }
.card h1 { color: var(--coral); margin-top: 0; }

label { display: block; margin: 10px 0; font-size: 0.86rem; color: var(--muted); }
label.check { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); }
label.check input { width: auto; margin-top: 3px; accent-color: var(--green2); }
input, select, textarea {
  width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 1rem; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green2); outline-offset: 0; border-color: transparent; }

.btn { padding: 10px 18px; border-radius: 999px; border: 1px solid transparent; font-weight: 650; cursor: pointer; font-family: inherit; font-size: 0.95rem; }
.btn:active { transform: scale(0.98); }
.btn { transition: transform .12s ease, box-shadow .12s ease, filter .12s ease; }
.btn.primary { background: linear-gradient(135deg, var(--coral), #ff8a5c); color: #fff; box-shadow: 0 4px 12px rgba(255, 107, 91, 0.35); }
.btn.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--paper2); }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(179, 38, 30, 0.4); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.small { padding: 6px 13px; font-size: 0.83rem; }

.error { color: var(--danger); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.mono { font-family: ui-monospace, monospace; word-break: break-all; }
.hint, .pro-banner { background: rgba(201, 154, 60, 0.13); border: 1px dashed rgba(201, 154, 60, 0.6); border-radius: 10px; padding: 9px 12px; font-size: 0.88rem; margin: 6px 0 12px; }
.warning-box { background: rgba(140, 47, 57, 0.1); color: var(--bordeaux); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 0.9rem; }
.recovery { columns: 2; font-family: ui-monospace, monospace; }
.qr { display: flex; justify-content: center; margin: 14px 0; }
.qr img { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: 10px; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 6px; }

.bottom-nav {
  position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(560px, calc(100% - 16px)); display: flex; padding: 5px;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); z-index: 30;
}
.bottom-nav .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
  background: none; border: none; border-radius: 15px; cursor: pointer; color: var(--muted); font-size: 0.68rem; font-weight: 650; font-family: inherit; }
.bottom-nav .tab .icon { font-size: 1.2rem; line-height: 1; }
.bottom-nav .tab.active { background: linear-gradient(135deg, var(--coral), var(--mustard)); color: #fff; }
.bottom-nav .tab.active .icon { animation: pop .35s ease; }

.toolbar input[type="search"], .search-line input { border-radius: 999px; padding-left: 16px; margin-top: 0; }
.toolbar { margin-bottom: 10px; }
.chiprow { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; }
.chip { flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap; font-family: inherit; }
.chip.selected { background: var(--teal); border-color: var(--teal); color: #fff; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; margin: 0 0 10px; background: var(--paper2); border-radius: 11px; max-width: 100%; overflow-x: auto; }
.seg { border: none; background: none; color: var(--muted); padding: 5px 12px; border-radius: 8px; font-weight: 650; font-size: 0.84rem; cursor: pointer; font-family: inherit; white-space: nowrap; }
.seg.selected { background: var(--card); color: var(--green); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.filters-row { display: flex; gap: 7px; overflow-x: auto; margin-bottom: 14px; }
.filters-row select { width: auto; flex: 0 0 auto; min-width: 110px; margin-top: 0; padding: 7px 10px; font-size: 0.86rem; }
.member-strip { display: flex; gap: 7px; overflow-x: auto; margin-bottom: 10px; }
.member-pill { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 3px 12px 3px 3px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; font-family: inherit; }
.member-pill:first-child { padding-left: 12px; }
.member-pill.selected { border-color: var(--mc, var(--teal)); box-shadow: inset 0 0 0 2px var(--mc, var(--teal)); background: color-mix(in srgb, var(--mc, var(--teal)) 12%, var(--card)); }
.selection-bar { display: flex; align-items: center; gap: 8px; background: var(--paper2); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; flex-wrap: wrap; }
.selection-bar .count { flex: 1; font-weight: 700; }
.selection-bar select { width: auto; margin: 0; }

/* ── étagère ── */
.shelf {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 34px 18px;
  padding: 14px 12px 6px;
}
.cover-slot { position: relative; }
.plank { position: absolute; left: -10px; right: -10px; bottom: -11px; height: 11px; border-radius: 3px; z-index: 0;
  background: linear-gradient(var(--wood), var(--wood2)); box-shadow: 0 6px 8px -4px rgba(80, 40, 10, 0.45); }
.ribbon { position: absolute; top: -3px; right: 12px; z-index: 3; width: 12px; height: 26px; background: var(--mc);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); box-shadow: 0 2px 3px rgba(0,0,0,.2); }
.book-card:nth-child(3n) .book { transform: rotate(-1.4deg); }
.book-card:nth-child(5n+1) .book { transform: rotate(1.1deg); }
.book-card.pop-in .book { animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
.book-card { position: relative; cursor: pointer; display: flex; flex-direction: column; gap: 7px; }
.book-card.static { cursor: default; }
.book-card.selected .book { outline: 3px solid var(--gold); outline-offset: 3px; }
.book {
  position: relative; z-index: 1; aspect-ratio: 2 / 3; border-radius: 3px 7px 7px 3px; overflow: hidden;
  box-shadow: 0 10px 16px -8px rgba(40, 25, 5, 0.55), inset 4px 0 0 rgba(0, 0, 0, 0.18);
  background: var(--paper2); transition: transform .2s ease;
}
.book-card:hover .book { transform: translateY(-6px) rotate(-2deg); }
.book img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.book.wish { opacity: 0.9; }
.book.wish::after { content: "💝"; position: absolute; top: 4px; right: 4px; z-index: 2; font-size: 1rem; }
.no-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 10px 10px 10px 16px;
  background: linear-gradient(90deg, hsl(var(--hue) 42% 30%) 0 8px, hsl(var(--hue) 46% 44%) 8px);
  color: #fffaf2; font-family: var(--serif); text-align: left;
}
.no-cover b { font-size: 0.92rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.no-cover i { font-size: 0.72rem; opacity: 0.8; }
.book.small { width: 52px; flex: 0 0 auto; }
.book.small .no-cover b { font-size: 0.5rem; -webkit-line-clamp: 3; }
.book.small .no-cover i { display: none; }
.book.large { width: 120px; }
.fav { position: absolute; top: -6px; left: -6px; z-index: 3; font-size: 1.05rem; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.book-card .body { min-width: 0; }
.book-card .title { font-family: var(--serif); font-weight: 700; font-size: 0.93rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vol { font-family: system-ui, sans-serif; font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.book-card .authors { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-check { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; z-index: 4; margin: 0; accent-color: var(--gold); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.69rem; font-weight: 650; padding: 2px 8px; border-radius: 999px;
  background: var(--paper2); color: var(--muted); white-space: nowrap; }
.tag.wish { color: var(--wish); background: rgba(184, 74, 122, 0.1); }
.tag.read-LU { color: var(--green2); }
.tag.read-EN_COURS { color: var(--gold); }
.tag.lent { color: var(--bordeaux); }
.tag.owner { color: var(--ink); padding-left: 2px; }
.tag.price { color: var(--green); }
.tag.price.hit, .tag.owned { background: rgba(46, 86, 67, 0.15); color: var(--green); }

.empty { text-align: center; padding: 34px 10px; }
.empty-books { display: flex; justify-content: center; align-items: flex-end; gap: 4px; height: 90px; margin-bottom: 12px; }
.empty-books i { display: block; width: 18px; border-radius: 2px; background: var(--green2); }
.empty-books i:nth-child(1) { height: 70px; } .empty-books i:nth-child(2) { height: 86px; background: var(--bordeaux); }
.empty-books i:nth-child(3) { height: 62px; background: var(--gold); } .empty-books i:nth-child(4) { height: 78px; transform: rotate(12deg); transform-origin: bottom left; }

.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: inline-flex; }
.avatar.letter { align-items: center; justify-content: center; font-weight: 800; font-size: 0.9rem; color: #fff; background: var(--mc, var(--teal)); }
img.avatar { box-shadow: 0 0 0 2px var(--mc, transparent); }
.avatar.xs { width: 18px; height: 18px; font-size: 0.6rem; }
.avatar.sm { width: 26px; height: 26px; font-size: 0.75rem; }
.avatar.md { width: 40px; height: 40px; }
.avatar.big { width: 72px; height: 72px; font-size: 1.8rem; }
.empty-avatar { align-items: center; justify-content: center; background: var(--paper2); }

/* ── ajouter ── */
.find-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.big-action { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 650; font-family: inherit; cursor: pointer; box-shadow: var(--shadow); }
.big-action span { font-size: 1.7rem; }
.big-action:first-child { background: linear-gradient(135deg, var(--coral), var(--mustard)); color: #fff; border: none; }
.big-action:nth-child(2) { background: color-mix(in srgb, var(--teal) 12%, var(--card)); }
.big-action:nth-child(3) { background: color-mix(in srgb, var(--plum) 10%, var(--card)); }
.big-action:hover { transform: translateY(-2px); }
@media (max-width: 480px) { .big-action { font-size: 0.78rem; } }
.search-line { display: flex; gap: 8px; }
.scan-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 14px; }
#scanVideo { width: 100%; max-width: 440px; border-radius: 14px; background: #000; }
.scan-status { font-weight: 600; text-align: center; }
.results { display: flex; flex-direction: column; gap: 10px; }
.result { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.r-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.r-actions { display: flex; flex-direction: column; gap: 6px; }

/* ── fiche ── */
.cover-picker { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.cover-picker img, .cover-empty { width: 70px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 3px 6px 6px 3px; box-shadow: var(--shadow); }
.cover-empty { display: flex; align-items: center; justify-content: center; background: var(--paper2); font-size: 1.8rem; }
.cover-buttons { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.formgrid .span2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .formgrid { grid-template-columns: 1fr; } }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.dialog-actions .btn.danger { margin-right: auto; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form input { width: auto; flex: 1; min-width: 160px; }
.inline-form label { margin: 0; flex: 1; }

dialog { border: none; border-radius: 16px; padding: 0; max-width: 620px; width: 94%; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(25, 18, 8, 0.55); backdrop-filter: blur(2px); }
dialog .card { box-shadow: none; border: none; margin: 0; }
.detail-top { display: flex; gap: 16px; align-items: flex-start; }
.detail-top h2 { margin-top: 0; font-size: 1.25rem; }
.summary { white-space: pre-line; max-height: 160px; overflow: auto; }
.detail-prices { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.offers { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.offer { display: grid; grid-template-columns: 80px 1fr auto 20px; gap: 8px; align-items: center; text-decoration: none; color: var(--ink);
  background: var(--paper); border-radius: 9px; padding: 8px 10px; font-size: 0.88rem; }
.offer.hit { background: rgba(46, 86, 67, 0.15); }
.o-price { font-weight: 800; color: var(--green); }
.o-cond { color: var(--muted); font-size: 0.8rem; }

/* ── souhaits ── */
.wish-list { display: flex; flex-direction: column; gap: 10px; }
.wish { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; }
.wish.hit { border-color: var(--green2); box-shadow: inset 4px 0 0 var(--green2); }
.w-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.w-price { display: flex; flex-direction: column; align-items: flex-end; text-align: right; gap: 2px; }
.w-price b { font-size: 1.1rem; color: var(--green); }
.target { color: var(--bordeaux); }

/* ── stats ── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-card .value { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: var(--coral); }
.stat-card:nth-child(2) .value { color: var(--teal); } .stat-card:nth-child(3) .value { color: var(--mustard); }
.stat-card:nth-child(4) .value { color: var(--wish); } .stat-card:nth-child(5) .value { color: var(--plum); }
.stat-card .label { font-size: 0.78rem; color: var(--muted); }
.agg-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.agg-row { margin-bottom: 8px; }
.agg-top { display: flex; justify-content: space-between; font-size: 0.86rem; margin-bottom: 3px; }
.agg-bar-bg { background: var(--paper2); border-radius: 4px; height: 7px; overflow: hidden; }
.agg-bar-fill { background: linear-gradient(90deg, var(--coral), var(--mustard)); height: 100%; border-radius: 4px; }
.member-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.member-stat { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--mc, var(--teal)) 10%, var(--card)); border-left: 5px solid var(--mc, var(--teal)); border-radius: 12px; padding: 10px; }
.ms-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ms-total { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--mc, var(--teal)); }

/* ── partage, réglages, notifications ── */
.row-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.members { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.member-row { display: flex; align-items: center; gap: 12px; background: var(--paper); border-radius: 12px; padding: 10px; flex-wrap: wrap; }
.mr-body { flex: 1; min-width: 150px; }
.mr-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.member-form { border-top: 1px solid var(--line); padding-top: 8px; }
.avatar-pick { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.sources { display: flex; flex-direction: column; gap: 2px; }
.source { margin: 6px 0; }
.notifications { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.notification { background: var(--paper); border-radius: 10px; padding: 10px 12px; }
.notification.unread { box-shadow: inset 4px 0 0 var(--bordeaux); }
.notification p { margin: 4px 0; }

/* ── assistant (Pro) ── */
.chat-bubble { position: fixed; right: 16px; bottom: 92px; z-index: 31; width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--teal); color: #fff; font-size: 1.4rem; box-shadow: var(--shadow); cursor: pointer; }
.chat-panel { position: fixed; right: 16px; bottom: 152px; z-index: 32; width: min(360px, calc(100% - 32px)); max-height: 60vh;
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.chat-log { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.chat-log p { margin: 0; padding: 7px 10px; border-radius: 10px; font-size: 0.88rem; max-width: 88%; }
.chat-log .bot { background: var(--paper2); align-self: flex-start; }
.chat-log .me { background: var(--teal); color: #fff; align-self: flex-end; }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chat-form input { margin: 0; }

/* ── accueil ── */
.hello { background: linear-gradient(135deg, color-mix(in srgb, var(--coral) 16%, var(--card)), color-mix(in srgb, var(--mustard) 18%, var(--card)));
  border-radius: 20px; padding: 16px 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
.hello-top { display: flex; align-items: center; gap: 12px; }
.hello h2 { margin: 0; font-size: 1.45rem; }
.hello-top p { margin: 2px 0 0; }
.hello-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 12px; }
.hello-tile { display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: 14px; padding: 10px 12px; }
.hello-tile > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hello-tile.stack { flex-direction: column; align-items: stretch; gap: 5px; }
.hello-tile strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hello-tile.latest { cursor: pointer; }
.hello-tile .btn { align-self: flex-start; margin-top: 2px; }
.kicker { font-size: 0.72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--teal); }
.gauge { width: 100%; height: 10px; border-radius: 999px; background: var(--paper2); overflow: hidden; }
.gauge i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal), var(--mustard), var(--coral)); }

/* ── badges ── */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 12px 8px;
  border-radius: 14px; background: var(--paper2); filter: grayscale(1); opacity: .55; }
.badge .b-icon { font-size: 1.9rem; }
.badge strong { font-size: 0.82rem; }
.badge.earned { filter: none; opacity: 1; background: color-mix(in srgb, var(--mustard) 22%, var(--card)); box-shadow: inset 0 0 0 2px var(--mustard); }

/* ── illustrations, toast, confettis ── */
.illus { width: min(240px, 70%); height: auto; margin: 0 auto 8px; display: block; }
.illus-emoji { font-size: 3.4rem; animation: float 3s ease-in-out infinite; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 60; padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-weight: 700; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }
.toast.show { animation: pop .45s cubic-bezier(.2, 1.6, .4, 1); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 59; overflow: hidden; }
.confetti i { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; animation: confetti linear forwards; }
@keyframes confetti { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: .9; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.toast.show { animation-name: toastpop; }
@keyframes toastpop { 0% { transform: translateX(-50%) scale(.6); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes float { 50% { transform: translateY(-6px); } }

@media (prefers-reduced-motion: reduce) {
  .book, .btn { transition: none; }
  .book-card:hover .book { transform: none; }
  .book-card.pop-in .book, .toast.show, .illus-emoji, .bottom-nav .tab.active .icon { animation: none; }
}
