:root {
  /* Potting Bench (Oct 18): Lora for headings and big numbers, Nunito Sans for everything else */
  --font-body: 'Nunito Sans', system-ui, sans-serif; --font-head: 'Lora', Georgia, serif;
  --bg: #F4F0E4; --card: #FFFDF6; --text: #2F3A28; --muted: #636D58; --nav-muted: #6E7464; --eyebrow: #66734F; --icon-ink: #4E5A40;
  --track: #E8E2CE; --accent: #4E6B3A; --accent-strong: #334A24; --on-accent: #FFFDF6;
  --leaf: #4E6B3A; --chart: #9DB386; --chart-today: #4E6B3A; --on-chart: #2F3A28; --gold: #E3B85C; --on-gold: #2F3A28;
  --warm: #9A6A2E; --on-warm: #FFFDF6; --warm-soft: #F2E3C8;
  --border: #E6DFC9; --divider: #EDE6D2; --dash: #C9C2AC; --badge: #9A6A2E; --on-badge: #FFFDF6;
  --audible-fg: #8A5A20; --audible-bg: #F2E3C8; --libby-fg: #1E40AF; --libby-bg: #DBE6F5;
  --chip-on-bg: #E3EBD3; --chip-on-fg: #334A24;
  --danger: #B3261E; --on-danger: #FFFDF6; --neutral: #6B7560; --on-neutral: #FFFDF6;
  --tab-bg: #FFFDF6; --tab-on: #334A24;
  --card-edge: 0 0 0 0 transparent; --card-lift: 0 1px 0 #E0D8C0, 0 10px 26px rgba(80, 90, 50, 0.10);
  --pop-shadow: 0 10px 26px rgba(60, 60, 30, 0.18); --scrim: rgba(47, 58, 40, 0.45);
  --stage-bg: #EAF0DD;
  --lamp-display: none; --sprig-today: #4E6B3A; --sprig-today-fill: #E3B85C; --sprig-today-ink: #2F3A28;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1A15; --card: #18261F; --text: #E8EDE2; --muted: #A3B2A0; --nav-muted: #A3B2A0; --eyebrow: #A3B2A0; --icon-ink: #C9D3C5;
    --track: #2A3B32; --accent: #E9C46A; --accent-strong: #F4D98F; --on-accent: #1B1A10;
    --leaf: #8FC18A; --chart: #4E7A52; --chart-today: #E9C46A; --on-chart: #FFFDF6; --gold: #E9C46A; --on-gold: #1B1A10;
    --warm: #D9A85C; --on-warm: #1B1A10; --warm-soft: #3A3220;
    --border: #2A3B32; --divider: #2A3B32; --dash: #4A5E52; --badge: #D9A85C; --on-badge: #1B1A10;
    --audible-fg: #E9C46A; --audible-bg: #3A3220; --libby-fg: #93C5FD; --libby-bg: #1E2A44;
    --chip-on-bg: #22342A; --chip-on-fg: #8FC18A;
    --danger: #F28B82; --on-danger: #1B1A10; --neutral: #4A5E52; --on-neutral: #E8EDE2;
    --tab-bg: #13201A; --tab-on: #E9C46A;
    --card-edge: inset 0 0 0 1px #2A3B32; --card-lift: 0 1px 0 #0B130F, 0 10px 26px rgba(0, 0, 0, 0.35);
    --pop-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); --scrim: rgba(0, 0, 0, 0.55);
    --stage-bg: radial-gradient(circle at 50% 18%, rgba(233, 196, 106, 0.20), rgba(233, 196, 106, 0) 60%) #13201A;
    --lamp-display: block; --sprig-today: #E9C46A; --sprig-today-fill: #B8963E; --sprig-today-ink: #E9C46A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1A15; --card: #18261F; --text: #E8EDE2; --muted: #A3B2A0; --nav-muted: #A3B2A0; --eyebrow: #A3B2A0; --icon-ink: #C9D3C5;
  --track: #2A3B32; --accent: #E9C46A; --accent-strong: #F4D98F; --on-accent: #1B1A10;
  --leaf: #8FC18A; --chart: #4E7A52; --chart-today: #E9C46A; --on-chart: #FFFDF6; --gold: #E9C46A; --on-gold: #1B1A10;
  --warm: #D9A85C; --on-warm: #1B1A10; --warm-soft: #3A3220;
  --border: #2A3B32; --divider: #2A3B32; --dash: #4A5E52; --badge: #D9A85C; --on-badge: #1B1A10;
  --audible-fg: #E9C46A; --audible-bg: #3A3220; --libby-fg: #93C5FD; --libby-bg: #1E2A44;
  --chip-on-bg: #22342A; --chip-on-fg: #8FC18A;
  --danger: #F28B82; --on-danger: #1B1A10; --neutral: #4A5E52; --on-neutral: #E8EDE2;
  --tab-bg: #13201A; --tab-on: #E9C46A;
  --card-edge: inset 0 0 0 1px #2A3B32; --card-lift: 0 1px 0 #0B130F, 0 10px 26px rgba(0, 0, 0, 0.35);
  --pop-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); --scrim: rgba(0, 0, 0, 0.55);
  --stage-bg: radial-gradient(circle at 50% 18%, rgba(233, 196, 106, 0.20), rgba(233, 196, 106, 0) 60%) #13201A;
  --lamp-display: block; --sprig-today: #E9C46A; --sprig-today-fill: #B8963E; --sprig-today-ink: #E9C46A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font-body); font-size: 15px; line-height: 1.4;
  min-height: 100dvh; display: flex; flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
h1, h2, .num { font-family: var(--font-head); }
h1 { margin: 0; font-size: 32px; font-weight: 700; }
h2 { margin: 0; font-size: 20px; font-weight: 700; }
button { font: inherit; color: inherit; }

main {
  flex: 1; width: 100%; max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 16px 110px;
  display: flex; flex-direction: column; gap: 16px;
}
.header { display: flex; justify-content: space-between; align-items: center; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; background: var(--card); color: var(--icon-ink);
  display: flex; align-items: center; justify-content: center; border: none; text-decoration: none;
}
.icon-btn svg, .back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 800; text-decoration: none; align-self: flex-start; }

.card { background: var(--card); border-radius: 20px; box-shadow: var(--card-edge); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.eyebrow { font-size: 12px; font-weight: 800; color: var(--eyebrow); text-transform: uppercase; letter-spacing: 1.2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

.big { display: flex; align-items: baseline; gap: 8px; }
.big .num { font-size: 40px; font-weight: 700; line-height: 1; }
/* Equal halves, so minutes and pages sit evenly apart */
.today-split { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }
.today-split .num { font-size: 28px; }
.today-split .muted { font-size: 14px; white-space: nowrap; }
.today-split > div { display: flex; align-items: baseline; gap: 6px; }
.bar { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar > div { height: 100%; background: var(--leaf); border-radius: 4px; }
.bar.thin { height: 6px; }
.credit { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--leaf); }
.credit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.credit.pending { color: var(--muted); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.dot { width: 28px; height: 28px; border-radius: 14px; background: var(--track); display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.dot.read { color: var(--on-chart); }
.dot.read { background: var(--chart); }
.dot.future { background: none; border: 1.5px dashed var(--dash); }
.day.today { color: var(--text); font-weight: 800; }
.day.today .dot { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--gold); }
.day.today .dot.read { background: var(--gold); color: var(--on-gold); box-shadow: none; }

.book {
  display: flex; flex-direction: column; background: var(--card); border-radius: 20px; padding: 12px;
  text-decoration: none; color: var(--text); box-shadow: var(--card-lift);
}
/* cover beside the text; the text spreads to the cover's height (title at the top, progress at the bottom) */
.book-main { display: flex; gap: 14px; }
/* both sides of the card are exactly the cover's height, so swiping never changes its size */
.book-main { --card-h: 144px; }
.book-main .cover { width: 96px; height: var(--card-h); border-radius: 8px; }
.book .info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; height: var(--card-h); }
.info-top, .info-mid { display: flex; flex-direction: column; gap: 3px; }
.info-mid .small { font-size: 12px; }
.book .title { font-family: var(--font-head); font-weight: 700; font-size: 17px; }
.cover {
  width: 60px; height: 90px; flex-shrink: 0; border-radius: 6px; overflow: hidden;
  background: var(--track); color: #FFFFFF; font-size: 10px; font-weight: 600; padding: 6px;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.has-img { padding: 0; }
.chip { font-size: 11px; font-weight: 800; border-radius: 8px; padding: 2px 7px; align-self: flex-start; white-space: nowrap; }
.chip.audible { color: var(--audible-fg); background: var(--audible-bg); }
.chip.libby { color: var(--libby-fg); background: var(--libby-bg); }

.strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.strip .cover { width: 72px; height: 108px; }
.strip a { text-decoration: none; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }

.list { background: var(--card); border-radius: 20px; box-shadow: var(--card-edge); padding: 0 14px; }
.list > * { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; min-height: 52px; }
.list > * + * { border-top: 1px solid var(--divider); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--track); border-radius: 14px; padding: 4px; min-width: 150px; }
.seg button { border: none; border-radius: 10px; padding: 8px 10px; background: transparent; color: var(--icon-ink); font-size: 13px; font-weight: 700; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); font-weight: 800; box-shadow: 0 1px 2px rgba(60, 60, 30, 0.12); }
.list input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.list select { font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); }
.list .tz-pick { max-width: 60%; min-width: 0; }
/* Settings menu: a row per page, its status on the right */
.list > .set-row { justify-content: flex-start; color: var(--text); text-decoration: none; }
.set-row > span:first-child { flex-shrink: 0; font-weight: 700; }
.set-status { flex: 1; min-width: 0; text-align: right; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-status.set-flag { color: var(--audible-fg); font-weight: 600; }
.set-row svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.tabs {
  /* above everything that scrolls under it (badges, pins, chart popups); sheets/dialogs still sit on top */
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--tab-bg); border-top: 1px solid var(--border);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 10px);
}
.tabs a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
  text-decoration: none; color: var(--nav-muted); font-size: 11px; font-weight: 600; min-height: 48px;
}
.tabs a[aria-current="page"] { color: var(--tab-on); font-weight: 800; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge {
  position: absolute; top: 0; left: 54%; background: var(--badge); color: var(--on-badge);
  font-size: 10px; font-weight: 800; border-radius: 8px; padding: 1px 5px;
}
.error { background: var(--audible-bg); color: var(--audible-fg); border-radius: 12px; padding: 12px; font-size: 14px; }

/* ---------------------------------------------------------------- Shelf */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 0 14px; min-height: 46px; color: var(--muted); }
.search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.search input { flex: 1; border: none; outline: none; font: inherit; background: transparent; color: var(--text); min-width: 0; }
.pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.pills.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.pill {
  flex-shrink: 0; border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 18px; padding: 8px 14px; font-size: 14px; min-height: 40px; white-space: nowrap;
}
.pill[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); border-color: var(--accent); font-weight: 800; }
.pill .count { color: var(--muted); font-weight: 400; margin-left: 2px; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.filter select { width: 100%; font: inherit; font-size: 14px; padding: 9px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); min-height: 42px; }
.row.center { align-items: center; }
.seg.icons { min-width: 0; }
.seg.icons button { width: 44px; padding: 6px 0; display: flex; align-items: center; justify-content: center; }
.seg.icons svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.seg.icons button[aria-pressed="true"] { color: var(--accent); }
#shelf-count { margin: -6px 0 0; }

.shelf.view-covers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
.tile { display: flex; flex-direction: column; gap: 5px; text-decoration: none; color: var(--text); min-width: 0; }
.cover.tall { width: 100%; height: auto; aspect-ratio: 2 / 3; border-radius: 8px; font-size: 12px; padding: 8px; }
.cover.tall.has-img { padding: 0; }
.tile-title { font-size: 13px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.shelf.view-spines { display: flex; flex-wrap: wrap; align-items: flex-end; row-gap: 22px; }
.spine {
  display: flex; align-items: center; justify-content: center; margin-right: 3px;
  border-radius: 3px 3px 0 0; box-shadow: 0 6px 0 var(--dash); text-decoration: none; overflow: hidden;
}
.spine span {
  writing-mode: vertical-rl; color: inherit; font-size: 11px; font-weight: 600; padding: 8px 0;
  max-height: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.shelf.view-list { background: var(--card); border-radius: 20px; box-shadow: var(--card-edge); padding: 0 12px; }
.list-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; text-decoration: none; color: var(--text); }
.list-row + .list-row { border-top: 1px solid var(--divider); }
.list-row .info { display: flex; flex-direction: column; min-width: 0; }
.list-row .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cover.tiny { width: 40px; height: 60px; border-radius: 4px; font-size: 8px; padding: 3px; }
.cover.tiny.has-img { padding: 0; }

/* ---------------------------------------------------------------- Book page */
.book-head { display: flex; gap: 16px; }
.book-head .info { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding-top: 2px; position: relative; }
.cover.hero { width: 112px; height: 168px; border-radius: 8px; font-size: 13px; padding: 10px; }
.cover.hero.has-img { padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.fable { color: var(--chip-on-fg); background: var(--chip-on-bg); }
.tag { font-size: 13px; border: 1px solid var(--border); border-radius: 14px; padding: 5px 11px; color: var(--text); text-decoration: none; }
a.tag { color: var(--accent); }
.chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; height: 96px; align-items: end; }
.chart .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; font-size: 11px; color: var(--muted); }
.chart .col.today { color: var(--chart-today); font-weight: 800; }
.barv { width: 100%; background: var(--chart); border-radius: 5px; }
.chart .col.today .barv:not(.zero) { background: var(--chart-today); }
.barv.zero { background: var(--track); }
.rating { display: flex; align-items: center; gap: 8px; }
.rating input { width: 80px; font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); }
textarea { width: 100%; font: inherit; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); resize: vertical; }
.primary {
  display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 14px;
  border: none; background: var(--accent); color: var(--on-accent); font-weight: 800; text-decoration: none;
}
.primary.outline { background: var(--card); color: var(--text); border: 1px solid var(--border); }

/* ---------------------------------------------------------------- Inbox */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tile-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px;
  border: 1px solid transparent; border-radius: 16px; background: var(--card); color: var(--text); font-size: 12px; font-weight: 700;
}
.tile-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--leaf); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--chip-on-bg); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
.field input[type="text"], .field input[type="url"], .field input[type="password"], .field input[type="email"], .field select {
  font: inherit; font-weight: 400; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); min-height: 44px;
}
.field input[type="file"] { font: inherit; font-weight: 400; color: var(--muted); }
.field textarea { font-weight: 400; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.mapping { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--divider); padding-top: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap table { border-collapse: collapse; font-size: 12px; }
.table-wrap th, .table-wrap td { padding: 6px 8px; text-align: left; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--divider); }
.job { gap: 4px; }
.job.done { border: 1px solid var(--accent); }
.group { background: var(--card); border-radius: 20px; box-shadow: var(--card-edge); padding: 0 14px; }
.group-head { font-size: 16px; margin-top: 4px; }
.bulk { justify-content: flex-start; gap: 8px; margin-top: -6px; }
.inbox-item { padding: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.inbox-item + .inbox-item { border-top: 1px solid var(--divider); }
.inbox-item .info { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.inbox-item .title, .cand .title { font-weight: 700; }
.inbox-item .row { align-items: center; }
.actions { display: flex; gap: 6px; flex-shrink: 0; }
.mini {
  min-height: 38px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 13px; font-weight: 800; white-space: nowrap;
}
.mini.primary-mini { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.mini:disabled { opacity: 0.5; }
.gen-row { align-items: flex-start; justify-content: flex-start; transition: opacity 0.2s, transform 0.2s; }
.gen-row.gen-out { opacity: 0; transform: translateX(40px); }
.gen-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.gen-body .title { font-weight: 700; }
.gen-body .actions { margin-top: 6px; flex-wrap: wrap; }
.gen-count { margin: -6px 0 10px; }
.gen-pick { font: inherit; font-size: 13px; padding: 0 8px; min-height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); max-width: 130px; }
.cands { display: flex; flex-direction: column; gap: 8px; padding-left: 4px; }
.cand { display: flex; gap: 10px; align-items: center; }
.cand .info { flex: 1; }

/* ---------------------------------------------------------------- Stats */
.seg.wide { width: 100%; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border-radius: 20px; box-shadow: var(--card-edge); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat .num { font-size: 26px; font-weight: 700; }
.vchart { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: 18px; }
.vcol {
  flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  gap: 4px; border: none; background: none; padding: 0; position: relative; color: var(--muted); cursor: pointer;
}
.vbar { width: 100%; max-width: 36px; background: var(--chart); border-radius: 4px 4px 0 0; flex-shrink: 0; }
.vbar.zero { background: var(--track); }
.vbar.future { background: none; border: 1px dashed var(--dash); border-bottom: none; }
.vcol.sel .vbar { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text); }
.vplot { flex: 1; width: 100%; position: relative; display: flex; align-items: flex-end; justify-content: center; }
.vval { position: absolute; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; }
.vlab { font-size: 11px; height: 14px; line-height: 14px; white-space: nowrap; }
.vcol.now .vlab { color: var(--chart-today); font-weight: 800; }
.vcol.now .vbar:not(.zero):not(.future) { background: var(--chart-today); }
details summary { color: var(--muted); cursor: pointer; min-height: 32px; display: flex; align-items: center; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
table.data td { padding: 4px 0; border-bottom: 1px solid var(--divider); }
table.data td + td { text-align: right; font-variant-numeric: tabular-nums; }
.hrow { display: grid; grid-template-columns: minmax(0, 9em) 1fr 2.5em; align-items: center; gap: 10px; font-size: 13px; }
.hlab { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.htrack { height: 10px; background: var(--track); border-radius: 5px; overflow: hidden; }
.htrack span { display: block; height: 100%; background: var(--chart); border-radius: 5px; }
.hval { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.calnav { display: flex; align-items: center; gap: 8px; }
.calnav .mini { min-width: 38px; font-size: 18px; padding: 0; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cdow { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 2px; }
.cday { position: relative; aspect-ratio: 2 / 3; border-radius: 4px; background: var(--track); display: flex; }
.cin { flex: 1; display: flex; min-width: 0; border-radius: 4px; overflow: hidden; }
.cday.blank { background: none; }
.cnum { position: absolute; top: 2px; left: 4px; font-size: 10px; color: var(--muted); z-index: 2; }
.cday.has .cnum { color: #FFFFFF; text-shadow: 0 0 3px rgba(0,0,0,0.9); }
.ccover { flex: 1; display: block; min-width: 0; }
.ccover img, .ccover span { width: 100%; height: 100%; object-fit: cover; display: block; }
.ccover.started, .ccover.read { opacity: 0.45; }  /* faded until the day it was finished */
.cmore { position: absolute; bottom: 2px; right: 3px; font-size: 10px; font-weight: 700; color: #FFFFFF; text-shadow: 0 0 3px rgba(0,0,0,0.9); }

.ellipsis { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- Shelf, decluttered */
.header-actions { display: flex; gap: 8px; }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.search input { min-height: 44px; }
.pills-wrap { position: relative; }
.summary-row { margin-top: -4px; }
.summary { border: none; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 8px 0; min-height: 40px; text-align: left; }
.filters-btn { display: inline-flex; align-items: center; gap: 6px; }
.filters-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.fbadge { background: var(--accent); color: var(--on-accent); border-radius: 9px; padding: 0 6px; font-size: 11px; line-height: 18px; }
.chip-x { border: 1px solid var(--accent); background: var(--chip-on-bg); color: var(--chip-on-fg); border-radius: 16px;
  padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; min-height: 34px; }
dialog.sheet {
  margin: auto auto 0; width: 100%; max-width: 560px; max-height: 85dvh; border: none; padding: 0;
  border-radius: 22px 22px 0 0; background: var(--card); color: var(--text);
}
dialog.sheet::backdrop { background: var(--scrim); }
.sheet-body { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px); }
.sheet-body .pill { background: var(--bg); }
.sheet-body .pill[aria-pressed="true"] { background: var(--chip-on-bg); }
.sheet-body select { font: inherit; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); min-height: 44px; }
/* Change cover: other editions' covers, 3 to a row; audiobook covers are square, shown whole */
.cover-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
.cover-choice { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 0; border: none;
  background: none; color: var(--muted); font: inherit; font-size: 12px; text-align: center; cursor: pointer; }
.cover-choice img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; background: var(--track);
  outline: 3px solid transparent; outline-offset: 1px; }
.cover-choice.square img { object-fit: contain; }
.cover-choice[aria-pressed="true"] img { outline-color: var(--accent); }
.cover-check { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--bg); font-weight: 700; line-height: 24px; }
.cover-note { min-height: 1.2em; }

/* ---------------------------------------------------------------- pin, select, series, edit */
.row-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.summary-row .summary { min-width: 0; line-height: 1.25; }
/* Phone width: the view switch needs the room, so Filters shows just its icon (and count) */
@media (max-width: 440px) {
  .filters-label { display: none; }
  .filters-btn { padding: 0 10px; }
  .summary-row .summary { font-size: 13px; }
}
/* Covers / Spines / List switch on the Shelf screen */
.view-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; background: var(--card); overflow: hidden; }
.view-seg button { width: 34px; min-height: 38px; border: none; background: none; color: var(--muted); padding: 0;
  display: inline-flex; align-items: center; justify-content: center; }
.view-seg button + button { border-left: 1px solid var(--border); }
.view-seg button[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); }
.view-seg svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile, .list-row, .spine { position: relative; }
.pin-badge { position: absolute; z-index: 2; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 12px;
  background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.pin-badge svg, .pin-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.pin-btn { display: inline-flex; align-items: center; gap: 6px; }
.pin-btn[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); border-color: var(--accent); }
.shelf.selecting [data-pick]::after, #series-list.selecting .sbook[data-pick] .sart::after {
  content: ""; position: absolute; z-index: 3; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 11px;
  border: 2px solid #FFFFFF; background: rgba(0, 0, 0, 0.35); box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
}
.shelf.selecting [data-pick][aria-selected="true"]::after, #series-list.selecting .sbook[aria-selected="true"] .sart::after {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.shelf.selecting [data-pick][aria-selected="true"] .cover { outline: 3px solid var(--accent); outline-offset: 2px; }
#series-list.selecting .sbook[aria-selected="true"] .sart { outline: 3px solid var(--accent); outline-offset: -3px; }
#series-list.selecting .sbook.ghost { pointer-events: none; }
.action-bar {
  position: fixed; left: 8px; right: 8px; bottom: calc(env(safe-area-inset-bottom) + 76px); z-index: 10;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 12px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--pop-shadow);
  max-width: 544px; margin: 0 auto;
}
.action-bar .small { margin-right: auto; }
/* Removed from a list: Undo stays in view wherever you've scrolled */
.undo-toast { position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 30; margin: 0; box-shadow: var(--pop-shadow); }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .pill { text-align: left; min-height: 48px; }
.series-link { color: var(--accent); text-decoration: none; font-weight: 700; }
.series-item { display: flex; flex-direction: column; gap: 4px; text-decoration: none; width: 72px; }
.two-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.two-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field input[inputmode] { font: inherit; font-weight: 400; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); min-height: 44px; }
.action-bar { flex-wrap: nowrap; gap: 4px; padding: 8px 10px; }
.action-bar .mini { padding: 0 10px; }
.action-bar .sel-done { padding: 0; width: 38px; font-size: 15px; }
/* Press-and-hold picks a book (Shelf) or opens the quick sheet (covers elsewhere): stop the phone's own link menu / text selection */
.shelf [data-pick], .pick, .find-row, .sbook, .strip a, .book-main .cover {
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.sbook img, .pick img, .strip img, .find-row img { -webkit-user-drag: none; }

/* ---------------------------------------------------------------- series view */
.series-row { display: flex; flex-direction: column; gap: 8px; border-radius: 16px; transition: background 1s; }
.series-row.flash { background: var(--chip-on-bg); }
.series-row h2 { font-size: 17px; }
.series-meta { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.star-btn { width: 38px; height: 38px; margin: -6px -8px -6px 0; border: none; background: none; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; border-radius: 19px; }
.star-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.star-btn[aria-pressed="true"] { color: var(--gold); }
.series-note { margin: -6px 0 0; }
.series-note .coming { color: var(--accent); font-weight: 600; }
.sbook.ghost.upcoming .sart { opacity: 1; filter: none; }  /* keep the Soon tag bright; fade just the art */
.sbook.ghost.upcoming .sart > :not(.soon-tag) { opacity: 0.45; filter: grayscale(0.8); }
.soon-tag { position: absolute; top: 6px; left: 6px; padding: 2px 7px; border-radius: 9px; font-size: 11px; font-weight: 700;
  background: var(--accent); color: var(--on-accent); }
[data-series-menu] { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.star-btn[aria-pressed="true"] svg { fill: currentColor; }
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scroll-snap-type: x proximity; scrollbar-width: none; }
.card .hscroll { margin: 0 -16px; }
.sbook { flex: 0 0 96px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text);
  scroll-snap-align: start; border: none; background: none; padding: 0; text-align: left; font: inherit; }
.sart { position: relative; display: block; width: 96px; height: 144px; border-radius: 8px; overflow: hidden; background: var(--track); }
.sart img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noart { display: block; padding: 8px; font-size: 11px; font-weight: 600; color: var(--muted); }
.stitle { font-size: 12px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sbook.ghost .sart { opacity: 0.35; filter: grayscale(0.8); outline: 1.5px dashed var(--dash); outline-offset: -1.5px; }
.sbook.ghost .stitle { color: var(--muted); font-weight: 500; }
.sbook.current .sart { outline: 3px solid var(--accent); outline-offset: 2px; }
.smark { position: absolute; bottom: 4px; right: 4px; min-width: 22px; height: 22px; border-radius: 11px; display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #FFFFFF; background: rgba(0,0,0,0.6); }
.smark.finished { background: var(--accent); color: var(--on-accent); }
.smark.reading { background: var(--warm); color: var(--on-warm); }
.summary-row .filter select { min-height: 40px; }
.summary-row .filter { flex: 1 1 0; min-width: 0; }
#novellas-btn[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); border-color: var(--accent); }
#novellas-btn[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); border-color: var(--accent); }

/* the four shelf pills (Want to Read, Reading, Finished, DNF) fit a 375px phone */
.pills-wrap .pills { gap: 6px; }
.pills-wrap .pill { padding: 8px 9px; font-size: 13.5px; }

/* ---------------------------------------------------------------- libraries */
.lib-block { display: flex; flex-direction: column; gap: 6px; }
.lib-block + .lib-block { border-top: 1px solid var(--divider); padding-top: 10px; }
.lib-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 40px;
  text-decoration: none; color: var(--text); padding: 4px 0; }
.lib-fmt { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.lib-fmt svg, .lib-badge svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lib-now { color: var(--leaf); font-weight: 700; }
.lib-line .small { text-align: right; }
/* Top-right corner of the cover (the pin badge has top-left). Positioned from
   the tile's top, so it stays on the cover whatever the title length. */
.lib-badge { position: absolute; z-index: 2; top: 6px; right: 6px; display: flex; gap: 2px; padding: 3px 5px;
  border-radius: 10px; background: rgba(0, 0, 0, 0.65); color: #FFFFFF; }
.shelf.selecting .lib-badge { display: none; }  /* Select mode's checkmark uses that corner */
/* List view: hug the 40px cover's top-right corner, whatever the badge width */
.list-row .lib-badge { top: 12px; left: auto; right: calc(100% - 40px); padding: 2px; gap: 1px; }
.list-row .lib-badge svg { width: 12px; height: 12px; }
.spine .lib-badge { display: none; }
/* A fixed height, so the search bar stays put while results come and go; only the list scrolls. */
#lib-picker { height: min(620px, 85dvh); }
#lib-picker .sheet-body { height: 100%; box-sizing: border-box; }
.lib-results { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.lib-result { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; min-height: 52px; }
.lib-result + .lib-result { border-top: 1px solid var(--divider); }
.lib-added { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.lib-added svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#lib-picker .search { background: var(--bg); }

/* signing in */
body.signed-out .tabs { display: none; }
/* Sign-in, join and reset screens: centred on the screen, both ways */
.auth { display: flex; flex-direction: column; justify-content: center; gap: 16px; max-width: 420px; width: 100%;
  min-height: 100vh; min-height: 100dvh; margin: 0 auto; padding-block: 24px; box-sizing: border-box; text-align: center; }
.auth p { margin: 0; }
.auth form, .auth .field { text-align: left; }
/* Clerk's form inside our card: don't clip it (cards clip sideways overflow), and keep it inside the card's width */
.card:has(#clerk-mount) { overflow: visible; }
#clerk-mount { width: 100%; min-width: 0; text-align: left; }
.list > .stack-form, .stack-form { flex-direction: column; align-items: stretch; gap: 10px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg, var(--card)); color: var(--text); }
.list > [hidden] { display: none; }

/* getting started (Now, for new users) */
.welcome h2 { margin: 0; }
.install-tip { display: flex; flex-direction: column; gap: 8px; }
.install-tip h2 { margin: 0; font-size: 17px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.steps li + li { border-top: 1px solid var(--divider); }
.steps .what { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.steps .tick { width: 26px; height: 26px; border-radius: 13px; flex-shrink: 0; border: 1.5px dashed var(--dash);
  display: flex; align-items: center; justify-content: center; }
.steps .done .tick { border: none; background: var(--leaf); color: var(--card); }
.steps .tick svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.steps .done strong { color: var(--muted); font-weight: 600; }
.steps a.mini { text-decoration: none; display: inline-flex; align-items: center; }

/* Now: book cards with a "Listened today" button (the title link covers the card) */
.book { position: relative; }
.book a.stretch { color: inherit; text-decoration: none; }
.book a.stretch::after { content: ""; position: absolute; inset: 0; border-radius: 20px; }
.book .listened { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.book .listened svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.book .listened[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); border-color: transparent; }

/* ---------------------------------------------------------------- book page layout */
.book-top { display: flex; justify-content: space-between; align-items: center; }
#book-menu-btn { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.format-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--divider); }
.format-line select { font: inherit; font-size: 14px; padding: 8px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); min-height: 40px; }
#fable-note:empty { display: none; }
#libs-card > .primary.outline { margin-top: 4px; }

/* ---------------------------------------------------------------- star rating + note */
.stars { display: flex; gap: 8px; align-self: flex-start; touch-action: none; cursor: pointer; padding: 4px 0; }
.star { position: relative; width: 36px; height: 34px; color: var(--border); }
.star svg { width: 36px; height: 34px; fill: currentColor; display: block; }
.star-fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--gold); }
.stars:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
#note-box { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#note-box label, #note-box textarea { width: 100%; }
.note-text { margin: 0; white-space: pre-wrap; }
.note-add { color: var(--accent); }

/* Explore */
.explore-row { display: flex; flex-direction: column; gap: 8px; }
.explore-row h2 { font-size: 17px; margin: 0; }
.picks { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.pick { flex: 0 0 116px; display: flex; flex-direction: column; gap: 4px; text-align: left; background: none; border: none; padding: 0;
  color: var(--text); cursor: pointer; min-width: 0; }
.pick .reason, .sheet-body .reason { color: var(--accent); font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.pick .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick .chip { margin-top: 2px; }
/* Find any book (Explore) */
.explore-picks { display: flex; flex-direction: column; gap: 16px; }
.explore-picks[hidden], .search .mini[hidden] { display: none; }
.card.find-list { padding: 4px 12px; gap: 0; }
.find-row { width: 100%; background: none; border: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.find-row:disabled { opacity: .5; }
.find-row .chip.on-shelf { margin-top: 3px; color: var(--accent); background: var(--track); }
.find-bundles { border-top: 1px solid var(--divider); padding: 10px 0; }
.find-bundles summary { cursor: pointer; color: var(--muted); }
.find-all { align-self: center; }
.find-live { align-self: center; margin: 10px 0 6px; }
.by-link { color: var(--muted); text-decoration: none; }
.by-link::after { content: " ›"; }
.ap-head { display: flex; gap: 16px; align-items: center; }
.ap-head .info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ap-head h1 { font-size: 24px; line-height: 1.15; margin: 0; }
.ap-photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex: none; background: var(--track); }
.ap-initials { display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: var(--muted); }
.ap-mine { color: var(--accent); font-weight: 600; }
.ap-bar { display: flex; flex-direction: column; gap: 10px; }
.ap-bar .seg { width: 100%; }
.ap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
.ap-tile { background: none; border: none; padding: 0; font: inherit; text-align: left; cursor: pointer; }
.ap-art { position: relative; display: block; }
.ap-books { display: flex; flex-direction: column; gap: 20px; }
.find-authors { margin-bottom: 12px; }
.explore-authors .list-chip { flex-shrink: 0; white-space: nowrap; }
.author-hit .ap-photo { width: 44px; height: 44px; font-size: 16px; }
.author-hit .info { flex: 1; }
.author-links { margin: -4px 0 4px; }
.ap-source { text-align: center; margin: 4px 0 0; }
/* Series pages: the whole series as a grid of the series view's covers */
.sp-head { display: flex; flex-direction: column; gap: 4px; }
.sp-head h1 { font-size: 24px; line-height: 1.15; margin: 0; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, 96px); justify-content: space-between; gap: 16px 10px; }
a.eyebrow { text-decoration: none; }
.hc-card .mini { align-self: flex-start; }
/* Two date boxes side by side, the same width, labels above */
.add-dates, .read-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.add-dates[hidden], .add-rating[hidden], .add-format[hidden], .add-dates .field[hidden] { display: none; }
.add-dates .field, .read-dates .field { min-width: 0; font-size: 13px; color: var(--muted); gap: 4px; }
.field input[type="date"] { font: inherit; font-weight: 400; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); min-height: 42px; width: 100%; min-width: 0; box-sizing: border-box; -webkit-appearance: none; appearance: none; }
.add-format { display: flex; flex-direction: column; gap: 6px; }
/* Add card: the format (Audiobook | Ebook | Book, any mix), icons beside the words */
.fmt-seg button { display: inline-flex; align-items: center; justify-content: center; }
.fmt-seg button[aria-pressed="true"] .rf-ic { color: var(--accent); }
.add-format select { font: inherit; font-size: 14px; padding: 8px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); min-height: 42px; align-self: flex-start; }
.add-rating { display: flex; flex-direction: column; gap: 4px; }
#hc-picker { height: min(680px, 88dvh); }
#hc-picker .sheet-body { height: 100%; box-sizing: border-box; }
#hc-picker .search { background: var(--bg); }
.hc-results { overflow-y: auto; flex: 1; min-height: 0; }
.sheet-body .about { margin: 0; color: var(--muted); max-height: 9.5em; overflow-y: auto; white-space: pre-line; }
.sheet-body .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet-body .chips .chip { background: var(--track); color: var(--text); }

/* Book page: About */
.about-card .about-text { margin: 0; white-space: pre-line; line-height: 1.5; }
.about-card .about-text.clamped { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.about-card .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.about-card .chips .chip { background: var(--track); color: var(--text); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 14px; line-height: 1.3; }
.about-card .mini { align-self: flex-start; }
.about-card button.chip { border: none; font-family: inherit; cursor: pointer; }
.about-card .chips .chip.genre-main { background: var(--chip-on-bg); color: var(--chip-on-fg); }
.about-card .chip.genre-add { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--border); }
#genre-menu .menu-list { display: grid; grid-template-columns: 1fr 1fr; }
.card > .reason { color: var(--accent); font-weight: 600; }

/* Book page v3 (from the mockup): status + library pills in the header */
.avg-line { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.avg-line svg { width: 14px; height: 13px; fill: currentColor; }
.avg-line strong { color: var(--text); font-weight: 600; }
.head-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.head-chips .chip { align-self: center; }
.lib-pill {
  display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 12px; border-radius: 16px;
  font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.lib-pill { border: 1px solid var(--border); background: var(--bg); color: var(--nav-muted); letter-spacing: 0.3px; }
.lib-pill.held { background: var(--card); color: var(--text); }
.lib-pill[aria-expanded="true"] { border-color: var(--accent); }
.lib-ic { display: inline-flex; color: var(--dash); }
.lib-ic.on { color: var(--leaf); }
.lib-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lib-panel { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 8px 10px;
  position: absolute; z-index: 20; width: min(300px, calc(100vw - 32px)); box-shadow: var(--pop-shadow); }
.lib-panel[hidden] { display: none; }
.lib-panel .lib-name { font-weight: 700; color: var(--muted); }
.lib-panel .lib-line { min-height: 36px; }
.lib-panel .lib-fmt { font-size: 13px; }
.lib-panel .lib-line .small { font-size: 12px; }
.lib-open { font-weight: 600; text-decoration: none; padding-top: 4px; }
.progress-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--divider); }
.progress-foot .format-line { border-top: none; padding-top: 0; justify-content: flex-end; }
.list-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 14px; font-size: 13px; font-weight: 700; text-decoration: none; color: var(--accent); }
.add-list { min-height: 36px; padding: 8px 12px; border: 1px dashed var(--dash); border-radius: 14px; background: none;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }

/* Lists */
.accent-mini { color: var(--accent); }
.list-card { display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--card); border-radius: 20px; box-shadow: var(--card-edge); text-decoration: none; color: var(--text); }
.list-card .info { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.list-card .list-name { font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.list-card > svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.list-card .chip { align-self: flex-start; }
.mosaic { width: 84px; height: 84px; flex-shrink: 0; border-radius: 10px; overflow: hidden; display: grid; gap: 2px; background: var(--track);
  grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.mosaic .cover { width: 100%; height: 100%; border-radius: 0; font-size: 7px; padding: 2px; overflow: hidden; }
.mosaic .cover.has-img { padding: 0; }
.list-head { display: flex; flex-direction: column; gap: 6px; }
.chips.center { align-items: center; }
.list-actions { flex-wrap: wrap; }
.list-sort { margin-left: auto; }
.list-sort select { min-height: 38px; padding: 6px 8px; font-size: 13px; }
.tile-wrap { position: relative; display: flex; flex-direction: column; min-width: 0; }
.remove-x { position: absolute; z-index: 3; top: -6px; right: -6px; width: 30px; height: 30px; border-radius: 15px; border: 2px solid var(--bg);
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 700; cursor: pointer; }
.sheet-body .search { background: var(--bg); }
.add-results { display: flex; flex-direction: column; gap: 8px; max-height: 50dvh; overflow-y: auto; }
.add-results .cand .info { display: flex; flex-direction: column; min-width: 0; }
.add-results .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-list-row { display: flex; gap: 8px; align-items: center; }
.new-list-row .search { flex: 1; }
.mini.danger { color: var(--danger); }
.primary.danger-primary { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.card[hidden] { display: none; }

/* Minutes <-> pages read (Now's Today number, Stats' listened tile) */
.unit-toggle { border: none; font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
button.big.unit-toggle { background: none; padding: 0; }
.unit-hint { margin-left: auto; align-self: center; font-size: 14px; color: var(--muted); }
.stat .unit-hint { margin-left: 6px; font-family: var(--font-body); font-weight: 400; vertical-align: middle; }

/* Stats: the i on the listening chart, and bulk-import choices */
.info-btn { position: relative; width: 28px; height: 28px; flex-shrink: 0; border-radius: 14px; border: 1px solid var(--border); background: var(--bg);
  color: var(--muted); font: italic 700 14px/1 Georgia, serif; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.info-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.info-btn.flag::after { content: ""; position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border-radius: 5px;
  background: var(--badge); border: 2px solid var(--card); }
.info-box { position: absolute; left: 12px; right: 12px; z-index: 20; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--bg);
  border: 1px solid var(--border); box-shadow: var(--pop-shadow); }
.info-box[hidden] { display: none; }
.bulk-choice { display: flex; flex-direction: column; gap: 8px; }
.info-box .bulk-choice { padding-top: 8px; border-top: 1px solid var(--divider); }
.bulk-choice .row-actions { flex-wrap: wrap; }

/* ---------------------------------------------------------------- Stats v2 (cards you arrange) */
.edit-stats { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.edit-stats svg, .icon-btn.small-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.small-icon { width: 36px; height: 36px; border: 1px solid var(--border); background: var(--bg); flex-shrink: 0; }
.icon-btn.small-icon:disabled { opacity: 0.35; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.year-pill { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.card { position: relative; }
.shead { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.shead-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sbig { font-family: var(--font-head); font-size: 28px; font-weight: 700; line-height: 1.1; }
.sbig-of { font-size: 17px; color: var(--muted); font-weight: 600; }
.head-tools { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.seg.small-seg { min-width: 0; display: inline-grid; padding: 3px; background: var(--bg); }
.seg.small-seg button { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.seg.small-seg button[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); }
.persona { background: linear-gradient(160deg, var(--chip-on-bg) 0%, var(--card) 72%); }
.persona .eyebrow { color: var(--chip-on-fg); }
.persona-title { font-family: var(--font-head); font-size: 23px; font-weight: 700; line-height: 1.15; }
.persona p { margin: 0; line-height: 1.5; }
.goal-bar { position: relative; height: 10px; border-radius: 5px; background: var(--track); }
.goal-bar > div { height: 100%; border-radius: 5px; background: var(--leaf); }
.goal-pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--warm); }
.goal-tip { background: var(--bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; line-height: 1.45; }
.strong-accent { color: var(--accent); font-weight: 600; }
.sbars { position: relative; display: grid; gap: 4px; height: 140px; align-items: end; padding-top: 16px; box-sizing: border-box; }  /* the top 16px is for the numbers over the bars */
.sbar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; border: none; background: none; padding: 0; cursor: pointer; min-width: 0; color: var(--text); font: inherit; }
.sbar-n { font-size: 11px; font-weight: 700; }
.sbar-b { display: block; width: 100%; max-width: 40px; border-radius: 5px 5px 2px 2px; background: var(--chart); }
.sbar.now .sbar-b:not(.zero):not(.future):not(.split) { background: var(--chart-today); }
.sbar-b.zero { background: var(--track); }
.sbar-b.future { background: none; border: 1px dashed var(--dash); }
.sbar.picked .sbar-b, .legend-row.picked .swatch, .author-row.picked .author-bar { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text); }
.sbar.now .sbar-n { color: var(--chart-today); }
.mean-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--text); opacity: 0.6; pointer-events: none; }
.sbars-labels, .sbars-covers { display: grid; gap: 4px; }
.sbars-labels span { font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; }
.sbars-covers img, .sbars-covers span, .sbars-covers a { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 3px; }
.sbars-covers > span:empty { visibility: hidden; }
.sbars-covers a img { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; display: inline-block; }
.dash-swatch { width: 14px; border-top: 2px dashed var(--text); display: inline-block; }
.dash-swatch.muted-dash { border-color: var(--muted); }
.centered { text-align: center; align-self: center; }
.avg-boxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.avg-box { background: var(--bg); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.radar { width: 260px; max-width: 100%; height: auto; align-self: center; }
.radar text { fill: var(--muted); font-size: 11px; }
.r-ring { fill: none; stroke: var(--track); stroke-width: 1; }
.r-area { fill: color-mix(in srgb, var(--leaf) 25%, transparent); stroke: var(--leaf); stroke-width: 2; }
.r-dot { fill: var(--leaf); }
.donut-row { display: flex; gap: 16px; align-items: center; }
.donut { width: 132px; height: 132px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.donut-hole { width: 84px; height: 84px; border-radius: 50%; background: var(--card); display: flex; align-items: center; justify-content: center; }
.donut-legend { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; border: none; background: none; padding: 4px 0; min-height: 34px; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.legend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sline { width: 100%; height: 150px; display: block; }
.l-main { fill: none; stroke: var(--leaf); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.l-dash { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.l-dot { fill: var(--leaf); }
.stream-wrap { position: relative; height: 170px; }
.stream { width: 100%; height: 170px; display: block; }
.stream .band { stroke: var(--card); stroke-width: 0.8; }
.stream-hits { position: absolute; inset: 0; display: grid; }
.stream-hit { border: none; background: none; padding: 0; cursor: pointer; }
.stream-hit.picked { background: color-mix(in srgb, var(--text) 8%, transparent); }
.author-rows { display: flex; flex-direction: column; gap: 6px; }
.author-row { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 10px; align-items: center; border: none; background: none; padding: 0; min-height: 40px; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.author-name { font-size: 13px; line-height: 1.2; }
.author-bar { height: 26px; border-radius: 6px; background: var(--chip-on-bg); color: var(--chip-on-fg); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; box-sizing: border-box; }
.ddays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.ddow { font-size: 11px; color: var(--muted); text-align: center; }
.dday { aspect-ratio: 1; border-radius: 6px; background: var(--track); color: var(--muted); font-size: 11px; display: flex; align-items: center; justify-content: center; }
.dday.on { background: var(--chart); color: var(--on-chart); font-weight: 800; }
.dday.today { outline: 2px solid var(--gold); outline-offset: -2px; }
.book-pop { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 10; background: #0F1A15; color: #E8EDE2; border: 1px solid #2A3B32;
  border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
.pop-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pop-title { font-family: var(--font-head); font-size: 21px; font-weight: 700; }
.pop-sub { color: #A3B2A0; }
.pop-close { width: 40px; height: 40px; flex-shrink: 0; border-radius: 20px; border: none; background: #22342A; color: #E8EDE2; font-size: 17px; cursor: pointer; }
.pop-books { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.pop-book { flex: 0 0 88px; display: flex; flex-direction: column; gap: 5px; text-decoration: none; color: #E8EDE2; font-size: 12px; font-weight: 700; line-height: 1.25; }
.pop-more { align-self: flex-start; color: #E9C46A; font-size: 14px; font-weight: 800; text-decoration: none; padding: 4px 0; }
.cover.pop-cover { width: 88px; height: 132px; border-radius: 8px; font-size: 10px; padding: 6px; }
.cover.pop-cover.has-img { padding: 0; }
.add-chart { min-height: 52px; border-radius: 14px; border: 1.5px dashed var(--dash); color: var(--accent); font-weight: 800; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.edit-list { display: flex; flex-direction: column; gap: 8px; }
.edit-row { display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: 16px; box-shadow: var(--card-edge); padding: 8px 8px 8px 14px; min-height: 56px; }
.edit-row.off .edit-name { color: var(--muted); }
.edit-name { flex: 1; font-weight: 700; min-width: 0; }
.edit-row .eye[aria-pressed="false"] { color: var(--accent); }
.builder-group { display: flex; flex-direction: column; gap: 8px; }
.goal-set { align-items: center; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper .step { width: 52px; height: 52px; border-radius: 26px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 24px; cursor: pointer; }
.stepper input { width: 120px; text-align: center; font: 700 44px var(--font-head); border: none; background: none; color: var(--text); -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.toggle-row { flex-direction: row; justify-content: space-between; align-items: center; cursor: pointer; }
.toggle-row input { width: 22px; height: 22px; accent-color: var(--accent); flex-shrink: 0; }
.author-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.author-row .author-bar { white-space: nowrap; }
.seg.small-seg button { white-space: nowrap; }
.seg.small-seg { grid-auto-columns: auto; flex-shrink: 0; }
.sbars-labels span { overflow: visible; }
.drag-handle { width: 40px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: none; background: none; color: var(--muted); cursor: grab; touch-action: none; border-radius: 10px; margin-left: -8px; }
.drag-handle svg { width: 20px; height: 20px; fill: currentColor; }
.drag-handle.off { opacity: 0.3; cursor: default; }
.drag-handle:focus-visible { outline: 2px solid var(--accent); }
.edit-row { padding-left: 8px; }
.edit-row.dragging { position: relative; z-index: 5; box-shadow: var(--pop-shadow); outline: 2px solid var(--accent); }
.edit-row.dragging .drag-handle { cursor: grabbing; color: var(--accent); }
a.mini { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
/* Inbox: a small cover beside each book */
.inbox-head { display: flex; gap: 10px; align-items: center; min-width: 0; }
.cover.tiny.loading { background: var(--track); animation: cover-pulse 1.2s ease-in-out infinite; }
@keyframes cover-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .cover.tiny.loading { animation: none; } }
#job-bar { margin-top: 6px; }
.line-wrap, .line-wrap .sline { height: 150px; }

/* ---------------------------------------------------------------- Goodreads (Inbox box) */
.gr-panel, .gr-map { display: flex; flex-direction: column; gap: 12px; }
.gr-badge { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; background: #E9E5CD; color: #382110; display: flex; align-items: center; justify-content: center;
  font: 700 22px/1 Georgia, 'Times New Roman', serif; }
.gr-connected { display: flex; align-items: center; gap: 12px; line-height: 1.35; }
.gr-file { border-top: 1px solid var(--divider); padding-top: 10px; }
.gr-file[open] { display: flex; flex-direction: column; gap: 12px; }
.gr-file summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; color: var(--accent); }
.gr-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; line-height: 1.45; font-size: 14px; }
.gr-step { display: flex; gap: 10px; align-items: flex-start; }
.gr-n { width: 24px; height: 24px; flex-shrink: 0; border-radius: 12px; background: var(--chip-on-bg); color: var(--chip-on-fg); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.gr-shelf { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--divider); }
.gr-shelf-name { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; line-height: 1.3; }
.gr-shelf select { flex: 0 1 48%; min-width: 0; font: inherit; font-size: 14px; padding: 8px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); min-height: 40px; }
@media (max-width: 420px) { .tile-btn { font-size: 11px; } }
.gr-panel .row-actions { flex-wrap: wrap; }

/* ---------------------------------------------------------------- staging copy */
#staging-bar { position: sticky; top: 0; z-index: 60; background: #B45309; color: #fff; text-align: center;
  font-size: 12px; font-weight: 600; padding: calc(4px + env(safe-area-inset-top, 0px)) 12px 4px; }
.cands .none-of-these { align-self: flex-start; }
.cands[hidden], .inbox-item .actions[hidden] { display: none; }
.inbox-pane { display: flex; flex-direction: column; gap: 16px; }

/* Inbox item, swiped like Mail: right uncovers Add to list (a long swipe stretches Want to Read), left Not interested.
   The lane bleeds to the group's edges so the colour fills the row. */
.group:has(.ix-lane) { overflow: hidden; }
.ix-lane { position: relative; overflow: hidden; margin: -12px -14px 0; }
.ix-lane:last-child { margin-bottom: -12px; }
.ix-main { position: relative; z-index: 1; padding: 12px 14px; background: var(--card); transition: transform .2s ease-out;
  touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.ix-main img, .ix-main a { -webkit-user-drag: none; }
.inbox-item.ix-dragging .ix-main { transition: none; }
.ix-under { position: absolute; top: 0; bottom: 0; width: 0; display: flex; padding: 8px; box-sizing: border-box; overflow: hidden; }
.inbox-item:not(.ix-dragging) .ix-under { transition: width .2s ease-out; }
.ix-yes { left: 0; }
.ix-no { right: 0; }
.ix-under button { flex: 1 1 0; min-width: 0; border: 0; border-radius: 14px; padding: 0 6px; font-size: 13px; font-weight: 800;
  white-space: nowrap; overflow: hidden; transition: flex-grow .15s ease-out, opacity .15s ease-out; }
.ix-under .ix-want { background: var(--leaf); color: var(--card); flex-grow: 0; padding: 0; opacity: 0; }
.ix-list { background: var(--neutral); color: var(--on-neutral); }
.ix-skip { background: var(--danger); color: var(--on-danger); }
.inbox-item.ix-full .ix-under .ix-want { flex-grow: 1; padding: 0 6px; opacity: 1; }
.inbox-item.ix-full .ix-under .ix-list { flex-grow: 0; padding: 0; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .ix-main, .ix-under, .ix-under button { transition: none !important; } }
/* Book page status list: Remove from shelf, set apart at the bottom */
#bm-remove { color: var(--danger); }  /* the ⋯ menu's Remove from shelf */
/* "Already on your shelf" after an import: a row of covers you swipe through */
.known-row { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.known-book { flex: 0 0 76px; display: flex; flex-direction: column; gap: 3px; text-decoration: none; color: var(--text); scroll-snap-align: start; min-width: 0; }
.known-book .cover { width: 76px; height: 114px; border-radius: 6px; font-size: 10px; }
.known-book .small { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
/* The import result card's dismiss button */
.has-close { position: relative; }
.card-close { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 16px; border: 0;
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.card-close:hover { background: var(--chip-bg, rgba(127,127,127,.15)); }
.has-close > strong { padding-right: 32px; }

/* Privacy page */
.card.privacy { gap: 10px; }
.card.privacy p { margin: 0; line-height: 1.45; }

/* Daily check-in on Now: the card's swipe side */
.book-main { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.book-main img, .book-main a { -webkit-user-drag: none; }  /* a drag must be a swipe, not a link or picture drag */
.book .info, .checkin-face { transition: transform .12s ease-out; }
.book-actions { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.book-actions .mini { min-height: 36px; padding: 0 10px; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.link-btn { min-height: 36px; padding: 0 2px; border: 0; background: none; color: var(--leaf); font-size: 13px; font-weight: 800; white-space: nowrap; }
.book-actions button { position: relative; z-index: 1; }  /* above the card's stretched title link */
.book.checking-in { box-shadow: 0 0 0 1px var(--accent); }
.checkin-face { flex: 1; min-width: 0; height: var(--card-h); display: flex; flex-direction: column; justify-content: space-between; gap: 4px;
  position: relative; z-index: 1; animation: ck-in .18s ease-out; }
.checkin-face[hidden], .book .info[hidden] { display: none; }
@keyframes ck-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .checkin-face { animation: none; } }
.ck-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.ck-day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 0; border: 0; background: none; color: var(--muted);
  font-size: 10px; line-height: 12px; min-height: 32px; cursor: pointer; }
.ck-day.on { color: var(--text); font-weight: 800; }
.ck-dot { width: 18px; height: 18px; border-radius: 9px; background: var(--track); }
.ck-dot.read { background: var(--accent); }
/* the picked day: a small dot inside, the opposite colour of the day's dot */
.ck-dot { display: flex; align-items: center; justify-content: center; }
.ck-day.on .ck-dot::after { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
.ck-day.on .ck-dot.read::after { background: var(--card); }
.ck-value { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ck-pct { display: flex; align-items: baseline; font-family: var(--font-head); font-size: 28px; font-weight: 700; line-height: 1; cursor: text; }
.ck-pct input { width: 3ch; padding: 0 0 1px; border: 0; border-bottom: 1.5px dashed var(--dash); background: none; color: var(--text);
  font: inherit; font-variant-numeric: tabular-nums; text-align: right; outline: none; box-sizing: content-box; }  /* width set to the number's length */
.ck-pct input:focus { border-bottom-color: var(--accent); }
.ck-pct small { font-size: 15px; color: var(--muted); margin-left: 2px; }
.ck-slide { display: flex; align-items: center; gap: 6px; }
.ck-step { width: 30px; height: 30px; flex-shrink: 0; border-radius: 16px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 18px; line-height: 1; padding: 0; }
.ck-range { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 26px; margin: 0; background: none; --fill: 0%; }
.ck-range::-webkit-slider-runnable-track { height: 8px; border-radius: 4px;
  background: linear-gradient(to right, var(--accent) var(--fill), var(--track) var(--fill)); }
.ck-range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 13px;
  background: var(--accent); border: 3px solid var(--card); }
.ck-range::-moz-range-track { height: 8px; border-radius: 4px; background: var(--track); }
.ck-range::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--accent); }
.ck-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 13px; background: var(--accent); border: 3px solid var(--card); }
.aud-why summary { color: var(--accent); font-weight: 600; }
.aud-why summary::after { content: "›"; margin-left: 6px; transition: transform .15s; }
.aud-why[open] summary::after { transform: rotate(90deg); }
/* Book page Format card: short - small pills, earlier reads folded away */
.fmt-card { display: flex; flex-direction: column; gap: 8px; }
.fmt-card .chips { gap: 6px; }
.fmt-card .pill { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.earlier-reads summary { cursor: pointer; color: var(--muted); padding: 2px 0; }
.earlier-reads .earlier-read { gap: 8px; }
.earlier-reads .icon-btn { width: 36px; height: 36px; }
/* Check-in: pages or % for an ebook */
.ck-pct small { white-space: nowrap; }
.seg.ck-unit { min-width: 0; padding: 2px; }
.seg.ck-unit button { min-height: 28px; padding: 2px 10px; }
/* Check-in open: the cover slides out to give the inputs the card's width; title, format and close on top */
.book-main > .cover { transition: width .15s ease-out, margin .15s ease-out, opacity .15s ease-out; }
.book.checking-in .book-main > .cover { width: 0; margin-right: -14px; opacity: 0; overflow: hidden; }
.book.checking-in .checkin-face { height: auto; min-height: var(--card-h); }
.ck-head { display: flex; align-items: center; gap: 8px; }
.ck-title { flex: 1; min-width: 0; font-family: var(--font-head); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-format-wrap { position: relative; flex-shrink: 0; }
/* the format pill: one small pill per format, the lit one is what this check-in was; ▾ edits the book's formats */
.ck-format { min-height: 32px; padding: 2px; font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }
.ck-fmt-tag { min-height: 26px; padding: 2px 9px; border: 0; border-radius: 13px; background: none; color: var(--muted); font-size: 12px; }
.ck-fmt-tag[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); font-weight: 600; }
.ck-fmt-open { min-height: 26px; padding: 0 6px; border: 0; background: none; color: var(--muted); font-size: 12px; }
.ck-fmt-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; display: flex; flex-direction: column; min-width: 130px;
  padding: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--pop-shadow); }
.ck-fmt-menu[hidden] { display: none; }
.ck-fmt-menu button { border: 0; background: none; color: var(--text); text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 14px; min-height: 36px; }
.ck-fmt-menu button[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); font-weight: 600; }
.ck-fmt-menu button[aria-pressed="true"]::after { content: " ✓"; }
.ck-close { flex-shrink: 0; width: 30px; height: 30px; border-radius: 15px; border: 0; background: var(--accent); color: var(--on-accent);
  padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.ck-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
/* Check-in: which format this time (reads with several), and the page a percentage comes to */
.ck-when { text-align: right; }
.ck-pct .ck-est { margin-left: 6px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.ck-est:empty { display: none; }
/* Check-in open: room between the rows; the header set off by a line */
.book.checking-in .checkin-face { gap: 14px; justify-content: flex-start; }
.book.checking-in .ck-head { padding-bottom: 10px; border-bottom: 1px solid var(--divider); }

/* Now card, swiped right (like Mail): Finished and Add to list behind it; a long swipe stretches Finished */
.book:has(.swipe-actions) { position: relative; overflow: hidden; }
.book-main { position: relative; z-index: 1; background: var(--card); transition: transform .2s ease-out; }
.book.dragging .book-main { transition: none; }
.swipe-actions { position: absolute; left: 0; top: 0; bottom: 0; width: 0; display: flex; gap: 8px; padding: 12px 8px 12px 12px;
  box-sizing: border-box; visibility: hidden; }
.book.tray-showing .swipe-actions { visibility: visible; }
.book:not(.dragging) .swipe-actions { transition: width .2s ease-out; }
.swipe-actions button { flex: 1 1 0; min-width: 0; border: 0; border-radius: 14px; padding: 0 6px; font-size: 13px; font-weight: 800; overflow: hidden; white-space: nowrap;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: flex-grow .15s ease-out; }
.sw-finish { background: var(--leaf); color: var(--card); }
.sw-finish svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sw-list { background: var(--neutral); color: var(--on-neutral); }
.book.tray-full .sw-finish { flex-grow: 100; }
.book.tray-full .sw-list { flex-grow: 0; padding: 0; opacity: 0; }
.book.tray-full .swipe-actions { gap: 0; }
@media (prefers-reduced-motion: reduce) { .book-main, .swipe-actions, .swipe-actions button { transition: none !important; } }

/* The rating sheet after finishing a book */
.rate-head { display: flex; gap: 12px; align-items: center; }
.rate-head .info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rate-head .rate-save { flex-shrink: 0; align-self: flex-start; min-height: 36px; padding: 0 16px; border-radius: 18px; }
.rate-save:disabled { opacity: .4; }
.rate-skip { align-self: flex-start; }
/* confetti when a book is finished */
.confetti { position: fixed; inset: 0; width: auto; height: auto; margin: 0; padding: 0; border: 0; background: none;
  overflow: hidden; pointer-events: none; z-index: 1000; }
.confetti i { position: absolute; display: block; will-change: transform, opacity; }
.rate-body textarea { font: inherit; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical; width: 100%; box-sizing: border-box; }

/* A library's own catalog: the setup steps, and its link beside Open in Libby */
.catalog-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; line-height: 1.4; }


/* The library pill's panel: name, a row per Libby format, then the ways to open it (a short menu) */
.lib-panel { gap: 0; padding: 10px 0 4px; }
.lib-panel .lib-name { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 14px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-lines { display: flex; flex-direction: column; padding: 0 14px; }
.lib-panel .lib-line { min-height: 44px; padding: 6px 0; }
.lib-panel .lib-line + .lib-line { border-top: 1px solid var(--divider); }
.lib-wait { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: 13px; font-weight: 600; line-height: 1.25; }
.lib-wait .muted { font-size: 11.5px; font-weight: 400; }
.lib-none { padding: 4px 14px 8px; }
.lib-opens { display: flex; flex-direction: column; margin-top: 6px; border-top: 1px solid var(--divider); }
.lib-panel .lib-open { display: flex; justify-content: space-between; align-items: center; min-height: 42px; padding: 0 14px;
  font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; }
.lib-panel .lib-open + .lib-open { border-top: 1px solid var(--divider); }
.lib-panel .lib-open span { font-size: 18px; line-height: 1; }

/* Quick sheet: a book's shelf and lists, one tap each */
.qs-body { gap: 10px; padding-top: 6px; }
.qs-head { touch-action: none; display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding-top: 6px; cursor: grab; }
.qs-grab { align-self: center; width: 38px; height: 5px; border-radius: 3px; background: var(--border); }
.qs-book { display: flex; gap: 12px; align-items: center; }
.qs-book .info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qs-book strong { font-size: 16px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qs-body .chips .pill { min-height: 38px; padding: 7px 12px; }
/* the four shelves on one line at phone width */
.qs-body .add-list { min-height: 38px; }
.qs-note { color: var(--accent); font-weight: 600; }
.qs-note:empty { display: none; }  /* no room until it has something to say */
/* Tapping the cover, title or author opens the book page; Up next and Select sit at the top right */
.qs-open-book { cursor: pointer; }
.qs-open-book strong::after { content: " ›"; color: var(--muted); font-weight: 500; }
.qs-icons { margin-left: auto; align-self: flex-start; flex: none; display: flex; gap: 2px; }
.qs-rule { border: 0; border-top: 1px solid var(--divider); margin: 4px 0 0; width: 100%; }
.qs-open { align-self: flex-start; font-weight: 600; }
.qs-remove { color: var(--muted); }

/* Swiping between Books · Series · Lists (Shelf) and To review · Not interested (Inbox).
   Only the content below the switch moves (.mode-pane), clipped to its area (.mode-clip, full width so
   carousels reach the screen edge); .mode-peek is the next view's content waiting beside it. */
main.mode-swipe { touch-action: pan-y pinch-zoom; }
html.mode-dragging { overflow-x: hidden; }
.mode-clip { margin: 0 -16px; }
.mode-pane, .mode-peek { display: flex; flex-direction: column; gap: 16px; padding: 0 16px; }
html.mode-dragging .mode-clip { position: relative; overflow: hidden; overflow: clip; }
.mode-peek { position: absolute; left: 0; width: 100%; overflow: hidden; pointer-events: none; will-change: transform; }
/* The switch's highlight is one sliding piece (--i: which segment, fractional mid-swipe) */
.seg-slide { position: relative; }
.seg-slide .seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n));
  border-radius: 8px; background: var(--card); transform: translateX(calc(var(--i) * 100%)); }
.seg-slide.seg-anim .seg-thumb { transition: transform 200ms cubic-bezier(0.2, 0.7, 0.3, 1); }
.seg-slide button { position: relative; }
.seg-slide button[aria-pressed="true"] { background: transparent; }

/* Reading vs listening: headphones for time listened, open book for pages read */
.rf-ic { display: inline-flex; vertical-align: -0.12em; margin-right: 4px; color: var(--muted); }
.rf-ic svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.today-split .rf-ic { align-self: center; margin-right: 0; }
.today-split .rf-ic svg { width: 22px; height: 22px; }
.stat .num .rf-ic { margin-right: 6px; }
.stat .num .rf-ic svg { width: 20px; height: 20px; }
.day-ic { display: flex; gap: 2px; min-height: 10px; font-size: 10px; }
.day-ic .rf-ic { margin: 0; }
.rf-lines { display: flex; flex-direction: column; gap: 1px; }
.rf-line { display: block; }
.mini .rf-ic { color: inherit; }
.ck-fmt-tag .rf-ic { margin-right: 4px; color: inherit; }
.pill .rf-ic { color: inherit; }
.stat-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; }
.stat-pair > * { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.stat-pair > :first-child { padding-right: 14px; }
.stat-pair > :last-child { padding-left: 14px; border-left: 1px solid var(--border); }
.sbar-b.split { background: linear-gradient(to top, var(--accent) var(--read), color-mix(in srgb, var(--accent) 40%, transparent) var(--read)); }

/* staging notes (comment mode) */
#fb-open { position: absolute; right: 6px; top: calc(1px + env(safe-area-inset-top, 0px)); background: none; border: 0; font-size: 16px; padding: 2px 8px; cursor: pointer; }
#fb-hint { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: #B45309; color: #fff; text-align: center;
  font-size: 13px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); }
.fb-picked { outline: 3px solid #B45309 !important; outline-offset: 2px; }
.fb-note { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.fb-note .mini { align-self: flex-start; }

/* Stats: the listening card's big number is a button (time / ≈ pages), and a bar's caption only shows once you tap a bar */
.listen-toggle { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; background: none; border: 0; padding: 0; color: inherit; text-align: left; cursor: pointer; }
.listen-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.listen-switch { display: inline-flex; background: var(--track); border-radius: 999px; padding: 2px; font-size: 11px; line-height: 1; }
.listen-switch span { padding: 3px 7px; border-radius: 999px; }
.listen-switch .on { background: var(--card); color: var(--text); font-weight: 800; }
.caption:empty { display: none; }

/* ---------------------------------------------------------------- Styled cover (no picture) */
.cover.no-art { display: flex; flex-direction: column; justify-content: center; gap: 3px; text-align: center; line-height: 1.15; overflow: hidden; }
.cover-title { font-weight: 700; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cover-author { font-size: 0.8em; font-weight: 500; opacity: 0.85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cover.tiny .cover-author { display: none; }
.cover.tiny .cover-title { -webkit-line-clamp: 5; }

/* ---------------------------------------------------------------- Book page: compact Up next card */
/* Want books: Pin on its own line, the format row full width under it (side by side they overlapped at phone width) */
.fmt-seg button { white-space: nowrap; min-width: 0; padding-left: 4px; padding-right: 4px; }
.rate-undo { align-self: flex-start; }

.shelf-helpers { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.helper-btn { flex: none; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 16px; padding: 5px 10px; font: inherit; font-size: 13px; min-height: 32px; }
.helper-btn.pick-btn { font-weight: 800; font-size: 14px; min-height: 38px; padding: 7px 16px; border-color: var(--accent); background: var(--chip-on-bg); color: var(--chip-on-fg); }
.pick-reel { display: flex; justify-content: center; }
.pick-reel.landed { animation: pick-land 0.25s ease-out; }
@keyframes pick-land { from { transform: scale(0.92); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pick-reel.landed { animation: none; } }
.helper-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.pick-card { align-items: center; text-align: center; }

/* Now: This week in books - three numbers in equal columns, label under each */
.week-split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.week-split > div { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.week-split .num { font-size: 24px; font-weight: 700; line-height: 1.1; }
.week-split .muted { font-size: 13px; }
.week-split .rf-ic svg { width: 18px; height: 18px; }

/* Calendar streaks: a dot on each reading day, joined into a line across neighbouring days */
.cdot { position: absolute; bottom: 4px; left: 50%; width: 7px; height: 7px; transform: translateX(-50%); border-radius: 50%;
  background: var(--accent); z-index: 4; box-shadow: 0 0 0 1.5px var(--card); pointer-events: none; }
.cline { position: absolute; bottom: 6.5px; height: 2px; background: var(--accent); z-index: 3; pointer-events: none; }
.cline.l { left: -2px; right: 50%; }
.cline.r { left: 50%; right: -2px; }
.cline.l.edge { left: 0; background: linear-gradient(to right, transparent, var(--accent)); }
.cline.r.edge { right: 0; background: linear-gradient(to left, transparent, var(--accent)); }
/* past streaks are quieter; the one still going is full strength and a touch bigger */
.cdot, .cline { opacity: 0.45; }
.cdot.cur, .cline.cur { opacity: 1; }
.cdot.cur { width: 9px; height: 9px; bottom: 3px; }
.cline.cur { height: 3px; bottom: 6px; }
/* A sheet that keeps its height (search sheets): the list scrolls inside */
dialog.sheet.fixed-sheet { height: 80vh; height: 80dvh; }
dialog.sheet.fixed-sheet .sheet-body { height: 100%; display: flex; flex-direction: column; }
dialog.sheet.fixed-sheet .helper-list { flex: 1; max-height: none; min-height: 0; }
#fb-count { position: absolute; top: -2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--text); color: var(--bg); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }

/* Stats: nothing can be wider than the screen; the pace chart's axes; the Top author toggle */
.card { min-width: 0; max-width: 100%; overflow-x: clip; }
.card .sbig, .stat .num { overflow-wrap: anywhere; }
.pace-wrap { position: relative; }
.pace-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); pointer-events: none; }
.pace-grid > span { position: absolute; left: 0; bottom: 1px; font-size: 10px; color: var(--muted); }
.author-toggle { display: flex; }
.author-name { min-width: 0; overflow-wrap: anywhere; }

/* Rating card: stars first, dates small underneath; a tap opens the dates and note */
.rate-sum { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; padding: 4px 0; color: inherit; text-align: left; cursor: pointer; }
.rate-sum .rf-ic svg { width: 16px; height: 16px; }
.rate-chev { margin-left: auto; }
.rate-sum[aria-expanded="true"] .rate-chev { transform: rotate(180deg); }
.rate-more { display: flex; flex-direction: column; gap: 12px; }
.rate-more[hidden] { display: none; }

/* Book page, off the shelf: one Add button; swiped left (or its ›) it shows the other shelves behind it */
.add-slide { position: relative; overflow: hidden; border-radius: 14px; }
.add-opts { position: absolute; right: 0; top: 0; bottom: 0; width: 300px; display: flex; gap: 6px; padding-left: 6px; box-sizing: border-box; }
.add-opts.three { width: 228px; }
.add-opts button { flex: 1 1 0; min-width: 0; border: 0; border-radius: 14px; padding: 0 4px; font-size: 13px; font-weight: 800; color: #FFFDF6; }
.add-opt-want { background: #3E6E6A; }
.add-opt-reading { background: var(--warm); color: var(--on-warm) !important; }
.add-opt-finished { background: var(--accent); color: var(--on-accent) !important; }
.add-opt-dnf { background: var(--neutral); color: var(--on-neutral) !important; }
.add-face { position: relative; z-index: 1; display: flex; gap: 1px; background: var(--card); transition: transform .2s ease-out; touch-action: pan-y; }
.add-opts button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px rgba(255,255,255,.85); }
.add-face [data-slide-face] { flex: 1; border-radius: 14px 0 0 14px; }
.add-face .add-more { width: 48px; flex: none; border-radius: 0 14px 14px 0; font-size: 24px; line-height: 1; padding: 0 0 3px; }
@media (prefers-reduced-motion: reduce) { .add-face { transition: none !important; } }

/* Add card: the add-to-list button sits top right, level with the reason line */
/* Earlier reads: the format icons open that read's Audiobook | Ebook | Book row */
.earlier-reads .earlier-item { display: flex; flex-direction: column; gap: 6px; }
.earlier-reads .earlier-fmt { display: inline-flex; align-items: center; gap: 2px; min-height: 36px; padding: 0 6px; background: none; border: 0; color: var(--muted); border-radius: 8px; cursor: pointer; }
.earlier-reads .earlier-fmt[aria-expanded="true"] { background: var(--track); }
.earlier-reads .grow { flex: 1; min-width: 0; }
.rate-more .fmt-card { gap: 6px; }

/* Book page: the shelf button with its format or rating in one card */
.rate-card { display: flex; flex-direction: column; gap: 10px; }

/* Shelf card: format row, then progress and dates (Reading) or rating (Finished/DNF) */
.shelf-fmt { display: flex; flex-direction: column; gap: 4px; }
.read-progress { display: flex; flex-direction: column; gap: 8px; }
.rate-sum.static { cursor: default; }

/* Settings > People: one card per person, nothing wider than the screen */
.ppl { display: flex; flex-direction: column; gap: 10px; }
.ppl-card { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 14px; background: var(--card); border-radius: 20px; box-shadow: var(--card-edge); }
.ppl-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 700; overflow-wrap: anywhere; }
.ppl-line { overflow-wrap: anywhere; }
.ppl-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ppl-invite { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ppl-invite input { flex: 1 1 180px; min-width: 0; font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); }
.ppl-card #invite-out { margin-top: 6px; }
.ppl-card .copy-row { min-width: 0; }

/* Plant Style on Now: a tall card per book, the plant area on top and the book's row under a hairline;
   several books are one card each, side by side (swiped on the plant), with dots at the top right */
.plant-wrap { position: relative; --stage-h: 300px; --u: 0.2px; }
.plant-deck { display: flex; align-items: stretch; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  scrollbar-width: none; overscroll-behavior-x: contain; }
.plant-deck::-webkit-scrollbar { display: none; }
.plant-slide { flex: 0 0 100%; scroll-snap-align: start; background: var(--card); border-radius: 28px; overflow: hidden; box-shadow: var(--card-edge); }
.plant-slide .book { border-radius: 0 0 28px 28px; box-shadow: none; border-top: 1px solid var(--divider); padding: 14px 16px 16px; }
/* the plant and pot share one canvas (--cw x --ch art units, shown at --u each, sized by sizePlants); the plant
   is moved by --dx/--dy so its base sits on the pot's rim */
.plant-stage { position: relative; overflow: hidden; background: var(--stage-bg); height: var(--stage-h); }
.plant-frames, .plant-pot { position: absolute; left: 50%; bottom: 14px; width: calc(var(--cw) * var(--u)); height: calc(var(--ch) * var(--u)); }
.plant-frames { transform: translate(calc(-50% + var(--dx) * var(--u)), calc(var(--dy) * var(--u))); }
.plant-frames img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.plant-pot { transform: translateX(-50%); z-index: 1; }
.planted { position: absolute; top: 14px; left: 16px; z-index: 2; font-size: 12px; font-weight: 700; color: var(--muted); }
/* dark mode's light: a hanging lamp, and the cream arch it lights behind the plant (--lamp-display: none in light) */
.plant-lamp { display: var(--lamp-display); position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 2; }
.plant-arch { display: var(--lamp-display); position: absolute; left: 50%; top: 48px; bottom: 6px; transform: translateX(-50%);
  width: min(58%, 220px); border-radius: 110px 110px 22px 22px; background: #F2E8D0; box-shadow: 0 0 40px rgba(233, 196, 106, 0.25); }
.plant-dots { position: absolute; top: 10px; right: 8px; z-index: 3; display: flex; }
.plant-dots button { min-width: 22px; height: 28px; padding: 0 3px; border: 0; background: none; display: flex; align-items: center; justify-content: center; }
.plant-dots button::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--dash); transition: width .2s ease-out; }
.plant-dots button[aria-current="true"]::before { width: 22px; background: var(--accent); }
@media (prefers-reduced-motion: reduce) { .plant-dots button::before { transition: none; } }
/* the last dot (the Add a book card) is a small plus */
.plant-dots .dot-add::before { content: "+"; width: auto; height: auto; border-radius: 0; background: none; color: var(--dash);
  font: 800 16px/1 var(--font-body); }
.plant-dots .dot-add[aria-current="true"]::before { width: auto; background: none; color: var(--accent); }

/* the book's row: small cover beside the title, a full-width Check in under it */
.plant-book .book-main { --card-h: auto; }
.plant-book .info { gap: 12px; justify-content: flex-start; }
.pb-head { display: flex; gap: 12px; align-items: center; }
.plant-book .book-main .cover { width: 46px; height: 68px; border-radius: 5px; flex-shrink: 0; }
.pb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.plant-book .title { font-size: 18px; }
.plant-book .bar.thin { height: 5px; }
.plant-book .pb-line { color: var(--leaf); font-weight: 700; font-size: 12px; }
.plant-book .pb-line .rf-ic { color: inherit; }
.plant-book .book-actions { justify-content: flex-start; }
.plant-book .book-actions .mini { min-height: 50px; border-radius: 16px; padding: 0 14px; }
.pb-check { flex: 1; min-height: 50px; border-radius: 16px; border: 0; background: var(--accent); color: var(--on-accent);
  font: inherit; font-size: 15px; font-weight: 800; }

/* Plant Style: the round icon of a plant's today number; the week as sprigs (the Today card) */
.pt-ic { width: 40px; height: 40px; border-radius: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--chip-on-bg); color: var(--leaf); }
.pt-ic.read { background: var(--warm-soft); color: var(--warm); }
.pt-ic.gold { background: var(--warm-soft); color: var(--sprig-today-fill); }
.plant-stat.streak { left: auto; right: 16px; }
.pt-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sprig-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding-top: 4px; }
.sprig-day { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
.sprig { width: 22px; height: 24px; fill: none; stroke: var(--leaf); stroke-width: 2; }
.sprig .lf { fill: var(--chart); }
.sprig.stub { stroke: var(--dash); }
.sprig-day.future .sprig { opacity: .5; }
.sprig-day.today { font-weight: 800; color: var(--sprig-today-ink); }
.sprig-day.today .sprig:not(.stub) { stroke: var(--sprig-today); }
.sprig-day.today .sprig .lf { fill: var(--sprig-today-fill); }
.sprig-n { min-height: 14px; font-size: 10px; color: var(--muted); }

/* Plant Style's check-in sheet: the check-in face, then today's mark and Finished?; a lighter dim so the
   plant above it stays in sight while it grows */
dialog.sheet.ck-sheet::backdrop { background: color-mix(in srgb, var(--scrim) 45%, transparent); }
.ck-sheet .qs-head { padding-top: 0; margin: -8px 0 -4px; }
.ck-sheet .checkin-face { gap: 14px; justify-content: flex-start; }
.ck-sheet .ck-head { padding-bottom: 10px; border-bottom: 1px solid var(--divider); }
.ck-sheet-actions { display: flex; gap: 8px; }
.ck-sheet-actions .mini { flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.ck-sheet-actions svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ck-sheet-actions .listened[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Plant Style: the book's today number down the left of the plant; the add card after the last book; Edit Home */
.plant-stat { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); z-index: 2; display: flex; flex-direction: column;
  align-items: center; gap: 2px; max-width: 76px; text-align: center; }
.plant-stat b { font-family: var(--font-head); font-size: 26px; font-weight: 700; line-height: 1.1; margin-top: 4px; }
.plant-stat small { max-width: 52px; text-align: center; font-size: 12px; color: var(--muted); line-height: 1.2; }
.plant-slide[data-plant-slide="add"] { cursor: pointer; }
.plant-add-pot { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: 108px; height: 100px; z-index: 1;
  fill: none; stroke: var(--leaf); stroke-width: 2.5; stroke-linecap: round; }
.plant-add-pot .pot { stroke: var(--dash); stroke-dasharray: 7 6; }
.plant-add-cover { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--dash); background: none;
  color: var(--leaf); font-size: 26px; font-weight: 700; padding: 0; }
.edit-home { align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--muted);
  font-size: 13px; font-weight: 700; text-decoration: none; }
.edit-home svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Plant Style's first screen: one narrow card (the top slot, picked in Edit Home) over the plant card, in one
   box sized together by sizePlants; Edit Home shows Reading as a fixed row with the slot's choice above it */
.plant-pair-in { display: flex; flex-direction: column; gap: 10px; }
.plant-slot { padding: 10px 14px; gap: 8px; }
.plant-slot .sprig-week { padding-top: 0; }
.now-slot-pick { display: flex; flex-direction: column; gap: 6px; }
.edit-fixed { justify-content: space-between; padding: 8px 14px; }

/* Plant Style: the first screen tucked away after scrolling down (Home starts at the next section); while it's
   away the page has no rubber band or pull-to-refresh of its own, so a hard pull at the top brings it back */
.plant-pair.tucked { display: none; }
.plant-pair.plant-moving { overflow: hidden; }
html:has(.plant-pair.tucked), html:has(.plant-pair.tucked) body { overscroll-behavior-y: contain; }
.plant-peek { margin-bottom: -16px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.plant-peek.settle { transition: height .2s ease-out; }
.plant-peek .sprig { width: 30px; height: 34px; margin-bottom: 6px; opacity: calc(.3 + .7 * var(--k)); transform: scale(calc(.6 + .4 * var(--k)));
  transform-origin: bottom center; stroke: var(--dash); }
.plant-peek .sprig .lf { fill: none; }
.plant-peek.ready .sprig { stroke: var(--leaf); }
.plant-peek.ready .sprig .lf { fill: var(--chart); }
