/* Dog-Ear: a shared bookshelf for a circle of friends.
   One memorable thing: the folded corner on every book card shows if it is home or out. */

:root {
  --paper: #f3f5f7;
  --card: #ffffff;
  --ink: #18212c;
  --muted: #5b6773;
  --line: #dde2e8;
  --accent: #2f4bff;
  --accent-ink: #ffffff;
  --accent-soft: #e8ecff;
  --ok: #0f8f78;
  --warn: #b86e00;
  --bad: #c4372c;
  --radius: 10px;
  --nav-h: 64px;
  --font-display: 'Bricolage Grotesque', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f141a;
    --card: #171e26;
    --ink: #e8edf2;
    --muted: #9aa6b2;
    --line: #2a333d;
    --accent: #8796ff;
    --accent-ink: #0f141a;
    --accent-soft: #1d2540;
    --ok: #3cc4a8;
    --warn: #f0a63a;
    --bad: #ff7b6e;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 0.35rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 1rem; }

/* ---------- shell ---------- */
#app { min-height: 100vh; min-height: 100dvh; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card); border-top: 1px solid var(--line);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 0.75rem; font-weight: 600; text-decoration: none; position: relative;
}
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current='page'] { color: var(--accent); }
.nav a.add span.plus {
  width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; margin-top: -18px; box-shadow: 0 4px 14px rgba(47, 75, 255, 0.35);
}
.nav a.add[aria-current='page'] span.plus { outline: 3px solid var(--accent-soft); }
.nav .badge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: 0.7rem; display: grid; place-items: center;
}
.brand { display: none; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; padding: 1.2rem 1rem 1rem; }
.brand b { color: var(--accent); }
main { padding: 1rem 1rem calc(var(--nav-h) + 2rem + env(safe-area-inset-bottom, 0px)); max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: 0.5rem 0 1rem; flex-wrap: wrap; }

@media (min-width: 900px) {
  .nav {
    top: 0; bottom: auto; right: auto; width: 220px; height: 100vh; flex-direction: column; justify-content: flex-start;
    padding: 0.5rem 0.75rem; border-top: 0; border-right: 1px solid var(--line); gap: 4px;
  }
  .brand { display: block; padding-left: 0.5rem; }
  .nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0.7rem 0.75rem; border-radius: var(--radius); font-size: 1rem; }
  .nav a[aria-current='page'] { background: var(--accent-soft); }
  .nav a.add span.plus { width: 28px; height: 28px; margin: 0; box-shadow: none; }
  .nav a.add span.plus svg { width: 18px; height: 18px; }
  .nav .badge { position: static; margin-left: auto; }
  main { margin-left: 220px; max-width: none; padding: 1.5rem 2rem 3rem; }
  main > .wrap { max-width: 1000px; }
}

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 44px; padding: 0 1.1rem;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: var(--radius);
  font-weight: 650; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 0.8rem; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.55; cursor: default; filter: none; }
.field { display: block; margin-bottom: 0.9rem; }
.field > span { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }
.field small { color: var(--muted); display: block; margin-top: 0.2rem; }
input[type='text'], input[type='email'], input[type='search'], input[type='date'], input[type='number'], select, textarea {
  width: 100%; min-height: 44px; padding: 0.5rem 0.75rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
textarea { min-height: 84px; resize: vertical; }
input[type='checkbox'] { width: 20px; height: 20px; accent-color: var(--accent); }
.check { display: flex; gap: 0.6rem; align-items: center; min-height: 44px; }
.seg { display: flex; width: 100%; max-width: 440px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.seg button { flex: 1; white-space: nowrap; border: 0; background: transparent; min-height: 44px; padding: 0 0.5rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); }
.stars { display: inline-flex; gap: 2px; }
.stars button { border: 0; background: none; font-size: 1.6rem; line-height: 1; padding: 4px; cursor: pointer; color: var(--line); min-width: 40px; min-height: 40px; }
.stars button[aria-pressed='true'] { color: #f2a900; }
.notice { padding: 0.75rem 0.9rem; border-radius: var(--radius); background: var(--accent-soft); }
.notice.warn { background: color-mix(in srgb, var(--warn) 14%, var(--card)); }
.notice.bad { background: color-mix(in srgb, var(--bad) 14%, var(--card)); color: var(--ink); }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 0.3rem; }

.chip { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; }
.chip i { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; flex: none; }
.tag { display: inline-block; white-space: nowrap; font-size: 0.8rem; padding: 0.1rem 0.55rem; border-radius: 99px; background: var(--accent-soft); color: var(--ink); }
.tag.ok { background: color-mix(in srgb, var(--ok) 18%, var(--card)); }
.tag.warn { background: color-mix(in srgb, var(--warn) 20%, var(--card)); }
.tag.bad { background: color-mix(in srgb, var(--bad) 18%, var(--card)); }

/* ---------- covers and the dog-ear ---------- */
.cover { position: relative; aspect-ratio: 2 / 3; background: var(--line); border-radius: 4px 8px 8px 4px; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .spine {
  position: absolute; inset: 0; padding: 0.7rem 0.6rem 0.6rem 0.9rem; display: flex; flex-direction: column; justify-content: space-between;
  color: #fff; box-shadow: inset 7px 0 0 rgba(0, 0, 0, 0.22), inset 9px 0 0 rgba(255, 255, 255, 0.12);
}
.cover .spine b { padding-right: 1.1rem; font-family: var(--font-display); font-size: 1rem; line-height: 1.12; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cover .spine span { font-size: 0.75rem; opacity: 0.85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 1.1rem 0.8rem; }
@media (min-width: 640px) { .shelf { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1.4rem 1rem; } }
.book { position: relative; display: block; color: inherit; text-decoration: none; min-width: 0; }
.book:hover { text-decoration: none; }
.book:hover .cover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); }
.book .meta { padding: 0.45rem 0.1rem 0; }
.book .t { font-weight: 650; font-size: 0.9rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.book .a { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; }
.dots i { width: 9px; height: 9px; border-radius: 50%; display: block; }
/* The fold: green corner when a copy is home, amber when every copy is out. */
.book::after {
  content: ''; position: absolute; top: 0; right: 0; width: 26px; aspect-ratio: 1; pointer-events: none; border-top-right-radius: 8px;
  background: linear-gradient(225deg, var(--paper) 50%, var(--fold) 50%);
  filter: drop-shadow(-1px 1px 1px rgba(0, 0, 0, 0.25));
}
.book.free { --fold: var(--ok); }
.book.out { --fold: #f2a900; }

.cover.small { width: 48px; flex: none; border-radius: 3px 5px 5px 3px; }
.cover.small .spine { padding: 0.3rem 0.2rem 0.2rem 0.45rem; box-shadow: inset 4px 0 0 rgba(0, 0, 0, 0.22); }
.cover.small .spine b { font-size: 0.55rem; line-height: 1.1; -webkit-line-clamp: 6; }
.cover.small .spine span { display: none; }
.cover.large { width: 100%; max-width: 220px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.list > .item { display: flex; gap: 0.8rem; padding: 0.8rem; align-items: center; }
.list > .item + .item { border-top: 1px solid var(--line); }
.item .grow .t { font-weight: 650; display: block; color: var(--ink); overflow-wrap: anywhere; }
.item .actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.section { margin-top: 1.6rem; }
@media (max-width: 480px) {
  .list > .item { flex-wrap: wrap; }
  .list > .item > .grow { flex: 1 1 140px; }
  .item .actions { flex: 1 1 100%; justify-content: flex-start; }
}
.section > h2 { margin-bottom: 0.6rem; display: flex; align-items: baseline; gap: 0.5rem; }
.count { font-family: var(--font-body); font-size: 0.9rem; color: var(--muted); font-weight: 500; }

.filters { display: grid; gap: 0.5rem; grid-template-columns: 1fr 1fr; margin-bottom: 1rem; }
.filters .search { grid-column: 1 / -1; }
@media (min-width: 700px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; } .filters .search { grid-column: auto; } }

.book-head { display: grid; gap: 1.2rem; grid-template-columns: 120px 1fr; align-items: start; }
@media (min-width: 640px) { .book-head { grid-template-columns: 200px 1fr; gap: 1.6rem; } }
.facts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0.5rem 0 0.5rem 1rem; border-left: 2px solid var(--line); margin-left: 0.4rem; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 0.95rem; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1.2rem; }
.auth .panel { width: 100%; max-width: 420px; }
.auth h1 { font-size: 2.3rem; margin-bottom: 0.4rem; }
.auth h1 b { color: var(--accent); }
.auth .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.3rem; margin-top: 1.2rem; }

/* ---------- scanner ---------- */
.scanner { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .aim { position: absolute; left: 12%; right: 12%; top: 38%; bottom: 38%; border: 3px solid rgba(255, 255, 255, 0.9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); }
.scanner .hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: #fff; font-size: 0.9rem; text-shadow: 0 1px 3px #000; }
.choices { display: grid; gap: 0.7rem; }
.choice { display: flex; gap: 0.9rem; align-items: center; text-align: left; padding: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; width: 100%; }
.choice:hover { border-color: var(--accent); }
.choice svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.choice b { display: block; }
.suggest { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: -0.5rem 0 1rem; overflow: hidden; }
.suggest button { display: flex; gap: 0.7rem; align-items: center; width: 100%; padding: 0.55rem 0.7rem; border: 0; background: none; cursor: pointer; text-align: left; }
.suggest button + button { border-top: 1px solid var(--line); }
.suggest button:hover { background: var(--accent-soft); }
.preview { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }

/* ---------- dialog and toast ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(92vw, 460px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
dialog::backdrop { background: rgba(10, 14, 20, 0.55); }
dialog .dlg { padding: 1.2rem; }
dialog h2 { margin-bottom: 0.8rem; }
dialog .foot { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50;
  max-width: 90vw; padding: 0.7rem 1rem; border-radius: var(--radius); background: var(--ink); color: var(--paper); font-weight: 600; opacity: 0; pointer-events: none;
}
#toast.show { opacity: 1; transition: opacity 0.2s; }
#toast.bad { background: var(--bad); color: #fff; }
@media (min-width: 900px) { #toast { bottom: 24px; } }
.loading { padding: 3rem 0; text-align: center; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

input[type='file'] { width: 100%; padding: 0.4rem; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
input[type='file']::file-selector-button { margin-right: 0.7rem; min-height: 36px; padding: 0 0.9rem; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font-weight: 600; cursor: pointer; }

/* ---------- in-app camera ---------- */
body.cam-open { overflow: hidden; }
.cam { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; display: flex; flex-direction: column; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cam-msg { position: relative; margin: auto; padding: 1.5rem; max-width: 22rem; text-align: center; font-size: 1.05rem; }
.cam-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: calc(0.8rem + env(safe-area-inset-top, 0px)) 0.9rem 0.8rem; background: linear-gradient(#000a, #0000); }
.cam-btn { background: rgba(255, 255, 255, 0.18); border-color: transparent; color: #fff; }
.cam-title { font-weight: 650; flex: 1; text-align: center; text-shadow: 0 1px 3px #000; }
.cam-count { min-width: 4.5rem; text-align: right; font-weight: 650; text-shadow: 0 1px 3px #000; }
.cam-bottom { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; padding: 1rem 0 calc(1.4rem + env(safe-area-inset-bottom, 0px)); background: linear-gradient(#0000, #000a); }
.cam-shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255, 255, 255, 0.35); cursor: pointer; padding: 0; }
.cam-shutter:active:not(:disabled) { background: #fff; }
.cam-shutter:disabled { opacity: 0.5; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: camflash 0.25s ease-out; }
@keyframes camflash { from { opacity: 0.75; } to { opacity: 0; } }

/* a photo of a spine or copy, shown whole instead of cropped to fit */
.cover.contain { background: #1d2430; }
.cover.contain img { object-fit: contain; }

/* generated covers in the grid: a touch smaller, and only break a word when it truly does not fit */
.shelf .cover .spine b { font-size: 0.74rem; padding-right: 0.9rem; overflow-wrap: break-word; word-break: normal; }
.shelf .cover .spine { padding: 0.6rem 0.3rem 0.5rem 0.8rem; }

/* ---------- collections: rows, tiles, tabs, chat ---------- */
.book.none::after { display: none; }
.coll { margin-top: 1.6rem; }
.coll-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.coll-head .handle { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--ink); display: inline-flex; align-items: center; gap: 0.5rem; }
.coll-head .handle i { width: 0.8rem; height: 0.8rem; border-radius: 50%; display: inline-block; }
.star { border: 0; background: none; cursor: pointer; font-size: 1.5rem; line-height: 1; padding: 4px 6px; color: var(--line); min-width: 40px; min-height: 40px; }
.star[aria-pressed='true'] { color: #f2a900; }
.strip { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.strip .book { flex: 0 0 104px; scroll-snap-align: start; }
@media (min-width: 700px) { .strip { overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; } .strip::-webkit-scrollbar { display: none; } .strip .book, .strip .more-tile { flex-basis: 140px; } }
.more-tile { flex: 0 0 104px; aspect-ratio: 2 / 3; border: 2px dashed var(--line); border-radius: 8px; background: transparent; color: var(--accent); font: 700 1.8rem var(--font-display); cursor: pointer; display: grid; place-content: center; text-align: center; scroll-snap-align: start; }
.more-tile small { display: block; font: 600 0.75rem var(--font-body); color: var(--muted); margin-top: 2px; }
.expand { margin-top: 0.9rem; padding: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.tabs { display: flex; gap: 0.4rem; border-bottom: 1px solid var(--line); margin: 0.6rem 0 1rem; }
.tabs a { padding: 0.7rem 1rem; font-weight: 650; color: var(--muted); border-bottom: 3px solid transparent; text-decoration: none; margin-bottom: -1px; }
.tabs a[aria-current='true'] { color: var(--accent); border-color: var(--accent); }
.tabs .n { background: var(--bad); color: #fff; border-radius: 9px; font-size: 0.72rem; padding: 0 6px; margin-left: 6px; }
.bubbles { display: flex; flex-direction: column; gap: 6px; padding: 0.8rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 40vh; max-height: 55vh; overflow-y: auto; }
.bubble { max-width: 80%; padding: 0.5rem 0.8rem; border-radius: 14px; background: var(--accent-soft); align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.bubble time { display: block; font-size: 0.7rem; opacity: 0.7; margin-top: 2px; }
.dot-unread { display: inline-block; min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 0.75rem; text-align: center; line-height: 20px; padding: 0 5px; }
.choice[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.choices { display: grid; gap: 0.6rem; }
.strip .cover .spine b, .shelf .cover .spine b { font-size: 0.74rem; padding-right: 1.3rem; }

/* ---------- share icon under a book, and select mode ---------- */
.share-pill { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 4px; padding: 0.15rem 0.5rem 0.15rem 0.3rem; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 0.78rem; font-weight: 600; max-width: 100%; }
.share-pill svg { width: 16px; height: 16px; flex: none; }
.share-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-pill.tap { cursor: pointer; min-height: 32px; }
.share-pill.tap:hover { border-color: var(--accent); color: var(--accent); }
.share-pill.share { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.share-pill.sale { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.book.picking .cover { outline: 3px solid transparent; }
.book.picked .cover { outline: 3px solid var(--accent); outline-offset: 2px; }
.book .pick { position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; z-index: 2; accent-color: var(--accent); }
.selbar { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); z-index: 6; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; padding: 0.7rem; margin-top: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
@media (min-width: 900px) { .selbar { bottom: 0; } }
.share-pill { font-size: 0.74rem; padding: 0.1rem 0.45rem 0.1rem 0.25rem; }
.share-pill svg { width: 15px; height: 15px; }
.book.picking .cover .spine { padding-top: 2.2rem; }
.book .pick { box-shadow: 0 1px 4px rgba(0,0,0,0.4); border-radius: 4px; }


/* activity while photos are being sent */
.spin { display: inline-block; width: 14px; height: 14px; margin-left: 8px; vertical-align: -2px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: dogear-spin 0.8s linear infinite; }
@keyframes dogear-spin { to { transform: rotate(360deg); } }
.cam-limit { position: absolute; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: rgba(0, 0, 0, 0.75); color: #fff; padding: 0.6rem 1rem; border-radius: 6px; font-weight: 600; text-align: center; max-width: 90vw; }
.share-pill { gap: 0.2rem; padding: 0.05rem 0.4rem 0.05rem 0.2rem; font-size: 0.76rem; }
.share-pill svg { width: 14px; height: 14px; }
.share-pill span { overflow: visible; text-overflow: clip; }
.cam-bottom { align-items: center; justify-content: space-between; padding-left: 1rem; padding-right: 1rem; }

/* =====================================================================
   Bento: every screen is a grid of rounded tiles in different sizes.
   Cool grey ground, white tiles with no shadows, one ultramarine accent,
   mint for Share and amber for For sale. Geist throughout.
   ===================================================================== */
:root {
  --paper: #eceef2;
  --card: #ffffff;
  --ink: #0e1116;
  --muted: #5b6472;
  --line: #e2e5ea;
  --accent: #2f3cff;
  --accent-ink: #ffffff;
  --accent-soft: #e7e9ff;
  --ok: #137a52;
  --warn: #9a6400;
  --bad: #d23b2f;
  --mint: #dcf3e6;
  --amber: #ffefc4;
  --rose: #ffe2df;
  --tile: 22px;
  --radius: 12px;
  --font-display: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d0f13;
    --card: #171a20;
    --ink: #f2f3f5;
    --muted: #9aa3b0;
    --line: #262a32;
    --accent: #8a93ff;
    --accent-ink: #0d0f13;
    --accent-soft: #1f2340;
    --ok: #57d39b;
    --warn: #f2c14e;
    --bad: #ff7a6e;
    --mint: #12362a;
    --amber: #3a2e10;
    --rose: #3a1c1a;
    color-scheme: dark;
  }
}
body { font: 16px/1.5 var(--font-body); background: var(--paper); letter-spacing: -0.005em; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.025em; }
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
.brand b, .auth h1 b { color: inherit; }

/* ---- the grid ---- */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: start; }
.bento > * { grid-column: 1 / -1; min-width: 0; }
.bento > h1, .bento > .page-head, .bento > a.small { margin: 0.2rem 0 0; }
@media (max-width: 899px) {
  .bento > .m-half { grid-column: span 6; }
}
@media (min-width: 900px) {
  .bento { gap: 14px; }
  .bento > .span-8 { grid-column: span 8; }
  .bento > .span-7 { grid-column: span 7; }
  .bento > .span-6 { grid-column: span 6; }
  .bento > .span-5 { grid-column: span 5; }
  .bento > .span-4 { grid-column: span 4; }
  .bento > .span-3 { grid-column: span 3; }
}

/* ---- tiles: white on grey, no shadows; size and colour carry the hierarchy ---- */
.tile, .bento > .section, .bento > .coll, .bento > .book-head, .bento > .filters-tile {
  background: var(--card); border-radius: var(--tile); padding: 1.15rem 1.2rem 1.25rem; margin: 0; border: 0; box-shadow: none;
}
.bento > .section > h2 { margin-bottom: 0.7rem; }
/* lists inside a tile are rows, not cards inside cards */
.bento > .section .list, .tile .list, .bento > .coll .list { background: transparent; border: 0; border-radius: 0; }
.bento > .section .list > .item, .tile .list > .item { padding-left: 0; padding-right: 0; }
.list { border-radius: var(--tile); border-color: var(--line); }

/* the greeting tile is the one dark tile on the page */
.tile.hero { background: var(--ink); color: var(--paper); padding: 1.5rem 1.4rem; min-height: 9.5rem; display: flex; flex-direction: column; justify-content: space-between; gap: 1rem; }
.tile.hero h1 { color: var(--paper); font-size: 2.3rem; }
.tile.hero p { color: color-mix(in srgb, var(--paper) 72%, transparent); margin: 0.3rem 0 0; }
.tile.hero .chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tile.hero .chips a { background: color-mix(in srgb, var(--paper) 14%, transparent); color: var(--paper); padding: 0.35rem 0.75rem; border-radius: 99px; font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.tile.hero .chips a:hover { background: color-mix(in srgb, var(--paper) 24%, transparent); }
.tile.action { background: var(--accent); color: var(--accent-ink); text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; min-height: 9.5rem; gap: 0.8rem; }
.tile.action:hover { text-decoration: none; filter: brightness(1.06); }
.tile.action b { font-size: 1.15rem; letter-spacing: -0.02em; display: block; }
.tile.action span { opacity: 0.85; font-size: 0.9rem; }
.tile.action svg { width: 30px; height: 30px; }
.tile.stat { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; justify-content: space-between; min-height: 9.5rem; gap: 0.6rem; }
.tile.stat:hover { text-decoration: none; outline: 2px solid var(--accent); outline-offset: -2px; }
.tile.stat.waiting { background: var(--amber); }
.tile.stat b { font-size: 1.15rem; letter-spacing: -0.02em; }
.tile.stat span { color: var(--muted); font-size: 0.9rem; }

/* ---- controls ---- */
.btn { border-radius: 99px; font-weight: 600; letter-spacing: -0.01em; box-shadow: none; }
.btn.quiet { background: var(--paper); border-color: transparent; color: var(--ink); }
.btn.quiet:hover { background: var(--line); filter: none; }
input[type='text'], input[type='email'], input[type='search'], input[type='date'], input[type='number'], select, textarea {
  background: var(--paper); border: 1px solid transparent; border-radius: var(--radius); font-family: var(--font-body);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; background: var(--card); }
.seg { border: 0; background: var(--paper); border-radius: 99px; padding: 3px; }
.seg button { border-radius: 99px; }
.seg button + button { border-left: 0; }
.notice { background: var(--accent-soft); border: 0; border-radius: var(--radius); }
.notice.warn { background: var(--amber); }
.choice { border-radius: var(--tile); border: 1px solid var(--line); background: var(--card); }
.tabs { border-bottom: 0; gap: 0.3rem; background: var(--card); border-radius: 99px; padding: 4px; width: max-content; max-width: 100%; }
.tabs a { border: 0; border-radius: 99px; padding: 0.5rem 1rem; margin: 0; }
.tabs a[aria-current='true'] { background: var(--ink); color: var(--paper); }

/* statuses are soft pills */
.tag { background: var(--paper); color: var(--ink); border-radius: 99px; font-weight: 600; font-size: 0.78rem; padding: 0.15rem 0.6rem; border: 0; }
.tag.ok { background: var(--mint); color: var(--ok); }
.tag.warn { background: var(--amber); color: var(--warn); }
.tag.bad { background: var(--rose); color: var(--bad); }
.share-pill { border: 0; border-radius: 99px; background: var(--paper); color: var(--muted); font-weight: 600; padding: 0.15rem 0.55rem 0.15rem 0.3rem; }
.share-pill.share { background: var(--mint); color: var(--ok); }
.share-pill.sale { background: var(--amber); color: var(--warn); }
.share-pill.tap:hover { color: var(--accent); background: var(--accent-soft); }
.nav .badge, .tabs .n, .dot-unread { background: var(--bad); color: #fff; }

/* covers without a picture: flat colour, bold title */
.cover { border-radius: 10px; box-shadow: none; }
.cover .spine { box-shadow: inset 6px 0 0 rgba(0, 0, 0, 0.12); color: #fff; padding: 0.75rem 0.65rem 0.65rem 0.9rem; }
.cover .spine b { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; }
.cover .spine span { opacity: 0.8; }
.book .t { font-weight: 600; letter-spacing: -0.01em; }
.book.free { --fold: var(--ok); }
.book.out { --fold: #e3a008; }
.book::after { border-top-right-radius: 10px; }
.more-tile { border-radius: 10px; border: 2px dashed var(--line); background: var(--paper); }

/* ---- shell ---- */
.nav { background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.nav a { font-weight: 600; }
.nav a.add span.plus { box-shadow: none; }
@media (min-width: 900px) {
  .nav { background: var(--paper); border: 0; padding: 1rem 0.9rem; }
  .nav a { border-radius: 14px; }
  .nav a[aria-current='page'] { background: var(--card); color: var(--ink); }
  .brand { font-weight: 700; letter-spacing: -0.03em; font-size: 1.6rem; }
  main { padding: 1.4rem 1.8rem 3rem; }
}
.auth .card { border: 0; border-radius: var(--tile); box-shadow: none; }
.auth h1 { font-weight: 700; letter-spacing: -0.04em; }
dialog { border-radius: var(--tile); box-shadow: 0 30px 80px rgba(10, 14, 30, 0.35); border: 0; }
.bubble { border-radius: 16px 16px 16px 6px; background: var(--paper); border: 0; }
.bubble.mine { border-radius: 16px 16px 6px 16px; background: var(--accent); color: var(--accent-ink); }
.bubbles { border: 0; border-radius: var(--tile); background: var(--card); }
.selbar { border: 0; border-radius: var(--tile); background: var(--ink); color: var(--paper); }
.selbar .btn.quiet { background: color-mix(in srgb, var(--paper) 15%, transparent); color: var(--paper); }
.expand { border: 0; border-radius: 16px; background: var(--paper); }
.coll-head .handle { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }
.star[aria-pressed='true'], .stars button[aria-pressed='true'] { color: #f2a900; }
.timeline li::before { background: var(--accent); }
.empty { background: var(--card); border-radius: var(--tile); }
.bento > .empty { margin: 0; }
.tile.stat svg, .tile.action svg { width: 28px; height: 28px; flex: none; }
.tile.stat b, .tile.action b, .tile.stat span, .tile.action span { display: block; }
.tile.stat span, .tile.action span { margin-top: 0.15rem; line-height: 1.35; }
.bento > .tile.hero, .bento > .tile.action, .bento > .tile.stat { align-self: stretch; }
@media (min-width: 640px) { .strip .cover .spine b, .shelf .cover .spine b { font-size: 0.92rem; line-height: 1.15; } }

/* =====================================================================
   Glass: the bento tiles become frosted panes floating over a soft
   colour wash. Light: lavender, sky and peach. Dark: navy night with
   violet and teal glows. Text always sits on glass dense enough to read.
   ===================================================================== */
:root {
  --paper: #eef0fb;
  --ink: #12142b;
  --muted: #4f5672;
  --line: rgba(255, 255, 255, 0.55);
  --accent: #4338ff;
  --accent-soft: rgba(67, 56, 255, 0.12);
  --glass: rgba(255, 255, 255, 0.52);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 10px 40px -12px rgba(40, 40, 120, 0.28);
  --field: rgba(255, 255, 255, 0.6);
  --mint: rgba(16, 185, 129, 0.16);
  --amber: rgba(245, 158, 11, 0.2);
  --rose: rgba(239, 68, 68, 0.15);
  --wash:
    radial-gradient(40vmax 40vmax at 12% 8%, #c7c2ff 0%, transparent 60%),
    radial-gradient(38vmax 38vmax at 92% 18%, #a5e3ff 0%, transparent 60%),
    radial-gradient(44vmax 44vmax at 70% 92%, #ffc9b5 0%, transparent 62%),
    radial-gradient(36vmax 36vmax at 6% 85%, #d9f5d0 0%, transparent 60%),
    linear-gradient(160deg, #eef0fb 0%, #f6f1fb 100%);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b0d1c;
    --ink: #eef0ff;
    --muted: #a4abc8;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #8f8bff;
    --accent-ink: #0b0d1c;
    --accent-soft: rgba(143, 139, 255, 0.16);
    --glass: rgba(255, 255, 255, 0.07);
    --glass-strong: rgba(22, 24, 48, 0.82);
    --glass-edge: rgba(255, 255, 255, 0.14);
    --glass-shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.6);
    --field: rgba(255, 255, 255, 0.08);
    --mint: rgba(52, 211, 153, 0.16);
    --amber: rgba(251, 191, 36, 0.16);
    --rose: rgba(248, 113, 113, 0.16);
    --wash:
      radial-gradient(42vmax 42vmax at 10% 6%, rgba(124, 58, 237, 0.55) 0%, transparent 60%),
      radial-gradient(38vmax 38vmax at 95% 20%, rgba(14, 165, 233, 0.4) 0%, transparent 60%),
      radial-gradient(46vmax 46vmax at 72% 95%, rgba(219, 39, 119, 0.35) 0%, transparent 62%),
      radial-gradient(34vmax 34vmax at 4% 88%, rgba(20, 184, 166, 0.3) 0%, transparent 60%),
      linear-gradient(160deg, #0b0d1c 0%, #120f26 100%);
  }
}

/* the colour wash sits behind everything and stays put while you scroll */
body { background: var(--paper); }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: var(--wash); pointer-events: none; }

/* frosted panes */
.tile, .bento > .section, .bento > .coll, .bento > .book-head, .bento > .filters-tile, .empty, .bubbles, .auth .card, .choice, .list {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
@media (prefers-color-scheme: dark) {
  .tile, .bento > .section, .bento > .coll, .bento > .book-head, .bento > .filters-tile, .empty, .bubbles, .auth .card, .choice, .list {
    box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}
/* rows inside a pane stay clear, so glass is never stacked on glass */
.bento > .section .list, .tile .list, .bento > .coll .list, .list .list { background: transparent; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.list > .item + .item { border-top: 1px solid var(--line); }

/* the greeting pane is tinted ink glass; the scan pane is tinted accent glass */
.tile.hero { background: rgba(18, 20, 43, 0.72); color: #fff; border-color: rgba(255, 255, 255, 0.18); }
.tile.hero h1 { color: #fff; }
.tile.hero p { color: rgba(255, 255, 255, 0.78); }
.tile.hero .chips a { background: rgba(255, 255, 255, 0.16); color: #fff; }
@media (prefers-color-scheme: dark) {
  .tile.hero { background: rgba(255, 255, 255, 0.14); color: var(--ink); }
  .tile.hero h1 { color: var(--ink); }
  .tile.hero p { color: var(--muted); }
  .tile.hero .chips a { background: rgba(255, 255, 255, 0.14); color: var(--ink); }
}
.tile.action { background: rgba(67, 56, 255, 0.82); color: #fff; border-color: rgba(255, 255, 255, 0.3); }
@media (prefers-color-scheme: dark) { .tile.action { background: rgba(143, 139, 255, 0.85); color: #0b0d1c; } }
.tile.stat { color: var(--ink); }
.tile.stat.waiting { background: rgba(255, 200, 80, 0.45); }
@media (prefers-color-scheme: dark) { .tile.stat.waiting { background: rgba(251, 191, 36, 0.22); } }

/* fields and controls sit on the glass as lighter frost */
input[type='text'], input[type='email'], input[type='search'], input[type='date'], input[type='number'], select, textarea {
  background: var(--field); border: 1px solid var(--glass-edge); color: var(--ink);
}
input:focus, select:focus, textarea:focus { background: var(--glass-strong); border-color: var(--accent); }
.btn.quiet { background: var(--field); border: 1px solid var(--glass-edge); }
.btn.quiet:hover { background: var(--glass-strong); }
.seg, .tabs { background: var(--field); border: 1px solid var(--glass-edge); }
.tabs a[aria-current='true'] { background: var(--accent); color: var(--accent-ink); }
.notice { background: var(--accent-soft); border: 1px solid var(--glass-edge); }
.notice.warn { background: var(--amber); }
.tag, .share-pill { background: var(--field); }
.tag.ok, .share-pill.share { background: var(--mint); }
.tag.warn, .share-pill.sale { background: var(--amber); }
.tag.bad { background: var(--rose); }
.more-tile { background: var(--field); border-color: var(--glass-edge); }
.expand { background: var(--field); border: 1px solid var(--glass-edge); }
.bubble { background: var(--field); border: 1px solid var(--glass-edge); }
.bubble.mine { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* navigation, dialogs and the selection bar are the densest glass */
.nav { background: var(--glass-strong); -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%); border-top: 1px solid var(--glass-edge); }
@media (min-width: 900px) {
  .nav { background: var(--glass); border: 0; border-right: 1px solid var(--glass-edge); }
  .nav a[aria-current='page'] { background: var(--glass-strong); }
}
dialog { background: var(--glass-strong); -webkit-backdrop-filter: blur(28px) saturate(170%); backdrop-filter: blur(28px) saturate(170%); border: 1px solid var(--glass-edge); color: var(--ink); }
dialog::backdrop { background: rgba(20, 20, 50, 0.35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.selbar { background: rgba(18, 20, 43, 0.82); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); color: #fff; border: 1px solid rgba(255, 255, 255, 0.18); }
#toast { background: rgba(18, 20, 43, 0.88); color: #fff; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

/* book covers stay solid: glass is for the furniture, not the books */
.cover { box-shadow: 0 6px 18px -8px rgba(20, 20, 60, 0.45); }

/* phones and browsers that cannot blur get a solid frosted pane instead */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tile, .bento > .section, .bento > .coll, .bento > .book-head, .empty, .bubbles, .auth .card, .choice, .list, .nav, dialog { background: var(--glass-strong); }
}
@media (prefers-reduced-transparency: reduce) {
  .tile, .bento > .section, .bento > .coll, .bento > .book-head, .empty, .bubbles, .auth .card, .choice, .list, .nav, dialog { background: var(--glass-strong); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
.star { color: rgba(18, 20, 43, 0.28); }
@media (prefers-color-scheme: dark) { .star { color: rgba(255, 255, 255, 0.32); } }
.star[aria-pressed='true'] { color: #f5a400; }

.star { font-size: 1.55rem; }
.star[aria-pressed='true'] { color: #ef4444; }

/* sharing: three clear choices */
.share-opts { display: grid; gap: 0.5rem; margin-top: 0.35rem; }
.share-opt { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.75rem 0.85rem; border-radius: 14px; border: 1.5px solid var(--glass-edge, var(--line)); background: var(--field, var(--card)); cursor: pointer; }
.share-opt input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.share-opt b { display: block; font-size: 1rem; }
.share-opt small { display: block; color: var(--muted); font-size: 0.88rem; line-height: 1.35; margin-top: 0.1rem; }
.share-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.share-opts.off { opacity: 0.55; }
.share-opts.off .share-opt { cursor: default; }
.share-price { margin-top: 0.7rem; }

/* guided sign-up */
.examples { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.5rem; }
.eg { border: 1px solid var(--glass-edge, var(--line)); background: var(--field, var(--paper)); color: var(--accent); font: 600 0.95rem var(--font-body); padding: 0.3rem 0.75rem; border-radius: 99px; cursor: pointer; min-height: 36px; }
.eg:hover { background: var(--accent-soft); }
.guide h2 { margin-bottom: 0.7rem; }
.guide p { margin: 0 0 0.7rem; }
.guide .guide-lead { font-size: 1.05rem; }
.ico { display: inline-flex; vertical-align: -5px; color: var(--accent); }
.ico svg { width: 22px; height: 22px; }
.guide-row { display: flex; gap: 0.9rem; align-items: center; margin: 0.35rem 0 0.5rem; }
.guide-row p { margin: 0; font-size: 1.02rem; line-height: 1.35; }
.guide-pic { width: 112px; height: auto; flex: none; border-radius: 16px; }
@media (min-width: 640px) { .guide-pic { width: 140px; } }

/* busy indicator inside a button */
.btn .spin { width: 15px; height: 15px; margin: 0 0.5rem 0 0; vertical-align: -2px; border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
.btn.quiet .spin { border-color: var(--line); border-top-color: var(--accent); }
.btn[aria-busy='true'] { opacity: 0.85; cursor: progress; }
.guide-pic { width: 128px; }
@media (min-width: 640px) { .guide-pic { width: 150px; } }

/* My shelf: a compact header with the search magnifier at the top right */
.shelf-head { align-items: center; }
.shelf-head h1 { margin: 0; }
.shelf-head .count { display: block; margin-top: 0.1rem; }
.icon-btn { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--glass-edge, var(--line)); background: var(--glass, var(--card)); color: var(--ink); cursor: pointer; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.icon-btn:hover { color: var(--accent); }
.icon-btn[aria-expanded='true'] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.icon-btn svg { width: 22px; height: 22px; }

/* a short greeting tile */
.tile.hero.compact { min-height: 0; gap: 0.7rem; padding: 1.1rem 1.3rem; }
.tile.hero.compact h1 { font-size: 1.9rem; }
.tile.hero.compact p { margin: 0.15rem 0 0; }

/* reading progress */
.pct { display: inline-block; min-width: 3.2rem; text-align: center; font-weight: 700; font-size: 0.95rem; padding: 0.25rem 0.7rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.progress { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.8rem; align-items: center; }
.progress > .small { grid-column: 1 / -1; }
.pct-live { min-width: 3rem; text-align: right; font-size: 1.05rem; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border-radius: 99px; padding: 0; border: 0; cursor: pointer;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--line) var(--fill, 0%)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
.slider::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
.bar { height: 6px; border-radius: 99px; background: var(--line); margin-top: 0.4rem; overflow: hidden; max-width: 14rem; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.seg button .pct-in { margin-left: 0.4rem; font-weight: 700; opacity: 0.95; }

/* home: reading now, and adding books */
.now-row { text-decoration: none; color: inherit; align-items: center; gap: 0.8rem; }
.now-row .cover { width: 46px; flex: none; }
.bar.wide { max-width: none; height: 8px; margin-top: 0.45rem; }
.scan-status { text-decoration: none; color: var(--ink); display: block; }
.scan-status:hover { text-decoration: none; outline: 2px solid var(--accent); outline-offset: -2px; }
.scan-status h2, .now h2 { margin-bottom: 0.6rem; }
.scan-line { display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; margin: 0.25rem 0; }
.scan-line .spin { margin: 0 0.1rem 0 0; flex: none; }
.scan-line:has(.spin) { justify-content: flex-start; font-weight: 600; }
.scan-status p { margin: 0.2rem 0 0.4rem; }

/* a wrapper whose children sit directly in the bento grid */
.bento > .slot { display: contents; }
.bento > .slot > * { grid-column: 1 / -1; min-width: 0; }
@media (min-width: 900px) { .bento > .slot > .span-6 { grid-column: span 6; } }
.now-row .cover .spine { padding: 0.35rem 0.25rem 0.25rem 0.5rem; }
.now-row .cover .spine b { font-size: 0.62rem; line-height: 1.1; overflow-wrap: normal; word-break: normal; hyphens: none; }
.now-row .cover .spine span { display: none; }

/* pictures of people */
.avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; overflow: hidden; color: #fff; font-weight: 700; line-height: 1; vertical-align: middle; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--card); }
.chip .avatar { margin-right: 0.1rem; }
.hero-id { display: flex; align-items: center; gap: 0.9rem; }
.hero-id .avatar { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }
.btn .ico { color: inherit; }

/* choosing and cropping a picture */
.picker .av-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.av-opt { padding: 0; border: 3px solid transparent; border-radius: 50%; background: none; cursor: pointer; aspect-ratio: 1; line-height: 0; overflow: hidden; }
.av-opt img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.av-opt:hover { border-color: var(--accent-soft); }
.av-opt[aria-checked='true'] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.crop-stage { display: flex; justify-content: center; }
.crop-view { position: relative; overflow: hidden; border-radius: 18px; background: #111; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.crop-view:active { cursor: grabbing; }
.crop-view:focus-visible { outline: 3px solid var(--accent); }
.crop-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; user-select: none; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.55); border: 2px solid rgba(255, 255, 255, 0.9); pointer-events: none; }
.crop-zoom { display: grid; grid-template-columns: auto 1fr auto; gap: 0.7rem; align-items: center; }
.crop-prevrow { display: flex; gap: 0.8rem; align-items: center; }
.crop-prev { position: relative; flex: none; border-radius: 50%; overflow: hidden; background: #111; }
.picker > p.small { margin-top: 0.3rem !important; }

/* People */
.who b { font-weight: 700; }
.who-handle { font-weight: 500; opacity: 0.7; }
.pills { margin: 0.1rem 0 0.2rem; gap: 0.5rem; }
.pills .btn { position: relative; }
.pill-n { display: inline-block; min-width: 1.25rem; margin-left: 0.45rem; padding: 0 0.35rem; border-radius: 99px; background: var(--bad); color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 1.3rem; text-align: center; }
.friend-id { display: flex; align-items: center; gap: 0.8rem; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.friend-id:hover { text-decoration: none; }
.friend-id b { display: block; }

/* People with no books yet take little room */
.coll.thin { padding: 0.8rem 1.1rem; }
.coll.thin p { margin: 0.25rem 0 0; }
h2 .count { margin-left: 0.45rem; }

/* progress while photos are read */
.bar > i { transition: width 0.9s ease; }
.scan-pct { margin-left: auto; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.scan-line:has(.spin) { width: 100%; }

/* reading and finished on covers */
.read-badge { position: absolute; left: 6px; top: 6px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.read-badge.reading { background: var(--accent); }
.read-badge.finished { background: #16a34a; }
.read-badge svg { width: 15px; height: 15px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; }
.seg .seg-ico { display: inline-flex; }
.seg .seg-ico svg { width: 18px; height: 18px; }
/* tap the cover to change it */
.cover-edit { position: relative; display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 12px; }
.cover-edit:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.cover-cam { position: absolute; right: 8px; bottom: 8px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35); }
.cover-cam svg { width: 20px; height: 20px; }

.cover .read-badge, .book .cover .read-badge { left: auto; top: auto; right: 6px; bottom: 6px; width: 24px; height: 24px; }
.cover .read-badge svg { width: 14px; height: 14px; }
.cover-edit { text-align: left; font: inherit; color: inherit; }

/* email choices in Settings */
.mail-opt { display: flex; gap: 0.8rem; align-items: flex-start; padding: 0.7rem 0; cursor: pointer; }
.mail-opt + .mail-opt { border-top: 1px solid var(--line); }
.mail-opt input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.mail-opt b { display: block; }
.mail-opt small { display: block; color: var(--muted); font-size: 0.9rem; line-height: 1.4; margin-top: 0.1rem; }
/* titles on the tiny covers in lists: keep words whole */
.cover.small .spine b { font-size: 0.62rem; line-height: 1.1; overflow-wrap: normal; word-break: normal; hyphens: none; }
.cover.small .spine span { display: none; }

/* select and share: the bar sits at the top, with a clear Select all */
.selbar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 8px); bottom: auto; }
@media (min-width: 900px) { .selbar { bottom: auto; } }
.selbar .selall { background: #ffffff; color: #12142b; font-weight: 700; }
.picking .cover .spine { padding-top: 2.6rem; }
/* People: the share state as an icon */
.share-pill.icon-only { width: 34px; height: 34px; padding: 0; justify-content: center; gap: 0; }
.share-pill.icon-only svg { width: 20px; height: 20px; }
.coll-head .btn.small { padding: 0.2rem 0.8rem; }
/* a list with no heading above it needs less room at the top */
.bento > .section:not(:has(> h2)) { padding-top: 0.5rem; padding-bottom: 0.7rem; }

/* book page: my copy's controls next to the cover */
.share-pill.big { font-size: 0.98rem; padding: 0.4rem 0.9rem 0.4rem 0.6rem; min-height: 40px; }
.share-pill.big svg { width: 20px; height: 20px; }
.copy-status { margin-top: 0.7rem; gap: 0.5rem; align-items: center; }
.who-link { color: inherit; text-decoration: none; }
.who-link:hover { text-decoration: underline; }
/* the cover photo editor */
.pe-stage { display: flex; justify-content: center; margin-bottom: 0.7rem; }
.pe-frame { position: relative; overflow: hidden; border-radius: 10px; background: #111; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; outline-offset: 2px; }
.pe-frame:active { cursor: grabbing; }
.pe-frame:focus-visible { outline: 3px solid var(--accent); }
.pe-img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: 50% 50%; pointer-events: none; user-select: none; }
.pe-grid { position: absolute; inset: 0; pointer-events: none; border: 2px solid rgba(255, 255, 255, 0.85); border-radius: 10px;
  background: linear-gradient(to right, transparent 33.2%, rgba(255,255,255,.35) 33.3%, transparent 33.5%, transparent 66.5%, rgba(255,255,255,.35) 66.7%, transparent 66.8%),
              linear-gradient(to bottom, transparent 33.2%, rgba(255,255,255,.35) 33.3%, transparent 33.5%, transparent 66.5%, rgba(255,255,255,.35) 66.7%, transparent 66.8%); }
.pe-tools { justify-content: center; margin-bottom: 0.4rem; }
.pe-row { display: grid; grid-template-columns: 5.5rem 1fr 3rem; gap: 0.6rem; align-items: center; margin: 0.35rem 0; }
.pe-val { text-align: right; font-variant-numeric: tabular-nums; }
dialog .dlg { max-height: 88vh; overflow-y: auto; }
/* the reading filter on a friend's page */
.tile > .pills { margin: 0.2rem 0 0.9rem; }

/* home: the open book at the top right of the greeting tile */
.tile.hero { position: relative; }
.tile.hero .hero-reading { position: absolute; top: 0.9rem; right: 0.9rem; z-index: 2; }
.tile.hero .icon-btn { background: color-mix(in srgb, var(--paper) 16%, transparent); color: var(--paper); border-color: color-mix(in srgb, var(--paper) 28%, transparent); }
.tile.hero .icon-btn:hover { color: var(--paper); background: color-mix(in srgb, var(--paper) 26%, transparent); }
.icon-badge { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: #e5484d; color: #fff; font-size: 0.75rem; font-weight: 700; display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px var(--ink, #12142b); }
.icon-btn { position: relative; }
.now-row .bar.wide { max-width: none; }

/* a favorite heart is red (the gold stays for star ratings) */
.star[aria-pressed='true'] { color: #e5484d; }
.star { transition: color 0.15s, transform 0.15s; }
.star[aria-pressed='true']:active { transform: scale(1.2); }

/* the cover on the book page: tap it to zoom, the camera (owners) changes the photo */
.cover-wrap { position: relative; display: block; }
.cover-zoom { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 12px; font: inherit; color: inherit; text-align: left; }
.cover-zoom:focus-visible, .cover-cam:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.cover-lens { position: absolute; left: 8px; top: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(18, 20, 43, 0.62); color: #fff; backdrop-filter: blur(6px); }
.cover-lens svg { width: 16px; height: 16px; }
.cover-cam { border: 0; cursor: pointer; padding: 0; z-index: 2; }
/* the full-screen photo viewer */
dialog.viewer { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: rgba(6, 8, 18, 0.97); color: #fff; box-shadow: none; overflow: hidden; -webkit-backdrop-filter: none; backdrop-filter: none; }
dialog.viewer::backdrop { background: rgba(0, 0, 0, 0.7); }
.viewer-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; outline: none; }
.viewer-stage.zoomed:active { cursor: grabbing; }
.viewer-img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: 50% 50%; pointer-events: none; user-select: none; border-radius: 3px; box-shadow: 0 12px 50px rgba(0, 0, 0, 0.55); will-change: transform; }
.viewer-btn { min-width: 44px; height: 44px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(40, 44, 78, 0.72); color: #fff; font: inherit; font-size: 1.25rem; font-weight: 600; cursor: pointer; display: inline-grid; place-items: center; padding: 0 0.9rem; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.viewer-btn:hover { background: rgba(70, 76, 128, 0.85); }
.viewer-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.viewer-close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; padding: 0; width: 44px; z-index: 3; }
.viewer-bar { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); transform: translateX(-50%); display: flex; gap: 0.5rem; align-items: center; z-index: 3; }
.viewer-fit { font-size: 0.95rem; }
.viewer-zoom { min-width: 3.4rem; text-align: center; font-variant-numeric: tabular-nums; font-size: 0.95rem; color: rgba(255, 255, 255, 0.9); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
.viewer-problem { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; z-index: 1; }
/* small refinements: hint in the top-right corner of the cover, readable zoom bar */
.cover-lens { left: auto; right: 8px; top: 8px; width: 28px; height: 28px; background: rgba(18, 20, 43, 0.55); }
.viewer-bar { padding: 0.35rem 0.5rem; border-radius: 99px; background: rgba(18, 22, 46, 0.82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid rgba(255, 255, 255, 0.18); }
.viewer-bar .viewer-btn { background: rgba(255, 255, 255, 0.12); border-color: transparent; }

/* "a new version is ready" */
.update-bar { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; gap: 0.8rem; align-items: center; max-width: calc(100vw - 24px); padding: 0.45rem 0.5rem 0.45rem 1rem; border-radius: 99px; background: #12142b; color: #fff; font-size: 0.95rem; box-shadow: 0 10px 30px rgba(10, 14, 30, 0.35); border: 1px solid rgba(255, 255, 255, 0.2); }
.update-bar .btn { background: #fff; color: #12142b; }
.update-bar { left: 0; right: 0; margin: 0 auto; transform: none; width: max-content; max-width: calc(100vw - 24px); }
.update-bar span { line-height: 1.25; }

/* ---------- search ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bento > .sbox { grid-column: 1 / -1; }
.sbox { position: relative; z-index: 20; }
.sbar { display: flex; align-items: center; gap: 0.55rem; height: 52px; padding: 0 0.5rem 0 1.05rem; border-radius: 99px; background: var(--glass-strong, rgba(255, 255, 255, 0.72)); border: 1px solid var(--line); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); box-shadow: 0 6px 24px rgba(30, 40, 90, 0.08); transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s; }
.sbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 24%, transparent), 0 10px 30px rgba(30, 40, 90, 0.14); }
.sbar .sicon { display: grid; place-items: center; color: var(--accent); flex: none; }
.sbar .sicon svg { width: 21px; height: 21px; }
.sbar input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-size: 1.02rem; padding: 0; box-shadow: none; }
.sbar input::placeholder { color: color-mix(in srgb, var(--ink) 50%, transparent); }
.sclear { width: 38px; height: 38px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--ink) 9%, transparent); color: inherit; display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.sclear:hover { background: color-mix(in srgb, var(--ink) 16%, transparent); }
.sclear svg { width: 16px; height: 16px; }
.sclear[hidden] { display: none; }
.spanel { position: absolute; left: 0; right: 0; top: calc(100% + 10px); max-height: min(72vh, 560px); overflow-y: auto; overscroll-behavior: contain; padding: 0.5rem; border-radius: 22px; background: var(--glass-strong, rgba(255, 255, 255, 0.92)); border: 1px solid var(--line); -webkit-backdrop-filter: blur(26px) saturate(1.5); backdrop-filter: blur(26px) saturate(1.5); box-shadow: 0 24px 60px rgba(20, 28, 70, 0.28); }
.spanel[hidden] { display: none; }
.spanel.busy { opacity: 0.72; transition: opacity 0.12s; }
.sgroup + .sgroup { margin-top: 0.25rem; border-top: 1px solid var(--line); padding-top: 0.25rem; }
.shead { display: flex; justify-content: space-between; align-items: center; padding: 0.45rem 0.7rem 0.2rem; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: color-mix(in srgb, var(--ink) 55%, transparent); }
.slink { border: 0; background: none; color: var(--accent); font: inherit; font-size: 0.8rem; font-weight: 600; text-transform: none; letter-spacing: 0; cursor: pointer; }
.srow { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.7rem; border-radius: 14px; color: inherit; text-decoration: none; }
.srow:hover, .srow[aria-selected='true'] { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.srow .cover { width: 38px; flex: none; }
.srow-text { flex: 1; min-width: 0; }
.srow-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow-sub { font-size: 0.86rem; color: color-mix(in srgb, var(--ink) 62%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow mark, .shead mark { background: color-mix(in srgb, var(--accent) 24%, transparent); color: inherit; border-radius: 4px; padding: 0 1px; }
.schips { display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0.3rem 0.6rem 0.5rem; }
.section > .schips { padding-left: 0; padding-right: 0; }
.schip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.4rem 0.85rem; border-radius: 99px; border: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 70%, transparent); color: inherit; font: inherit; font-size: 0.92rem; text-decoration: none; cursor: pointer; }
.schip:hover, .schip[aria-selected='true'] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.sall { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin: 0.35rem 0.4rem 0.2rem; padding: 0.7rem; border-radius: 14px; color: var(--accent); font-weight: 700; text-decoration: none; background: color-mix(in srgb, var(--accent) 9%, transparent); }
.sall svg { width: 17px; height: 17px; }
.sall:hover, .sall[aria-selected='true'] { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.shint, .sempty { margin: 0; padding: 0.7rem 0.8rem; color: color-mix(in srgb, var(--ink) 62%, transparent); font-size: 0.92rem; }
.sempty b { color: var(--ink); }
.sempty p { margin: 0.3rem 0 0; }

.spanel { background: color-mix(in srgb, var(--paper) 96%, transparent); }

/* wide screens: the home, shelf and people pages use the whole width */
@media (min-width: 900px) { main > .wrap.wide { max-width: 1560px; } }
/* the row of covers, with arrows for a mouse (not shown on a touch screen) */
.strip-box { position: relative; }
.strip-nav { display: none; }
@media (hover: hover) and (pointer: fine) {
  .strip-nav { display: grid; place-items: center; position: absolute; top: 80px; width: 44px; height: 44px; padding: 0 0 4px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass-strong, #fff); color: var(--ink); font: inherit; font-size: 1.9rem; line-height: 1; cursor: pointer; z-index: 3; box-shadow: 0 8px 24px rgba(20, 28, 70, 0.28); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .strip-nav:hover { border-color: var(--accent); color: var(--accent); }
  .strip-nav.prev { left: -12px; }
  .strip-nav.next { right: -12px; }
  .strip-nav[hidden] { display: none; }
}

/* "Friend of Bina" next to a name */
.mutual { display: inline-flex; align-items: center; padding: 0.18rem 0.6rem; border-radius: 99px; font-size: 0.8rem; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); white-space: nowrap; }

/* ---------- the side menu on a computer: a strip of icons that opens while the pointer is over it ---------- */
.brand-mark { display: none; }
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .nav { width: 76px; padding-left: 0.5rem; padding-right: 0.5rem; overflow: hidden; z-index: 40; transition: width 0.2s ease 0.12s, box-shadow 0.2s ease 0.12s; }
  main { margin-left: 76px; }
  /* open: while the pointer is over it, or a keyboard user is moving through it (not just because it was clicked) */
  .nav:hover, .nav:has(:focus-visible) { width: 220px; padding-left: 0.75rem; padding-right: 0.75rem; box-shadow: 12px 0 44px rgba(20, 28, 70, 0.24); transition-delay: 0s; background: color-mix(in srgb, var(--paper) 96%, transparent); }
  .brand { white-space: nowrap; padding-left: 0; text-align: center; }
  .brand-full { display: none; }
  .brand-mark { display: block; font-weight: 800; color: var(--accent); }
  .nav:hover .brand, .nav:has(:focus-visible) .brand { padding-left: 0.5rem; text-align: left; }
  .nav:hover .brand-full, .nav:has(:focus-visible) .brand-full { display: inline; }
  .nav:hover .brand-mark, .nav:has(:focus-visible) .brand-mark { display: none; }
  .nav a { justify-content: center; padding: 0.7rem 0; gap: 0; }
  .nav a > span:not(.plus):not(.badge) { max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; transition: opacity 0.15s ease; }
  .nav .badge { position: absolute; top: 2px; right: 8px; margin: 0; }
  .nav:hover a, .nav:has(:focus-visible) a { justify-content: flex-start; padding: 0.7rem 0.75rem; gap: 12px; }
  .nav:hover a > span:not(.plus):not(.badge), .nav:has(:focus-visible) a > span:not(.plus):not(.badge) { max-width: 150px; opacity: 1; transition-delay: 0.08s; }
  .nav:hover .badge, .nav:has(:focus-visible) .badge { position: static; margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } .nav a > span { transition: none; } }

/* the avatar picker: many avatars, in groups, in a scrolling box */
.av-groups { max-height: min(46vh, 380px); overflow-y: auto; padding: 0.2rem 0.2rem 0.4rem; margin: 0.4rem 0; -webkit-overflow-scrolling: touch; }
.av-head { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0.5rem 0 0.4rem; }
.av-group:first-child .av-head { margin-top: 0; }

/* ---------- campus ---------- */
.community-tag { display: inline-block; margin-left: 0.45rem; padding: 0.12rem 0.5rem; border-radius: 99px; font-size: 0.55em; font-weight: 800; letter-spacing: 0.04em; vertical-align: middle; color: var(--accent-ink, #fff); background: var(--accent); }
.community-tag.big { font-size: 0.4em; }
.nav .brand .community-tag { font-size: 0.5rem; margin-left: 0.35rem; }
ol.rules { margin: 0.2rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.6rem; }
ol.rules li { line-height: 1.4; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.7rem; }
.stat { display: flex; flex-direction: column; padding: 0.7rem 0.9rem; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.stat b { font-size: 1.6rem; line-height: 1.1; }
.stat span { font-size: 0.8rem; color: var(--muted); }
.stat.bad { background: color-mix(in srgb, var(--bad) 16%, var(--card)); }
.chips.subjects { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.8rem; }
.pill-n.soft { background: color-mix(in srgb, var(--ink) 12%, transparent); color: var(--ink); margin-left: 0.4rem; }
.on-campus .strip .book { flex-basis: 140px; }

/* ---------- flipping between books, genre and synopsis ---------- */
.book-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin: 0.2rem 0 0.8rem; }
.genre-slot:empty { display: none; }
.genre-slot { margin: 0.4rem 0 0.1rem; }
.genre-chip { display: inline-flex; align-items: center; padding: 0.25rem 0.8rem; border-radius: 99px; font-size: 0.85rem; font-weight: 700; text-decoration: none; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); }
.genre-chip:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.synopsis { max-width: 65ch; font-size: 1.02rem; line-height: 1.55; margin: 0; }
.synopsis-more { max-width: 65ch; margin: 0.6rem 0 0; line-height: 1.5; color: var(--muted); }
@keyframes slideFromRight { from { opacity: 0; transform: translateX(34px); } to { opacity: 1; transform: none; } }
@keyframes slideFromLeft { from { opacity: 0; transform: translateX(-34px); } to { opacity: 1; transform: none; } }
.slide-from-right { animation: slideFromRight 0.22s ease-out; }
.slide-from-left { animation: slideFromLeft 0.22s ease-out; }
@media (prefers-reduced-motion: reduce) { .slide-from-right, .slide-from-left { animation: none; } }

/* ---------- communities ---------- */
.who-home { color: var(--muted); font-size: 0.85em; font-weight: 500; }
.neighbour { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0.2rem; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.neighbour:last-child { border-bottom: 0; }
.neighbour .grow { min-width: 0; }
.block-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }

.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
