/* Family Books: app styles. Paper-and-ink look, phone first, light and dark. */
:root {
  --bg: #f6f1e8; --card: #fffdf8; --raise: #fbf7f0; --ink: #1f1a14; --ink2: #5b5247; --ink3: #8b8174; --line: #e6ddcf;
  --accent: #b5512b; --accent2: #93401f; --accent-soft: #f4e3d8; --ok: #2f9e5b; --warn: #b7791f;
  --shadow: 0 1px 2px rgba(50, 30, 10, .07), 0 8px 22px rgba(50, 30, 10, .08);
  --cover-shadow: 0 1px 1px rgba(0, 0, 0, .12), 0 6px 14px rgba(40, 20, 0, .18);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabh: 62px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110e; --card: #1e1a16; --raise: #25201b; --ink: #f0e9df; --ink2: #c3b9ac; --ink3: #8f8579; --line: #322b25;
    --accent: #e0794c; --accent2: #f09a72; --accent-soft: #3b2619;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .35);
    --cover-shadow: 0 1px 1px rgba(0, 0, 0, .4), 0 6px 14px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--sans); min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.wrap { max-width: 980px; margin: 0 auto; padding: calc(14px + var(--safe-t)) 16px calc(var(--tabh) + 28px + var(--safe-b)); }
.hidden { display: none !important; }

/* headings and text */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; color: var(--ink3); }
.sec { margin: 26px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec a { color: var(--accent); font-size: 14px; font-weight: 600; white-space: nowrap; }
.topbar { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.topbar .grow { flex: 1; min-width: 0; }
.back { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--raise); display: grid; place-items: center; flex: none; }
.back svg { width: 20px; height: 20px; }

/* buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.danger { color: #c0392b; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 14px; color: var(--ink2); margin: 0 0 6px; font-weight: 600; }
.input { width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  padding: 10px 14px; font-size: 17px; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.code { font-size: 26px; letter-spacing: .3em; text-transform: uppercase; text-align: center; font-weight: 700; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--ink3); }
.search .input { padding-left: 44px; border-radius: 999px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink2); margin: 10px 2px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.empty { text-align: center; padding: 30px 16px; color: var(--ink2); }
.empty .big { font-size: 40px; margin-bottom: 6px; }

/* covers */
.cover { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 5px; box-shadow: var(--cover-shadow);
  background: var(--raise); }
/* drawn covers: padding in px, never %: a % padding is measured against the PARENT's width, so a 64 px cover in a 300 px card
   got ~29 px each side, the title collapsed to nothing and the author spilled out (Dan's screenshot 11/26) */
.cover.ph { position: relative; overflow: hidden; padding: 13px 11px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(160deg, hsl(var(--h) 38% 34%), hsl(calc(var(--h) + 30) 42% 22%)); color: #fbf3e6; }
.cover.ph::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(255, 240, 220, .35); border-radius: 3px; }
/* title size: at most the usual size, smaller when the longest word (--w letters, ~0.56 em each) would not fit the cover's width */
.cover.ph b { font-family: var(--serif); font-weight: 600; font-size: clamp(9px, calc(153px / var(--w, 6)), 13px); line-height: 1.2; position: relative; overflow-wrap: anywhere; hyphens: auto;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.cover.ph small { font-size: 10px; line-height: 1.2; opacity: .85; position: relative; overflow-wrap: anywhere; hyphens: auto;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cover.ph.lg { padding: 12% 10%; }                                   /* the book page's cover fills its own grid column, so % is right there */
.cover.ph.lg b { font-size: clamp(13px, calc(188px / var(--w, 6)), 20px); }
.cover.ph.lg small { font-size: 13px; }
/* small covers beside a title (Continue reading, result rows, read-ins, asks): smaller frame and type, so the title fits */
.cont-card .cover.ph, .pl-head .cover.ph, .res .cover.ph, .rihead .cover.ph, .homeri .cover.ph, .pickrow .cover.ph { padding: 9px 6px; }
.cont-card .cover.ph::before, .pl-head .cover.ph::before, .res .cover.ph::before, .rihead .cover.ph::before, .homeri .cover.ph::before,
  .pickrow .cover.ph::before { inset: 3px; }
.cont-card .cover.ph b, .pl-head .cover.ph b { font-size: clamp(6.5px, calc(88px / var(--w, 6)), 9.5px); -webkit-line-clamp: 5; }
.rihead .cover.ph b, .homeri .cover.ph b, .pickrow .cover.ph b { font-size: clamp(6px, calc(71px / var(--w, 6)), 9px); -webkit-line-clamp: 5; }   /* 54 px covers */
.cont-card .cover.ph small, .pl-head .cover.ph small, .rihead .cover.ph small, .homeri .cover.ph small, .pickrow .cover.ph small { font-size: 8px; }

.row { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 16px 10px; margin: 0 -16px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.row::-webkit-scrollbar { display: none; }
.tile { flex: none; width: 108px; scroll-snap-align: start; display: block; }
.tile .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px;
  font-weight: 600; line-height: 1.25; margin-top: 8px; }
.tile .a { display: block; font-size: 12px; color: var(--ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 14px; }
.grid .tile { width: auto; }

/* continue reading */
.cont { display: flex; gap: 14px; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 10px; scrollbar-width: none; scroll-snap-type: x mandatory; }
.cont::-webkit-scrollbar { display: none; }
.cont-card { flex: none; width: min(320px, 82vw); display: flex; gap: 14px; align-items: center; scroll-snap-align: start; }
.cont-card .cover { width: 64px; flex: none; }
.cont-card .info { min-width: 0; flex: 1; }
.cont-card .ti { font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.2; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 8px 0 4px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* result rows */
.res { display: flex; gap: 14px; align-items: center; padding: 10px; border-radius: 14px; }
.res:active { background: var(--raise); }
.res .cover { width: 54px; flex: none; }
.res .cover.ph b { font-size: clamp(6px, calc(71px / var(--w, 6)), 8.5px); -webkit-line-clamp: 5; }
.res .cover.ph small { display: none; }
.res .info { min-width: 0; flex: 1; }
.res .ti { font-weight: 600; line-height: 1.25; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px;
  background: var(--raise); color: var(--ink2); border: 1px solid var(--line); }
.badge.ready { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* avatars and people */
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--c, #888);
  font-size: 18px; flex: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); line-height: 1; }
.person { display: flex; gap: 12px; align-items: center; }
.person .info { flex: 1; min-width: 0; }
.person .nm { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.now { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ok); }
.now::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 158, 91, .5); } 70% { box-shadow: 0 0 0 8px rgba(47, 158, 91, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 158, 91, 0); } }
.stack { display: flex; }
.stack .avatar { width: 28px; height: 28px; font-size: 14px; margin-left: -6px; box-shadow: 0 0 0 2px var(--card); }
.stack .avatar:first-child { margin-left: 0; }

/* pickers */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .3); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--ink); }
.icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.iconb { aspect-ratio: 1; min-width: 0; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 22px; line-height: 1; }
.iconb[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); }

/* book page */
.bookhead { display: grid; grid-template-columns: 132px 1fr; gap: 18px; align-items: end; margin-top: 6px; }
.bookhead .ti { font-size: 26px; line-height: 1.15; }
.meta { color: var(--ink2); font-size: 14px; margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line); color: var(--ink2); }
.chlist { border-top: 1px solid var(--line); }
.chlist a { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); align-items: baseline; }
.chlist a .n { color: var(--ink3); font-size: 13px; width: 28px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.chlist a .tt { flex: 1; min-width: 0; }
.chlist a.cur { color: var(--accent); font-weight: 700; }
.chlist a.done .tt { color: var(--ink3); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 22px; }
.stepper .val { font-size: 28px; font-weight: 700; min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tabs */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--card) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
#tabs .in { display: flex; width: 100%; max-width: 560px; }
#tabs a { flex: 1; height: var(--tabh); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--ink3); }
#tabs a svg { width: 24px; height: 24px; }
#tabs a.on { color: var(--accent); }
#tabs a[hidden] { display: none; }            /* the Hub tab (1.4.1) shows only for people who came from the Hub, and the owner */
body.reading #tabs, body.out #tabs { display: none; }

/* sheets and toast */
.backdrop { position: fixed; inset: 0; background: rgba(10, 6, 2, .45); z-index: 40; animation: fade .15s ease; touch-action: none; }
html.sheetopen, html.sheetopen body { overflow: hidden; }       /* the page behind a sheet stays put (Dan's report #3, 11/14) */
.sheet { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--card); color: var(--ink);
  border-radius: 22px 22px 0 0; max-height: 86vh; overflow: auto; padding: 8px 18px calc(20px + var(--safe-b));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .2); animation: up .2s ease; max-width: 640px; margin: 0 auto; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { margin-bottom: 14px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + 18px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-size: 15px; font-weight: 600;
  max-width: calc(100vw - 32px); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(-4px); }
body.reading #toast { bottom: calc(60px + var(--safe-b)); }

/* welcome */
.welcome { max-width: 440px; margin: 0 auto; padding: calc(40px + var(--safe-t)) 20px 40px; }
.logo { width: 76px; height: 76px; border-radius: 20px; display: grid; place-items: center; background: var(--accent); color: #fff;
  box-shadow: var(--shadow); margin-bottom: 18px; }
.logo svg { width: 44px; height: 44px; }
.bigcode { font-size: 40px; font-weight: 800; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums;
  padding: 14px 0 10px; font-family: var(--sans); }
.copyrow { display: flex; gap: 8px; align-items: center; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 12px; }
.copyrow code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.feed .ev { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed .ev:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- reader */
.reader { --rbg: #fbf8f2; --rink: #1d1913; --rink2: #776d60; --rline: #e9e1d4; --racc: #a9481f;
  --fs: 19px; --lh: 1.65; --rfont: var(--serif); background: var(--rbg); color: var(--rink); min-height: 100vh; }
.reader[data-theme="sepia"] { --rbg: #f3e8d2; --rink: #3b2e1e; --rink2: #7f6b52; --rline: #e2d3b6; --racc: #9a4a1e; }
.reader[data-theme="night"] { --rbg: #121110; --rink: #d9d2c7; --rink2: #8b8378; --rline: #2a2622; --racc: #e08a5f; }
.reader[data-font="sans"] { --rfont: var(--sans); }
/* everything inside the reader (sheets, buttons, muted text) follows the reader's page, not the app's light/dark */
.reader { --ink: var(--rink); --ink2: var(--rink2); --ink3: var(--rink2); --line: var(--rline); --card: var(--rbg);
  --raise: color-mix(in srgb, var(--rink) 7%, var(--rbg)); --accent: var(--racc); --accent-soft: color-mix(in srgb, var(--racc) 18%, var(--rbg)); }
body.reading { background: var(--rbg-body, var(--bg)); }
.rbar { position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; align-items: center; gap: 6px;
  padding: calc(6px + var(--safe-t)) 8px 6px; background: color-mix(in srgb, var(--rbg) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rline); transition: transform .25s ease; }
.rbar.off { transform: translateY(-110%); }
.rbar .ttl { flex: 1; min-width: 0; text-align: center; font-size: 13px; color: var(--rink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rbar button { width: 42px; height: 42px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; color: var(--rink); flex: none; }
.rbar button svg { width: 22px; height: 22px; }
.rbar button.aa { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.rprog { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(26px + var(--safe-b)); padding: 0 14px var(--safe-b);
  display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--rink2); background: var(--rbg);
  border-top: 1px solid var(--rline); font-variant-numeric: tabular-nums; }
.rprog .track { flex: 1; height: 3px; background: var(--rline); border-radius: 2px; overflow: hidden; }
.rprog .track i { display: block; height: 100%; background: var(--racc); }
.prose { font-family: var(--rfont); font-size: var(--fs); line-height: var(--lh); max-width: 36em; margin: 0 auto;
  padding: calc(76px + var(--safe-t)) 22px calc(60px + var(--safe-b)); overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.prose p { margin: 0 0 .85em; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--rfont); text-align: center; line-height: 1.25; margin: 1.3em 0 .9em; font-weight: 600; }
.prose h1 { font-size: 1.6em; } .prose h2 { font-size: 1.35em; } .prose h3 { font-size: 1.15em; } .prose h4 { font-size: 1em; }
.prose img { display: block; height: auto; margin: 1.2em auto; border-radius: 3px; }
.prose img.dropcap { display: inline; float: left; width: auto; height: 3.4em; margin: .2em .35em 0 0; border-radius: 0; }
.prose a { color: var(--racc); text-decoration: underline; text-underline-offset: 2px; }
.prose blockquote { margin: 1em 1.2em; }
.prose hr { border: 0; border-top: 1px solid var(--rline); margin: 2em 25%; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1em 0; font-size: .9em; }
.prose td, .prose th { padding: .2em .6em; vertical-align: top; }
.prose pre { white-space: pre-wrap; font-family: var(--rfont); }
.prose .verse { white-space: normal; }
.prose .verse .ln { display: block; padding-left: 1.6em; text-indent: -1.6em; }
.prose .verse .ln.pw { white-space: pre-wrap; }
.prose .verse .ln.gap { height: .8em; }
.prose .verse .ln.who { font-weight: 700; font-size: .85em; letter-spacing: .04em; color: var(--rink2); }
.prose .center, .prose [class*="center"] { text-align: center; }
.prose sup, .prose sub { line-height: 0; }
.prose ::selection { background: color-mix(in srgb, var(--racc) 30%, transparent); }
.chend { max-width: 36em; margin: 0 auto; padding: 10px 22px calc(80px + var(--safe-b)); text-align: center; font-family: var(--sans); }
.chend .orn { color: var(--rink2); letter-spacing: .6em; margin: 10px 0 22px; }
.chend .btn { background: var(--racc); border-color: var(--racc); color: #fff; min-height: 52px; max-width: 100%; }
.chend .btn .sub { font-weight: 400; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chend .prev { display: inline-block; margin-top: 16px; color: var(--rink2); font-size: 14px; background: none; border: 0; }
.reader .sheet { background: var(--rbg); color: var(--rink); }
.peek { position: fixed; left: 50%; bottom: calc(40px + var(--safe-b)); transform: translateX(-50%); z-index: 35; display: flex;
  align-items: center; max-width: calc(100vw - 24px); background: var(--rink); color: var(--rbg); border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); animation: peekup .2s ease; }
@keyframes peekup { from { transform: translate(-50%, 40px); opacity: 0; } }
.peek button { border: 0; background: transparent; color: inherit; font: 600 15px var(--sans); min-height: 46px; padding: 0 6px 0 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peek button.x { padding: 0 16px 0 10px; opacity: .7; flex: none; }
.seg { display: flex; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.reader .seg { background: color-mix(in srgb, var(--rink) 6%, var(--rbg)); border-color: var(--rline); }
.seg button { flex: 1; min-height: 42px; border: 0; background: transparent; border-radius: 9px; font-weight: 600; color: inherit; }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.reader .seg button[aria-pressed="true"] { background: var(--rbg); }
.setrow { margin-bottom: 16px; }
.setrow > span { display: block; font-size: 13px; font-weight: 700; color: var(--ink3); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 60px 0; color: var(--ink3); }

/* ---------------------------------------------------------------- audiobook player */
.listen { margin-top: 12px; }
.listen-card .tiny svg { width: 13px; height: 13px; vertical-align: -2px; color: var(--accent); }
.listen .btn svg { width: 20px; height: 20px; }
#mini { position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabh) + 6px + var(--safe-b)); z-index: 25; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 2px; padding: 6px 6px 8px; border-radius: 16px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .22); overflow: hidden; }
body.reading #mini { bottom: calc(32px + var(--safe-b)); }
body.out #mini { display: none; }
#mini .mi-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 0 4px; text-align: left; color: inherit; }
#mini .mi-art { width: 40px; height: 40px; flex: none; border-radius: 6px; overflow: hidden; background: var(--raise); display: grid; place-items: center; color: var(--accent); }
#mini .mi-art img { width: 100%; height: 100%; object-fit: cover; }
#mini .mi-art svg { width: 22px; height: 22px; }
#mini .mi-txt { min-width: 0; display: flex; flex-direction: column; }
#mini .mi-txt b, #mini .mi-txt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mini .mi-txt b { font-size: 14px; }
#mini .mi-txt small { font-size: 12px; color: var(--ink3); font-variant-numeric: tabular-nums; }
#mini .mi-b { width: 44px; height: 44px; flex: none; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; color: var(--ink); }
#mini .mi-b svg { width: 26px; height: 26px; }
#mini .mi-play { background: var(--accent); color: #fff; width: 44px; height: 44px; }
#mini .mi-play svg { width: 22px; height: 22px; }
#mini .mi-x { font-size: 16px; color: var(--ink3); width: 36px; }
#mini .mi-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
#mini .mi-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
body.hasplayer .wrap { padding-bottom: calc(var(--tabh) + 100px + var(--safe-b)); }
body.hasplayer .chend { padding-bottom: calc(150px + var(--safe-b)); }
body.hasplayer #toast { bottom: calc(var(--tabh) + 84px + var(--safe-b)); }
body.hasplayer.reading #toast { bottom: calc(110px + var(--safe-b)); }
body.hasplayer .peek { bottom: calc(104px + var(--safe-b)); }
.pl-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.pl-head .cover { width: 64px; flex: none; }
.pl-head h2 { margin: 2px 0; font-size: 19px; }
.pl-ic { width: 64px; height: 64px; border-radius: 12px; background: var(--raise); display: grid; place-items: center; color: var(--accent); flex: none; }
.pl-ic svg { width: 32px; height: 32px; }
.pl-range { width: 100%; margin: 6px 0 0; accent-color: var(--accent); height: 28px; }
.pl-times { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink3); font-variant-numeric: tabular-nums; }
.pl-ctl { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0 18px; }
.pl-b { width: 52px; height: 52px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; color: var(--ink); }
.pl-b svg { width: 28px; height: 28px; }
.pl-b.pl-play { width: 68px; height: 68px; background: var(--accent); color: #fff; }
.pl-b.pl-play svg { width: 30px; height: 30px; }
.pl-rates button { font-variant-numeric: tabular-nums; min-height: 38px; font-size: 14px; }

@media (min-width: 760px) {
  h1 { font-size: 36px; }
  .tile { width: 128px; }
  .bookhead { grid-template-columns: 180px 1fr; }
  .bookhead .ti { font-size: 34px; }
  .prose { padding-left: 40px; padding-right: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- Community (10/25) */
.badge.comm { background: color-mix(in srgb, #2e86de 16%, var(--card)); color: #2e86de; border-color: transparent; }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, var(--card)); color: var(--warn); border-color: transparent; }
.badge.bad { background: color-mix(in srgb, #c0392b 16%, var(--card)); color: #c0392b; border-color: transparent; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; }
.notice { background: var(--raise); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--ink2); line-height: 1.45; }
.card.notice { box-shadow: none; }
.btn.like[aria-pressed="true"] { color: #d6336c; border-color: color-mix(in srgb, #d6336c 40%, var(--line)); }
.say { white-space: pre-line; overflow-wrap: anywhere; margin-top: 2px; color: var(--ink); }
.comment-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.comment-form textarea { flex: 1; resize: vertical; min-height: 44px; }
textarea.input { font-family: var(--sans); line-height: 1.45; resize: vertical; }
.card.flagged { border-color: color-mix(in srgb, #c0392b 45%, var(--line)); }
.check { align-items: flex-start; }
.check input { margin-top: 3px; flex: none; }
/* the faint name watermark over Community reading (it shows in any screenshot) */
.wmark { position: fixed; inset: -20vh -20vw; z-index: 28; pointer-events: none; user-select: none; -webkit-user-select: none;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 64px 56px; padding: 40px; transform: rotate(-24deg);
  font: 600 15px/1 var(--sans); color: var(--rink, #000); opacity: .075; overflow: hidden; white-space: nowrap; }
@media print { .wmark { position: absolute; opacity: .12; } }
/* PDF reader */
.reader.pdfr { --rbg: #2b2722; --rink: #f0e9df; --rink2: #b9afa2; --rline: #3a342d; --racc: #e0794c; }
.reader.pdfr .wmark { color: #000; opacity: .09; z-index: 28; }
.pdfpages { padding: calc(60px + var(--safe-t)) 0 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pdfpage { width: min(100%, 900px); background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.pdfpage canvas { display: block; width: 100%; height: auto; }
.rbar .pgno { font: 600 13px var(--sans); color: var(--rink2); padding: 0 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* recent searches (10/25) */
.recent .res { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  padding: 12px 4px; align-items: center; color: var(--ink); font: inherit; cursor: pointer; }
.recent .res svg { width: 18px; height: 18px; flex: none; color: var(--ink3); }
.recent .res .ti { font-size: 16px; font-weight: 500; }
/* support + version footer (10/25) */
.appfoot { text-align: center; font-size: 12px; color: var(--ink3); margin-top: 36px; line-height: 1.9; }
.appfoot a { color: var(--accent); font-weight: 600; }
.report { padding: 10px 0; border-top: 1px solid var(--line); }
.card.support.isnew { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.supshot { display: block; max-width: 100%; max-height: 260px; margin-top: 10px; border-radius: 10px; border: 1px solid var(--line); }
.support code { font-size: 11px; overflow-wrap: anywhere; }

/* Scan a book (1.5.0): camera box with a guide frame, then "Is this it?" */
.scanbox { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 52vh; border-radius: 18px; overflow: hidden; background: #0d0b09; border: 1px solid var(--line); }
.scanbox video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanguide { position: absolute; left: 8%; right: 8%; top: 26%; bottom: 26%; border: 2px solid rgba(255,255,255,.85); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.28); pointer-events: none; }
.scanmsg { position: absolute; left: 10px; right: 10px; bottom: 8px; text-align: center; font-size: 13px; line-height: 1.35; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.85); }
.scanmsg:empty { display: none; }
.scanisbn { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.scanisbn .input { flex: 1; min-width: 0; }
.scanmsgbox { margin-top: 8px; }

/* My books: remove / put back (1.5.0) */
#toast.act { pointer-events: auto; }
.toastundo { margin-left: 10px; background: transparent; border: 0; color: var(--accent); font: inherit; font-weight: 700; text-decoration: underline; padding: 4px 2px; cursor: pointer; }
.rrow { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-bottom: 4px; }
.rrow .btn { align-self: flex-end; }
#remlist .res .btn { flex: none; }
.linkbtn { background: none; border: 0; padding: 6px 0; color: var(--ink3); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }

/* ---- group read-in (1.6.0) */
.ri { margin-bottom: 0; }
.rihead { display: flex; gap: 14px; align-items: center; color: inherit; text-decoration: none; }
.rihead .cover, .homeri .cover, .pickrow .cover { width: 54px; flex: none; }
.rihead .info, .homeri .info, .pickrow .info { flex: 1; min-width: 0; }
.rihead .ti, .homeri .ti, .pickrow .ti { font-weight: 700; line-height: 1.25; }
.rigoal { font-weight: 700; font-size: 17px; margin-bottom: 2px; }
.rimem { margin-top: 12px; border-top: 1px solid var(--line); }
.rirow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rirow .info { flex: 1; min-width: 0; }
.rirow .nm { font-weight: 600; }
.rirow .rpage { font-size: 13px; color: var(--ink2); }
.ribadge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--raise); color: var(--ink2); border: 1px solid var(--line); white-space: nowrap; }
.ribadge.done, .ribadge.finished { background: color-mix(in srgb, var(--ok) 16%, var(--card)); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.ribadge.onpace { background: var(--accent-soft); color: var(--accent2); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.ribadge.behind { background: color-mix(in srgb, var(--warn) 16%, var(--card)); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.homeri { display: flex; gap: 14px; align-items: center; color: inherit; text-decoration: none; }
/* 1.6.1 (Dan 11/26): paper-copy honesty tick, "That's quick!", the green "Nice reading!", the paper copy tag */
.papertag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; margin-left: 4px; vertical-align: 1px;
  background: var(--raise); color: var(--ink2); border: 1px solid var(--line); white-space: nowrap; }
.pledge { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--raise); font-size: 14px; line-height: 1.4; cursor: pointer; }
.pledge input { width: 20px; height: 20px; flex: none; margin: 1px 0 0; accent-color: var(--ok); }
.pledge:has(input:checked) { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); background: color-mix(in srgb, var(--ok) 10%, var(--card)); }
.quick { text-align: center; padding: 4px 0; }
.quickico { font-size: 40px; line-height: 1; }
.quick h3 { margin: 8px 0 4px; }
.nice { text-align: center; padding: 8px 0 4px; }
.nice h2 { margin: 14px 0 6px; color: var(--ok); }
.nicecheck { width: 76px; height: 76px; margin: 4px auto 0; border-radius: 50%; display: grid; place-items: center; font-size: 40px; font-weight: 800;
  color: #fff; background: var(--ok); box-shadow: 0 0 0 10px color-mix(in srgb, var(--ok) 18%, transparent), 0 0 34px color-mix(in srgb, var(--ok) 55%, transparent);
  animation: nicepop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes nicepop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .nicecheck { animation: none; } }
/* 1.6.1 motivation: streak, chapter done, cheers + taunts */
.streak { margin-top: 4px; font-size: 14px; color: var(--ink2); }
.streak b { color: var(--ink); }
.streak.lit b { color: var(--warn); }
.streak span { font-size: 13px; color: var(--ink3); }
.streakline { margin: 8px 0 0; font-weight: 700; color: var(--warn); }
.chdone { display: inline-flex; align-items: center; gap: 12px; text-align: left; margin: 0 auto 6px; padding: 12px 18px 12px 12px; border-radius: 16px;
  background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.chdone .chk { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff;
  background: var(--ok); transform: scale(.4); opacity: .3; transition: transform .45s cubic-bezier(.2, 1.6, .4, 1), opacity .3s, box-shadow .6s; }
.chdone.seen .chk { transform: scale(1); opacity: 1; box-shadow: 0 0 0 8px color-mix(in srgb, var(--ok) 15%, transparent); }
.chdone .tiny { margin-top: 2px; }
.cheerline { margin: 6px 0 16px; font-weight: 600; color: var(--ok); }
@media (prefers-reduced-motion: reduce) { .chdone .chk { transform: none; opacity: 1; transition: none; } }
.riline.hit { color: var(--ok); font-weight: 600; }
.tauntbox { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--raise); border: 1px solid var(--line); text-align: left; }
.tauntlist { margin: 0 0 10px; padding-left: 18px; font-size: 15px; }
.tauntlist li { margin: 2px 0; }
.riban.nudge a { align-items: center; }
.riban.nudge.cheer { background: color-mix(in srgb, var(--ok) 12%, var(--card)); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.riban.nudge.taunt { background: color-mix(in srgb, var(--warn) 14%, var(--card)); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.cheerbtn { flex: none; white-space: nowrap; }
.pl h3 { margin: 18px 0 8px; font-size: 15px; color: var(--ink2); }
.pickrow { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px; margin-bottom: 8px; cursor: pointer; }
.pickrow:active { background: var(--raise); }
.pickrow[disabled] { opacity: .6; cursor: default; }
.pickrow.static { cursor: default; }
.why { color: var(--warn); }
.lbl { display: block; font-size: 13px; font-weight: 700; color: var(--ink2); margin: 14px 0 6px; }
.segs { display: flex; gap: 6px; }
/* scoped to .segs (11/26): unscoped, these rules also restyled every older .seg box (reader settings, support status, book source) */
.segs .seg { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 44px; font: inherit; font-size: 14px; font-weight: 600; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0 6px; cursor: pointer; }
.segs .seg[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
select.input { appearance: auto; }
.riline { position: fixed; left: 0; right: 0; bottom: calc(26px + var(--safe-b)); z-index: 30; text-align: center; font-size: 12px; padding: 4px 12px; background: var(--rbg); color: color-mix(in srgb, var(--rink) 78%, var(--rbg)); box-shadow: 0 -6px 8px -4px var(--rbg); }
.riline[hidden] { display: none; }

/* ---- group read-in alerts (round 3a) */
.riban { display: flex; align-items: stretch; margin: 12px 0 0; border-radius: 14px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.riban a { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: flex-start; padding: 12px 4px 12px 14px; color: var(--ink); text-decoration: none; font-size: 15px; line-height: 1.35; }
.riban .x { flex: none; width: 46px; border: 0; background: none; color: var(--ink2); font-size: 24px; line-height: 1; cursor: pointer; }
.swrow { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.swrow input[type=checkbox] { flex: none; width: 46px; height: 28px; accent-color: var(--accent); }

/* ---- 1.6.0: beta (request a book for testers, the owner's Asked-for list, How it works, welcome card) */
.subh { margin: 18px 2px 8px; font: 700 13px var(--sans); color: var(--ink3); text-transform: uppercase; letter-spacing: .05em; }
.welcomecard { margin-top: 14px; background: linear-gradient(160deg, var(--accent-soft), var(--card) 70%); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.card.ask + .card.ask { margin-top: 0; }
.card.ask .res .cover { width: 46px; }
.guide { margin: 0; padding-left: 20px; }
.guide li { margin: 0 0 10px; line-height: 1.5; }
.guide li::marker { color: var(--accent); }
.guidepage .sec h2 { font-size: 19px; }
.swrow .small { display: inline-block; line-height: 1.4; margin-top: 3px; }
