/* Section-specific styles. */

/* ---------- Welcome (first open) ---------- */
.welcome {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) var(--gutter) max(24px, env(safe-area-inset-bottom));
}
.welcome-inner { width: 100%; max-width: 520px; text-align: center; }
.welcome-logo { margin: 0 auto var(--space-5); border-radius: 16px; box-shadow: var(--shadow); }
.welcome-title { font-family: var(--font-serif); font-size: 26px; font-weight: var(--fw-semi); }
.welcome-title em { font-style: italic; font-weight: 400; color: var(--gold-ink); }
.welcome-sub { margin: var(--space-3) auto var(--space-7); max-width: 40ch; color: var(--text-muted); }
.welcome-options { display: grid; gap: var(--space-4); text-align: left; }
.welcome-opt {
  display: flex; align-items: center; gap: var(--space-5);
  min-height: 64px;
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.welcome-opt:hover { border-color: var(--accent); }
.welcome-opt:active { transform: scale(.99); }
.welcome-opt > svg { width: 24px; height: 24px; flex: none; color: var(--gold-ink); }
.welcome-opt strong { display: block; font-size: var(--fs-md); font-weight: var(--fw-semi); }
.welcome-opt small { display: block; font-size: var(--fs-sm); color: var(--text-muted); }
.welcome-foot {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  margin-top: var(--space-7);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.welcome-foot svg { width: 16px; height: 16px; }

/* ---------- Covers (generated SVG, real image on top) ---------- */
.cover {
  position: relative; flex: none; display: block;
  width: 30px; aspect-ratio: 2 / 3;
  border-radius: 2px 4px 4px 2px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.08);
}
.cover > svg, .cover > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover > img { object-fit: cover; }
.cover-xs { width: 22px; }
.cover-sm { width: 30px; }
.cover-md { width: 100%; border-radius: 3px 6px 6px 3px; }
.cover-lg { width: 112px; border-radius: 3px 8px 8px 3px; box-shadow: var(--shadow-lg); }
.cover-form { width: 84px; border-radius: 3px 6px 6px 3px; box-shadow: var(--shadow); }
.cover.has-image::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.18) 0 4%, rgba(255,255,255,.12) 4% 5%, transparent 5%);
}

/* ---------- Home ---------- */
.home-stats { margin-bottom: var(--gap); }
@media (min-width: 900px) { .grid-4-lg { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.home-stats .progress { margin-top: var(--space-2); }
.reading-row .grow { display: flex; flex-direction: column; gap: 3px; }
.reading-row .progress { margin-top: 2px; }
.reading-row .pct { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--text-muted); min-width: 34px; text-align: right; }
.list-row .grow > .title, .list-row .grow > .meta { display: block; }

/* ---------- Library ---------- */
.filter-bar {
  display: flex; gap: var(--space-2);
  margin: 0 calc(var(--gutter) * -1) var(--space-5);
  padding: 2px var(--gutter);
  overflow-x: auto; scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: none;
  height: 32px; padding: 0 var(--space-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.filter-chip span { color: var(--text-muted); margin-left: 2px; }
.filter-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.filter-chip[aria-pressed="true"] span { color: inherit; opacity: .8; }
@media (min-width: 900px) { .filter-bar { margin-left: 0; margin-right: 0; padding: 2px 0; flex-wrap: wrap; } }

.chip.status-reading { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.chip.status-read { background: color-mix(in srgb, var(--success) 20%, transparent); }
.chip.status-dnf { background: var(--danger-soft); }
.chip.status-wishlist { background: color-mix(in srgb, var(--gold) 24%, transparent); }

/* ---------- Book page ---------- */
.book-grid { grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .book-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); } }
.book-hero { display: flex; gap: var(--space-6); align-items: flex-start; }
.book-hero-text { min-width: 0; }
.details { display: grid; grid-template-columns: 1fr; }
.details > div {
  display: flex; justify-content: space-between; gap: var(--space-5);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
}
.details > div:first-child { border-top: 0; }
.details dt { color: var(--text-muted); font-size: var(--fs-sm); }
.details dd { text-align: right; font-weight: var(--fw-medium); }

/* ---------- More ---------- */
.more-grid { display: grid; gap: var(--space-3); }
@media (min-width: 640px) { .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.more-link {
  display: flex; align-items: center; gap: var(--space-5);
  min-height: 60px;
  color: inherit; text-decoration: none;
}
.more-link:hover { border-color: var(--border-strong); }
.more-link > svg:last-child { width: 16px; height: 16px; color: var(--text-muted); flex: none; }
.more-icon {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--gold-ink);
}
.more-icon svg { width: 19px; height: 19px; }
.more-link .grow { flex: 1; min-width: 0; }
.more-label { display: block; font-weight: var(--fw-semi); font-size: var(--fs-md); }
.more-text { display: block; font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- Settings ---------- */
.settings-grid { grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1000px) {
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Preferences is the tall card: let it take the right column while theme + data stack on the left. */
  .settings-grid > :nth-child(2) { grid-column: 2; grid-row: 1 / span 3; }
  .settings-grid > :nth-child(1), .settings-grid > :nth-child(3), .settings-grid > :nth-child(4) { grid-column: 1; }
}
.goal-ctl { flex: none; }
.goal-ctl .input { width: 76px; min-width: 0; }
.goal-ctl .select { min-width: 92px; }
.data-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-4) 0; }
.danger-text { color: var(--danger); }

/* ---------- Placeholders ---------- */
.soon-note {
  margin: 0 auto var(--space-5);
  width: max-content;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  color: var(--text);
}

/* ---------- Library tools ---------- */
.lib-tools { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.search-box { position: relative; flex: 1 1 220px; min-width: 0; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.search-box .input { padding-left: 32px; min-height: var(--btn-h); }
.lib-tools .btn { position: relative; }
.count-dot {
  display: inline-grid; place-items: center;
  min-width: 16px; height: 16px; padding: 0 4px; margin-left: 2px;
  border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: var(--fw-semi);
}
.lib-tools .select-sm { flex: 0 1 auto; min-width: 0; max-width: 190px; }
@media (max-width: 599px) {
  .search-box { flex-basis: 100%; }
  .lib-tools { flex-wrap: wrap; }
  .lib-tools .select-sm { flex: 1 1 0; max-width: none; }
  .lib-tools .btn-ghost { padding: 0 8px; }
}
.filter-bar { margin-bottom: var(--space-3); }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--space-4); }
.active-filters:empty { display: none; }

.lib-card { padding-top: 4px; padding-bottom: 4px; }
.lib-row { min-height: 54px; }
.lib-row .chip { flex: none; }
.row-rating { flex: none; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--gold-ink); }
@media (max-width: 479px) { .lib-row .chip { display: none; } }
.selectable { cursor: pointer; }
.selectable .sel { width: 18px; height: 18px; flex: none; accent-color: var(--accent); margin: 0; }

.cover-grid {
  display: grid; gap: var(--space-5) var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}
@media (min-width: 900px) { .cover-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); } }
.tile { position: relative; display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }
.tile .cover { transition: transform var(--dur) var(--ease); }
.tile:hover .cover { transform: translateY(-2px); }
.tile-title { font-size: var(--fs-sm); font-weight: var(--fw-semi); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { font-size: var(--fs-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.selectable .sel { position: absolute; top: 6px; left: 6px; z-index: 1; }
.show-more { display: flex; justify-content: center; margin-top: var(--space-5); }

.bulk-bar {
  position: fixed; z-index: 35; left: 0; right: 0;
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--gutter);
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -6px 20px rgba(0,0,0,.08);
}
.bulk-bar .grow { flex: 1; }
.bulk-count { font-weight: var(--fw-semi); font-size: var(--fs-sm); }
@media (min-width: 900px) { .bulk-bar { left: var(--sidebar-w); bottom: 0; } }
.lib-results { padding-bottom: 60px; }

/* ---------- Add / edit sheet ---------- */
.bf { display: flex; flex-direction: column; gap: var(--space-5); }
.bf-find { padding: var(--space-4); border-radius: var(--radius); background: var(--surface-2); }
.bf-find-row { display: flex; gap: var(--space-3); }
.bf-find-row .input { flex: 1; min-width: 0; }
.bf-note { margin-top: 4px; font-size: var(--fs-xs); color: var(--text-muted); }
.bf-msg { display: flex; align-items: center; gap: 4px; margin-top: var(--space-3); font-size: var(--fs-sm); color: var(--text-muted); }
.bf-msg.ok { color: var(--success); font-weight: var(--fw-medium); }
.bf-msg svg { width: 15px; height: 15px; flex: none; }
.bf-list { margin-top: var(--space-3); display: flex; flex-direction: column; gap: 4px; }
.bf-result {
  display: flex; align-items: center; gap: var(--space-4); width: 100%;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); text-align: left;
}
.bf-result:hover { border-color: var(--accent); }
.bf-result .grow { flex: 1; min-width: 0; }
.bf-result .title { display: block; font-weight: var(--fw-semi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf-result .meta { display: block; font-size: var(--fs-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf-thumb { display: grid; place-items: center; width: 30px; height: 45px; flex: none; border-radius: 3px; overflow: hidden; background: var(--surface-2); color: var(--text-muted); }
.bf-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bf-thumb svg { width: 16px; height: 16px; }
.bf-use { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--accent); flex: none; }

.bf-top { display: flex; gap: var(--space-5); align-items: flex-start; }
.bf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.bf-cover-art { display: flex; align-items: flex-end; gap: 6px; }
.bf-spine { display: block; }
@media (max-width: 420px) { .bf-spine { display: none; } .cover-form { width: 72px; } }
.bf-dup {
  display: flex; gap: 6px; align-items: flex-start;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--gold) 20%, transparent);
  font-size: var(--fs-sm);
}
.bf-dup svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.bf-set { border: 0; padding: 0; margin: 0; min-width: 0; }
.bf-set legend { padding: 0; margin-bottom: 6px; }
.bf-set .field-hint { font-weight: 400; margin-left: 4px; }
.bf-row { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.bf-row > .field { flex: 1 1 120px; }
.bf-row > .field.grow { flex: 3 1 180px; }
.bf-pages { max-width: 160px; }
.bf-num { max-width: 100px; }
.bf-audio .row .input { width: 70px; }
.bf-add-genre { display: flex; gap: var(--space-3); margin-top: var(--space-3); }
.bf-add-genre .input { flex: 1; min-width: 0; }

.bf-more { border-top: 1px solid var(--border); padding-top: var(--space-4); }
.bf-more summary {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; cursor: pointer; list-style: none;
  font-weight: var(--fw-semi); color: var(--accent);
}
.bf-more summary::-webkit-details-marker { display: none; }
.bf-more summary svg { width: 15px; height: 15px; transition: transform var(--dur) var(--ease); }
.bf-more[open] summary svg { transform: rotate(90deg); }
.bf-more-body { display: flex; flex-direction: column; gap: var(--space-5); margin-top: var(--space-4); }
.file-btn { cursor: pointer; }

.swatch-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-4); }
.color-opt { position: relative; display: inline-flex; }
.color-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.color-opt span {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.color-opt.auto span { width: auto; padding: 0 10px; border-radius: var(--radius-pill); background: var(--surface-2); font-size: var(--fs-xs); font-weight: var(--fw-semi); }
.color-opt input:checked + span { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--surface); }
.color-opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Import ---------- */
.import-how { display: grid; gap: var(--space-4); }
@media (min-width: 520px) { .import-how { grid-template-columns: 1fr 1fr; } }
.import-how > div { padding: var(--space-4); border-radius: var(--radius); background: var(--surface-2); }
.import-src { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.import-src svg { width: 16px; height: 16px; color: var(--gold-ink); }
.import-found { font-weight: var(--fw-semi); margin-bottom: var(--space-3); }
.import-preview .list-row { min-height: 40px; }
.import-preview .grow { flex: 1; min-width: 0; }
.import-preview .title, .import-preview .meta { display: block; }

.row-spice { flex: none; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-muted); }

/* ---------- Book page ---------- */
.bp-head { margin-bottom: var(--space-4); }
.saved-note { margin-left: auto; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--success); opacity: 0; transition: opacity var(--dur) var(--ease); }
.saved-note.on { opacity: 1; }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-4); }

.bp-hero {
  position: relative; display: grid; gap: var(--space-2) var(--space-6); align-items: start; margin-bottom: var(--gap);
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "cover text" "cover status";
}
.bp-hero > .bp-cover { grid-area: cover; }
.bp-hero > .bp-hero-text { grid-area: text; }
.bp-hero > .bp-status { grid-area: status; align-self: end; }
.toggle-row .set-text > span { display: block; }
.bp-cover { flex: none; padding: 0; border: 0; background: none; border-radius: 8px; }
.bp-cover .cover-lg { width: 104px; }
@media (min-width: 900px) { .bp-cover .cover-lg { width: 120px; } }
.bp-hero-text { flex: 1; min-width: 0; padding-right: 36px; }
.bp-title { font-family: var(--font-serif); font-size: 22px; font-weight: var(--fw-semi); line-height: 1.15; }
@media (max-width: 599px) { .bp-title { font-size: 19px; } }
.bp-author { color: var(--text-muted); margin-top: 2px; }
.bp-series { font-size: var(--fs-sm); color: var(--gold-ink); font-weight: var(--fw-medium); margin-top: 2px; }
.bp-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }
.bp-quick { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-size: var(--fs-sm); }
.q-star { font-weight: var(--fw-semi); color: var(--gold-ink); }
.bp-status { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--space-4); }
.status-btn {
  min-height: 30px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  background: var(--surface); font-size: var(--fs-xs); font-weight: var(--fw-semi);
}
.status-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 599px) {
  .bp-hero { grid-template-areas: "cover text" "status status"; gap: var(--space-4); }
  .bp-cover .cover-lg { width: 92px; }
  .bp-status { margin-top: 0; }
  .bp-status { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .status-btn { min-height: 34px; padding: 0 4px; }
}
.fav-btn {
  position: absolute; top: 8px; right: 8px;
  display: grid; place-items: center; width: var(--tap); height: var(--tap);
  border: 0; border-radius: 50%; background: transparent; color: var(--text-muted);
}
.fav-btn svg { width: 22px; height: 22px; }
.fav-btn[aria-pressed="true"] { color: var(--rose); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
@media (prefers-reduced-motion: no-preference) { .fav-btn[aria-pressed="true"] svg { animation: pop .3s var(--ease); } }
@keyframes pop { 50% { transform: scale(1.25); } }

.bp-grid { display: grid; gap: var(--gap); align-items: start; }
@media (min-width: 1000px) { .bp-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.bp-col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.bp-foot { margin-top: var(--space-6); }
.progress.big { height: 8px; }
.kind-note { font-size: var(--fs-sm); color: var(--text-muted); font-style: italic; }

/* Ratings */
.rate-row { display: flex; align-items: center; gap: var(--space-4); min-height: 40px; flex-wrap: wrap; }
.rate-row + .rate-row { border-top: 1px solid var(--border); }
.rate-label { width: 48px; flex: none; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted); }
.rate-wrap { display: flex; flex-direction: column; gap: 2px; }
.rate { display: flex; align-items: center; gap: var(--space-3); }
.stars { display: flex; }
.star { position: relative; width: 36px; height: 36px; padding: 4px; border: 0; background: none; }
.star svg { position: absolute; inset: 4px; width: 28px; height: 28px; }
.star .star-bg { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.2; }
.star-fg path { fill: var(--gold); }
@media (prefers-reduced-motion: no-preference) { .star:active svg { transform: scale(.88); transition: transform var(--dur-fast); } }
.rate-value { min-width: 34px; font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--text-muted); }
.fine-slider { display: flex; flex-direction: column; gap: 2px; max-width: 220px; }
.fine-slider input { accent-color: var(--gold); width: 100%; }
.scale-icons { display: flex; }
.scale-btn {
  width: 34px; height: 36px; padding: 0; border: 0; background: none;
  font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .35;
  transition: opacity var(--dur-fast), filter var(--dur-fast), transform var(--dur-fast);
}
.scale-btn.on { filter: none; opacity: 1; }
.scale-btn:active { transform: scale(.88); }
.scale-none {
  min-height: 28px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  background: var(--surface); font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-muted);
}
.scale-none.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
@media (max-width: 399px) { .scale-btn { width: 30px; font-size: 18px; } .star { width: 32px; height: 32px; } .star svg { width: 24px; height: 24px; } }
.toggles { margin-top: var(--space-3); border-top: 1px solid var(--border); }
.toggle-row { cursor: pointer; }
.toggle-row:first-child { border-top: 0; }

/* Mood & pace */
.mood-chip, .prompt-chip {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 32px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  background: var(--surface); font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.mood-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.prompt-chip { border-style: dashed; color: var(--text-muted); text-align: left; }
.prompt-chip:hover { color: var(--text); border-color: var(--accent); }
.pace-row { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-5); }
.seg-text button { width: auto; padding: 0 14px; font-size: var(--fs-sm); font-weight: var(--fw-medium); height: 32px; }

/* Tropes, warnings */
.chip-trope, .chip-warn { height: 28px; padding-right: 2px; font-size: var(--fs-sm); }
.chip-warn { background: var(--surface-2); }
.chip-del { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); padding: 0; }
.chip-del:hover { background: rgba(0,0,0,.08); color: var(--text); }
.chip-del svg { width: 12px; height: 12px; }
.add-row { display: flex; gap: var(--space-3); margin-top: var(--space-4); }
.add-row .input { flex: 1; min-width: 0; }
.card-note + .opts, .card-note + .add-row, .card-note + .btn { margin-top: var(--space-4); }
.trope-picker { display: flex; flex-direction: column; gap: var(--space-5); }
.trope-top { position: sticky; top: 0; z-index: 1; display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; background: var(--surface); }
.trope-add { align-self: flex-start; }
.trope-group h3 { margin-bottom: 6px; }

/* Quotes */
.quote-list { display: flex; flex-direction: column; gap: var(--space-4); margin-bottom: var(--space-5); }
.quote-item { padding: var(--space-4) var(--space-5); border-left: 3px solid var(--gold); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); }
.quote-item blockquote { margin: 0; font-family: var(--font-serif); font-style: italic; font-size: 15px; line-height: 1.45; white-space: pre-wrap; }
.quote-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.icon-btn.sm { width: 36px; height: 36px; margin: -4px 0; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.quote-add { display: flex; flex-direction: column; gap: var(--space-3); }
.quote-page { width: 96px; }
.quote-add .row .btn { margin-left: auto; }
.textarea-sm { min-height: 56px; }

/* Reads */
.read-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.read-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.read-n { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-muted); width: 22px; }
.input-sm { width: auto; min-height: var(--btn-h-sm); padding: 0 6px; font-size: var(--fs-sm); }
@media (max-width: 899px) { .input-sm { font-size: var(--fs-input); } }

/* Collector */
.input-prefix { display: flex; align-items: center; max-width: 180px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.input-prefix > span { padding: 0 2px 0 10px; color: var(--text-muted); }
.input-prefix .input { border: 0; background: transparent; }
.input-prefix:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 1px; }
.input-prefix .input:focus-visible { outline: none; }
.field .row .input { flex: 1; min-width: 0; }

/* =========================================================
   Phase 4 — Home, Reading, Stats, timer, charts
   ========================================================= */
.stat-value small { font-size: 13px; font-weight: var(--fw-medium); color: var(--text-muted); font-family: var(--font-sans); }
.stat-label svg { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; color: var(--gold-ink); }
.home-top { margin-bottom: var(--gap); }
a.card { color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--border-strong); }

/* Goal ring */
.goal-card { display: flex; align-items: center; gap: var(--space-5); }
.goal-ring { position: relative; flex: none; display: grid; place-items: center; }
.goal-pct { position: absolute; font-weight: var(--fw-semi); font-size: var(--fs-sm); }
.goal-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ring-track { fill: none; stroke: var(--accent-soft); }
.ring-fill { fill: none; stroke: var(--accent); stroke-linecap: round; }
.pace { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-muted); }
.pace.ahead { color: var(--success); }
@media (max-width: 479px) {
  .goal-card { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .goal-card .ring { width: 60px; height: 60px; }
}

/* Streak + heat strip */
.streak-card { display: flex; flex-direction: column; gap: 2px; }
.mini-strip { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; margin-top: auto; padding-top: 6px; }
.mini-strip .hc { width: auto; height: auto; aspect-ratio: 1; }
.mini-strip .hc.today { outline-offset: 0; }
.hc { display: block; width: var(--hc, 11px); height: var(--hc, 11px); border-radius: 2px; background: var(--surface-2); }
.hc.l0 { box-shadow: inset 0 0 0 1px var(--border); }
.hc.l1 { background: color-mix(in srgb, var(--accent) 28%, var(--surface-2)); }
.hc.l2 { background: color-mix(in srgb, var(--accent) 50%, var(--surface-2)); }
.hc.l3 { background: color-mix(in srgb, var(--accent) 74%, var(--surface-2)); }
.hc.l4 { background: var(--accent); }
.hc.today { outline: 1.5px solid var(--text); outline-offset: 1px; }
.hc.future { opacity: .35; }
.hc.pad { visibility: hidden; }

/* Today + sprints */
.today-card { display: flex; flex-direction: column; gap: 4px; }
.sprint-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.sprint-row .btn { padding: 0 10px; }

/* Quote of the day */
.quote-card { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.quote-card blockquote { margin: 0; font-family: var(--font-serif); font-style: italic; font-size: 14px; line-height: 1.4; }
@media (max-width: 899px) { .quote-card, .today-card { grid-column: span 2; } }

/* Currently reading */
.cr-list { display: flex; flex-direction: column; }
.cr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px var(--space-5); align-items: center; padding: var(--space-4) 0; border-top: 1px solid var(--border); }
.cr:first-child { border-top: 0; padding-top: 2px; }
.cr-cover { grid-row: span 2; }
.cr-cover .cover-sm { width: 40px; }
.cr-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cr-title { font-weight: var(--fw-semi); color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-title:hover { text-decoration: underline; }
.cr-meta { font-size: var(--fs-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-prog { display: flex; align-items: center; gap: 8px; margin: 3px 0 1px; }
.cr-prog .progress { flex: 1; }
.cr-pct { font-size: var(--fs-xs); font-weight: var(--fw-semi); min-width: 30px; text-align: right; }
.cr-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.cr-actions .btn { padding: 0 9px; }
.btn.icon-only { padding: 0; width: var(--btn-h-sm); }
.btn-finish { border-color: var(--success); color: var(--success); }
@media (max-width: 899px) {
  .cr { grid-template-columns: auto minmax(0, 1fr); }
  .cr-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .cr-actions .btn { height: 36px; flex: 1 1 auto; }
  .cr-actions .btn.icon-only { width: 40px; flex: 0 0 auto; }
}

/* Finish sheet */
.finish-lead { font-size: var(--fs-md); margin-bottom: var(--space-4); }
.fav-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: var(--btn-h); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface); font-weight: var(--fw-medium); }
.fav-toggle svg { width: 16px; height: 16px; }
.fav-toggle[aria-pressed="true"] { color: var(--rose); border-color: var(--rose); }
.fav-toggle[aria-pressed="true"] svg { fill: currentColor; }
.confetti { position: fixed; inset: 0; z-index: 200; pointer-events: none; width: 100vw; height: 100vh; }

/* Timer overlay */
.timer-overlay {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  padding: max(20px, env(safe-area-inset-top)) var(--gutter) max(20px, env(safe-area-inset-bottom));
  background: var(--bg); overflow-y: auto;
}
.timer-overlay::before { content: ""; position: absolute; inset: 0; background: url("../assets/textures/paper.svg"); opacity: var(--bg-texture-opacity); pointer-events: none; }
.timer-inner { position: relative; width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: var(--space-6); text-align: center; }
.timer-mode { font-size: var(--fs-sm); font-weight: var(--fw-semi); letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); }
.timer-book { display: flex; align-items: center; gap: var(--space-4); text-align: left; }
.timer-book strong { display: block; font-family: var(--font-serif); font-size: 16px; }
.timer-book small { color: var(--text-muted); }
.timer-dial { position: relative; width: min(72vw, 280px); aspect-ratio: 1; display: grid; place-items: center; }
.timer-dial svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.dial-track { fill: none; stroke: var(--accent-soft); stroke-width: 6; }
.dial-fill { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.timer-time { position: relative; z-index: 1; font-family: var(--font-serif); font-size: clamp(44px, 14vw, 64px); font-weight: 500; font-variant-numeric: tabular-nums; }
.breath { position: absolute; inset: 22%; border-radius: 50%; background: var(--accent-soft); opacity: .6; animation: breathe 8s ease-in-out infinite; }
.timer-overlay.paused .breath { animation-play-state: paused; }
.timer-overlay.paused .timer-time { opacity: .55; }
@keyframes breathe { 0%, 100% { transform: scale(.82); } 50% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .breath { animation: none; } .dial-fill { transition: none; } }
.timer-note { color: var(--text-muted); font-size: var(--fs-sm); min-height: 1.4em; }
.timer-actions { display: flex; gap: var(--space-4); }
.timer-actions .btn { height: 44px; padding: 0 20px; font-size: 14px; }
.timer-hide { color: var(--text-muted); }
html.timer-open, html.timer-open body { overflow: hidden; }
.timer-pill {
  position: fixed; z-index: 45; right: 12px;
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 10px);
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 0; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-ink);
  font-weight: var(--fw-semi); font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-lg);
}
.timer-pill svg { width: 16px; height: 16px; }
@media (min-width: 900px) { .timer-pill { bottom: 20px; right: 20px; } }
.pick-row { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }

/* Reading page */
.heat-card { margin: var(--gap) 0; }
.heat-card .card-head .row { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.month-name { min-width: 110px; text-align: center; font-weight: var(--fw-semi); }
.heat-year-wrap { --hc: 11px; overflow-x: auto; padding-bottom: 4px; }
@media (min-width: 900px) {
  /* laptop: the year fills the card width */
  .heat-year-wrap { --hc: minmax(0, 1fr); overflow: visible; }
  .heat-year-wrap .heat-year { width: 100%; aspect-ratio: var(--cols) / 7; grid-template-rows: repeat(7, minmax(0, 1fr)); }
  .heat-year-wrap .heat-year .hc { width: auto; height: auto; }
}
.heat-months { display: grid; gap: 3px; margin-bottom: 3px; font-size: 10px; color: var(--text-muted); }
.heat-months span { white-space: nowrap; }
.heat-year { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, var(--hc)); gap: 3px; width: max-content; }
.heat-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-width: 420px; }
.hm-head { font-size: 10px; text-align: center; color: var(--text-muted); font-weight: var(--fw-semi); }
.hm { display: grid; place-items: center; aspect-ratio: 1; border-radius: 6px; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; background: var(--surface-2); }
.hm.l0 { box-shadow: inset 0 0 0 1px var(--border); color: var(--text-muted); }
.hm.l1 { background: color-mix(in srgb, var(--accent) 28%, var(--surface-2)); }
.hm.l2 { background: color-mix(in srgb, var(--accent) 50%, var(--surface-2)); }
.hm.l3 { background: color-mix(in srgb, var(--accent) 74%, var(--surface-2)); color: var(--accent-ink); }
.hm.l4 { background: var(--accent); color: var(--accent-ink); font-weight: var(--fw-semi); }
.hm.today { outline: 2px solid var(--text); outline-offset: 1px; }
.hm.future { opacity: .4; }
.hm.pad { visibility: hidden; }
.heat-legend { display: flex; align-items: center; gap: 3px; margin-top: 8px; font-size: 10px; color: var(--text-muted); justify-content: flex-end; }
.heat-legend span { margin: 0 4px; }
.sess-day + .sess-day { margin-top: 8px; }
.sess-date { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 2px; }
.sess-row > svg:first-child { width: 16px; height: 16px; color: var(--gold-ink); }
.sess-row .grow > span { display: block; }
.key-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.key-list li, .key-big li { display: flex; align-items: center; gap: 10px; }
.tab { display: inline-block; flex: none; width: 26px; height: 14px; border-radius: 2px 6px 6px 2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.key-big { display: flex; flex-direction: column; gap: 14px; }
.key-big li { font-size: 22px; font-family: var(--font-serif); }
.key-big .tab { width: 56px; height: 30px; }
.key-edit { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.key-edit li { display: flex; gap: 6px; align-items: center; }
.key-edit .input { flex: 1; min-width: 0; }
.key-color { width: 108px; flex: none; border-left: 12px solid var(--tab); }

/* Stats page */
.year-pick .select { min-width: 92px; }
.stats-empty { margin-bottom: var(--gap); }
.stat-tiles { margin-bottom: var(--gap); }
.goal-row { display: flex; align-items: center; gap: var(--space-6); }
.goal-facts { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.goal-facts div { display: flex; flex-direction: column; }
.goal-facts dt { font-size: var(--fs-xs); color: var(--text-muted); }
.goal-facts dd { margin: 0; font-weight: var(--fw-semi); }
.records { margin: 0; display: flex; flex-direction: column; }
.records div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--border); }
.records div:first-child { border-top: 0; }
.records dt { color: var(--text-muted); font-size: var(--fs-sm); flex: none; }
.records dd { margin: 0; text-align: right; font-weight: var(--fw-medium); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.records a { color: inherit; }

/* Charts */
.chart { margin: 0; }
.cc-plot { position: relative; height: var(--h); margin: 14px 0 0 22px; border-bottom: 1px solid var(--border-strong); }
.cc-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--border); }
.cc-line span { position: absolute; right: calc(100% + 6px); top: -7px; font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cc-cols { position: absolute; inset: 0; display: grid; align-items: end; }
.cc-col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-radius: 4px; }
.cc-bar { position: relative; flex: none; display: block; width: min(24px, 62%); border-radius: 4px 4px 0 0; background: var(--accent); min-height: 2px; }
.cc-col:hover .cc-bar, .cc-col:focus-visible .cc-bar { background: var(--accent-hover); }
.cc-col:focus-visible { outline-offset: 0; }
.cc-cap { position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: var(--fw-semi); }
.cc-x { display: grid; margin-left: 22px; padding-top: 4px; font-size: 10px; color: var(--text-muted); text-align: center; }
.cc-x .now { color: var(--text); font-weight: var(--fw-semi); }
.barlist { display: flex; flex-direction: column; gap: 7px; }
.barlist li { display: grid; grid-template-columns: minmax(70px, 38%) 1fr auto; align-items: center; gap: 8px; font-size: var(--fs-sm); border-radius: 4px; }
.barlist li:focus-visible { outline-offset: 2px; }
.bl-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-track { height: 10px; }
.bl-bar { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.barlist li:hover .bl-bar { background: var(--accent-hover); }
.bl-val { font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; min-width: 18px; text-align: right; }
.chart-donut { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; }
.chart-donut svg { width: 120px; height: 120px; }
.chart-donut .seg { stroke: none; }
.chart-donut .seg:hover, .chart-donut .seg:focus { opacity: .85; outline: none; }
.donut-v { fill: var(--text); font-size: 20px; font-weight: 600; font-family: var(--font-sans); }
.donut-l { fill: var(--text-muted); font-size: 10px; font-family: var(--font-sans); }
.legend { display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-sm); min-width: 0; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend .key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lg-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-val { color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: var(--fs-xs); }
.chart-donut .table-view { grid-column: 1 / -1; }
.table-view { margin-top: 6px; font-size: var(--fs-xs); }
.table-view summary { cursor: pointer; color: var(--text-muted); width: max-content; padding: 2px 0; }
.table-view table { width: 100%; border-collapse: collapse; margin-top: 4px; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { padding: 3px 6px; border-top: 1px solid var(--border); text-align: left; font-weight: 400; }
.table-view thead th { color: var(--text-muted); font-weight: var(--fw-semi); border-top: 0; }
.chart-tip {
  position: fixed; z-index: 150; pointer-events: none;
  display: flex; flex-direction: column; gap: 1px;
  padding: 6px 9px; border-radius: 8px;
  background: var(--text); color: var(--bg);
  font-size: var(--fs-xs); box-shadow: var(--shadow-lg);
}
.chart-tip strong { font-size: var(--fs-sm); }
.chart-tip span { opacity: .8; }

/* =========================================================
   Phase 5 — TBR jar, wishlist & releases, loans & ARCs, budget
   ========================================================= */
.grid-2-lg { grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2-lg { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tbr-body > * + *, .tbr-body .grid + .card, .tbr-body .grid + .grid { margin-top: var(--gap); }

/* Tabs */
.tabs { display: flex; gap: 4px; margin: 0 calc(var(--gutter) * -1) var(--space-5); padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.tabs::-webkit-scrollbar { display: none; }
.tab-link {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 40px; padding: 0 12px;
  color: var(--text-muted); text-decoration: none; font-weight: var(--fw-medium); font-size: var(--fs-sm);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-link svg { width: 16px; height: 16px; }
.tab-link[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: var(--fw-semi); }
@media (min-width: 900px) { .tabs { margin-left: 0; margin-right: 0; padding: 0; } }

/* Jar */
.jar-wrap { display: flex; gap: var(--space-5); align-items: center; }
.jar { flex: none; width: 118px; }
.jar-svg { width: 100%; height: auto; overflow: visible; }
.jar-lid { fill: var(--accent); }
.jar-lid-band { fill: var(--gold); }
.jar-glass { fill: color-mix(in srgb, var(--surface-2) 55%, transparent); stroke: var(--border-strong); stroke-width: 2.5; }
.jar-shine { fill: none; stroke: #fff; stroke-opacity: .45; stroke-width: 5; stroke-linecap: round; }
.jar-label { fill: var(--surface); stroke: var(--border-strong); }
.jar-label-text { fill: var(--text); font: 600 12px var(--font-serif); letter-spacing: .08em; }
.jar-side { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; flex: 1; }
.jar-filters { display: grid; grid-template-columns: 1fr; gap: 6px; }
.jar-filter .select { width: 100%; max-width: none; }
@media (prefers-reduced-motion: no-preference) {
  .jar.shake { animation: jar-shake .6s var(--ease); transform-origin: 50% 90%; }
}
@keyframes jar-shake { 15% { transform: rotate(-7deg); } 35% { transform: rotate(6deg); } 55% { transform: rotate(-4deg); } 75% { transform: rotate(2deg); } }

.drawn-card { display: flex; align-items: center; min-height: 190px; }
@media (max-width: 899px) { .drawn-card:not(.has-pick) { min-height: 0; } }
.drawn-empty { max-width: 46ch; }
.slip-title { font-family: var(--font-serif); font-size: 20px; font-weight: var(--fw-semi); line-height: 1.2; margin: 2px 0 4px; }
.slip-open { display: flex; gap: var(--space-6); align-items: center; width: 100%; }
.slip-open .cover-md { width: 108px; flex: none; }
.slip-text { min-width: 0; }
@media (prefers-reduced-motion: no-preference) {
  .has-pick .slip-open { animation: unfold .5s var(--ease); transform-origin: 50% 0; }
}
@keyframes unfold { from { transform: perspective(600px) rotateX(-70deg); opacity: 0; } }
@media (max-width: 599px) { .slip-open .cover-md { width: 84px; } .slip-title { font-size: 18px; } }

/* Mood picker & lists */
.pick-row2 { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-4); }
.picks { margin-top: var(--space-4); }
.pick, .tbr-row, .rel-row, .wish-row, .due-row, .buy-row { display: flex; align-items: center; gap: var(--space-3); border-top: 1px solid var(--border); flex-wrap: wrap; }
.pick:first-child, .tbr-row:first-child, .rel-row:first-child, .wish-row:first-child, .due-row:first-child, .buy-row:first-child { border-top: 0; }
.pick > .list-row, .tbr-row > .list-row, .rel-row > .list-row, .wish-row > .list-row, .due-row > .list-row, .buy-row > .list-row { flex: 1 1 220px; border-top: 0; min-width: 0; }
.list-row .grow > .title, .list-row .grow > .meta { display: block; }
.pick-tags { display: flex; gap: 4px; }
.in-out { display: flex; justify-content: space-around; margin: 10px 0 4px; font-size: var(--fs-sm); color: var(--text-muted); }
.in-out strong { color: var(--text); font-size: 16px; }

/* Hype */
.hype { display: inline-flex; flex: none; }
.hype-btn { width: 28px; height: 32px; padding: 0; border: 0; background: none; font-size: 15px; filter: grayscale(1); opacity: .3; transition: opacity var(--dur-fast), filter var(--dur-fast); }
.hype-btn.on { filter: none; opacity: 1; }
.hype-btn:hover { opacity: .7; }
.hype-ro { letter-spacing: -2px; }
.hype-line { align-items: center; gap: 8px; }

/* Releases & wishlist */
.rel-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); }
.countdown { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--gold-ink); flex: none; }
.badge-out {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-ink); font-size: var(--fs-xs); font-weight: var(--fw-semi);
}
.next-release { display: flex; gap: var(--space-5); align-items: center; }
.next-release .cover-md { width: 84px; flex: none; }
.big-count { font-family: var(--font-serif); font-size: 40px; font-weight: var(--fw-semi); line-height: 1; }
.next-title { font-weight: var(--fw-semi); margin-top: 6px; }

/* Loans & ARCs */
.due-info { display: flex; flex-direction: column; flex: none; min-width: 120px; }
.due-text { font-size: var(--fs-sm); font-weight: var(--fw-semi); }
.due-row.soon .due-text { color: var(--gold-ink); }
.due-row.overdue .due-text { color: var(--danger); }
.sub-set { padding: var(--space-4); border-radius: var(--radius-sm); background: var(--surface-2); }
.sub-set legend { display: flex; align-items: center; gap: 4px; float: left; width: 100%; margin-bottom: 8px; }
.sub-set legend svg { width: 14px; height: 14px; }
.sub-set .opt { margin-top: 8px; }

/* Budget & ban */
.budget-row { display: flex; gap: var(--space-7); align-items: center; flex-wrap: wrap; }
.budget-meter { flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; }
.meter { height: 12px; border-radius: var(--radius-pill); background: var(--accent-soft); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.meter.over span { background: var(--gold); }
.over-text { color: var(--gold-ink); }
.bvr { display: flex; gap: var(--space-7); }
.bvr > div { display: flex; flex-direction: column; }
.buy-price { font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; }
.ban-count { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }

/* Home additions */
.home-tbr { margin-top: var(--gap); }
.coming-row .coming-when { flex: none; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-muted); text-align: right; max-width: 45%; }
.coming-row.soon .coming-when { color: var(--gold-ink); }
.coming-row.overdue .coming-when { color: var(--danger); }
a.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* =========================================================
   Phase 6 — challenges, series, book club
   ========================================================= */
.home-tbr { grid-template-columns: 1fr; }
@media (min-width: 600px) { .home-tbr { grid-template-columns: repeat(2, minmax(0, 1fr)); } .home-tbr > .span-2 { grid-column: 1 / -1; } }
@media (min-width: 1100px) { .home-tbr { grid-template-columns: repeat(4, minmax(0, 1fr)); } .home-tbr > .span-2 { grid-column: span 2; } }
.ch-rows { display: flex; flex-direction: column; gap: 6px; }
.ch-rows li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: var(--fs-sm); }
.ch-rows .meter { grid-column: 1 / -1; }
.ch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-val { font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; }
.meter.thin { height: 5px; }

.goal-strip { display: flex; align-items: center; gap: var(--space-5); margin-bottom: var(--space-5); padding-top: 8px; padding-bottom: 8px; }
.goal-strip p { margin-top: 2px; }
.board-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-5); }
.add-chip { display: inline-flex; align-items: center; gap: 4px; border-style: dashed; }
.add-chip svg { width: 14px; height: 14px; }
.ch-body > .grid + .card, .ch-body > .card + .card { margin-top: var(--gap); }

/* Bingo board */
.bingo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sq {
  position: relative; aspect-ratio: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center; padding: 6px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
  font-size: 12px; line-height: 1.2; text-align: center; overflow: hidden; color: var(--text);
}
button.sq { cursor: pointer; }
button.sq:hover { border-color: var(--accent); }
.sq-label { position: relative; z-index: 1; overflow-wrap: anywhere; }
.sq-auto { position: absolute; top: 3px; right: 5px; font-size: 10px; opacity: .8; }
.sq.free { background: var(--accent-soft); flex-direction: column; font-family: var(--font-serif); font-weight: var(--fw-semi); letter-spacing: .08em; }
.sq.free small { color: var(--gold-ink); font-size: 16px; }
.sq.done { border-color: var(--accent); background: var(--accent-soft); }
.sq-cover { position: absolute; top: 4px; left: 4px; z-index: 2; }
.sq-cover .cover { width: 18px; }
.sq.done { padding-top: 14px; }
.sq.done .sq-label { font-weight: var(--fw-semi); }
.sq-check { position: absolute; z-index: 2; bottom: 4px; right: 4px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.sq.line { box-shadow: inset 0 0 0 2px var(--gold); }
.sq.editing { border-style: dashed; }
@media (max-width: 599px) { .bingo-grid { gap: 4px; } .sq, .sq.done { font-size: 10px; padding: 3px; border-radius: 7px; } .sq-auto, .sq-cover { display: none; } }
@media (min-width: 900px) { .bingo-grid { max-width: 440px; margin: 0 auto; } }
@media (min-width: 1100px) { .sq { font-size: 12px; } }
.bingo-side .big-count small { font-size: 16px; }

/* Prompt list */
.prompt-list { margin-top: var(--space-5); display: flex; flex-direction: column; }
.prompt-row { display: flex; align-items: center; gap: var(--space-3); border-top: 1px solid var(--border); min-height: 44px; }
.prompt-row:first-child { border-top: 0; }
.p-num { width: 24px; flex: none; text-align: right; font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.p-main { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 4px; border: 0; background: none; text-align: left; color: inherit; border-radius: 6px; }
.p-main:hover { background: var(--surface-2); }
.p-label { min-width: 0; }
.prompt-row.done .p-label { color: var(--text-muted); }
.p-book { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: var(--fw-medium); max-width: 50%; flex: none; }
.p-book span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-pick { font-size: var(--fs-xs); color: var(--accent); font-weight: var(--fw-semi); flex: none; }
.p-check { color: var(--success); font-weight: 700; flex: none; }
@media (max-width: 599px) { .p-main { flex-direction: column; align-items: flex-start; gap: 4px; } .p-book { max-width: 100%; } }

/* A–Z */
.az-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
@media (max-width: 599px) { .az-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.az { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 92px; padding: 6px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--text-muted); text-decoration: none; text-align: center; }
.az.done { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.az-l { font-family: var(--font-serif); font-size: 20px; font-weight: var(--fw-semi); line-height: 1; }
.az.done .az-l { color: var(--gold-ink); }
.az-t { font-size: 10px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.az-count { color: var(--text); }

/* Series */
.series-grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 900px) { .series-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1300px) { .series-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.series-card .meter { margin: 6px 0 8px; height: 8px; }
.series-card.complete { border-color: var(--success); }
.series-books { display: flex; flex-direction: column; }
.series-books a { display: flex; align-items: center; gap: 8px; min-height: 34px; color: inherit; text-decoration: none; border-top: 1px solid var(--border); }
.series-books li:first-child a { border-top: 0; }
.s-num { width: 22px; flex: none; font-family: var(--font-serif); font-weight: var(--fw-semi); color: var(--gold-ink); text-align: center; }
.s-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.s-more { padding: 6px 0 0 30px; }
.series-foot { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: var(--fs-sm); }
.series-foot .countdown svg { width: 13px; height: 13px; display: inline; vertical-align: -2px; }
.chip.status-tbr { background: var(--surface-2); }

/* Dialog bits */
.tpl-list { display: flex; flex-direction: column; gap: 6px; }
.tpl { position: relative; display: block; }
.tpl input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tpl span { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); }
.tpl small { color: var(--text-muted); font-size: var(--fs-xs); }
.tpl input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.tpl input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.current-pick { display: flex; gap: 12px; align-items: center; padding: 10px; margin-bottom: 10px; border-radius: var(--radius); background: var(--surface-2); }
.current-pick .title { font-weight: var(--fw-semi); margin-bottom: 6px; }
.pick-list { margin: 4px 0 10px; }
.offer + .offer { margin-top: 12px; }
.offer legend { display: flex; align-items: center; gap: 6px; }
.offer legend svg { width: 14px; height: 14px; }
.offer-opts { display: flex; flex-direction: column; gap: 4px; }
.offer-opt { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 8px; border-radius: var(--radius-sm); flex-wrap: wrap; }
.offer-opt.match { background: var(--accent-soft); }
.offer-opt input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.bf-hue { flex: 1 1 140px; }

/* Book club */
.club-grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 800px) { .club-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1250px) { .club-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.club-card { display: flex; flex-direction: column; gap: 10px; }
.club-top { display: flex; gap: 12px; align-items: flex-start; }
.club-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--gold-ink); flex: none; }
.club-icon svg { width: 20px; height: 20px; }
.club-name { font-family: var(--font-serif); font-size: 17px; font-weight: var(--fw-semi); }
.club-next { display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-sm); padding-top: 8px; border-top: 1px solid var(--border); }
.club-next svg { width: 13px; height: 13px; display: inline; vertical-align: -2px; color: var(--gold-ink); }
.club-hero { display: flex; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap; align-items: center; margin-bottom: var(--gap); }
.members { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.member { height: 28px; padding-right: 2px; font-size: var(--fs-sm); }
.add-member { display: inline-flex; gap: 4px; }
.add-member .input { width: 140px; }
.club-book { display: flex; gap: 12px; color: inherit; text-decoration: none; }
.club-book .cover-md { width: 72px; flex: none; }
.club-book > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cp-list { display: flex; flex-direction: column; margin-bottom: 4px; }
.cp { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); min-height: 38px; }
.cp:first-child { border-top: 0; }
.cp-check { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; cursor: pointer; }
.cp-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.cp.done .cp-check span { text-decoration: line-through; color: var(--text-muted); }
.cp-add .input-sm { width: 140px; flex: none; }
.q-list { margin: 0 0 4px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.q-list li { padding-left: 2px; }
.q-list li > span { display: inline; }
.q-list li { position: relative; padding-right: 32px; }
.q-list .icon-btn { position: absolute; right: 0; top: -6px; }
.meet-list { display: flex; flex-direction: column; gap: 12px; }
.meet { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.meet:first-child { border-top: 0; padding-top: 0; }
.meet-head { display: flex; align-items: center; gap: 10px; }
.meet-head .icon-btn { margin-left: auto; }

/* =========================================================
   Phase 7 — shelf, top 9, bracket, Wrapped, share
   ========================================================= */
.shelf-body > * + * { margin-top: var(--gap); }
.bookcase { padding: 6px 4px 0; }
.shelf-row { display: flex; align-items: flex-end; gap: 2px; height: 170px; padding: 0 6px; }
.shelf-row.flip { flex-direction: row; }
.plank { height: 16px; margin-bottom: 18px; border-radius: 3px; background: linear-gradient(180deg, var(--wood-light) 0 3px, var(--wood) 3px 11px, var(--wood-dark) 11px); box-shadow: 0 6px 10px -6px rgba(0,0,0,.35); }
.spine-link { display: block; flex: none; transition: transform var(--dur) var(--ease); border-radius: 2px; }
.spine-link:hover, .spine-link:focus-visible { transform: translateY(-8px); }
.spine { display: block; }
.orn-wrap { flex: none; width: 54px; margin: 0 0 0 10px; }
.shelf-row.flip .orn-wrap { margin: 0 10px 0 0; }
.shelf-card .card-head { flex-wrap: wrap; }
@media (max-width: 599px) { .shelf-card .card-head > .row { width: 100%; } .shelf-card .seg { flex: 1; } .shelf-card .seg button { flex: 1; padding: 0 6px; } }
.orn { width: 54px; height: 108px; display: block; }
.orn .leaf { fill: var(--plant); }
.orn .stem { stroke: var(--plant); stroke-width: 2; }
.orn .pot { fill: var(--pot); }
.orn .pot-rim { fill: var(--wood-dark); }
.orn .wax { fill: var(--wax); stroke: var(--border-strong); }
.orn .drip { fill: none; stroke: var(--border-strong); stroke-width: 1.5; }
.orn .wick { stroke: var(--text); stroke-width: 1.5; }
.orn .flame { fill: var(--flame); transform-origin: 30px 46px; }
.orn .dish { fill: var(--gold); }
.orn .b1 { fill: var(--accent); } .orn .b2 { fill: var(--gold); } .orn .b3 { fill: var(--rose); }
.orn .moon { fill: var(--gold); }
@media (prefers-reduced-motion: no-preference) { .orn .flame { animation: flicker 2.4s ease-in-out infinite; } }
@keyframes flicker { 50% { transform: scale(.88, 1.06); } }

.top9 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 420px; margin: 0 auto; }
@media (min-width: 900px) { .top9 { max-width: 330px; } }
.top9 a, .top9-empty { position: relative; display: block; }
.top9 .cover-md { width: 100%; }
.top9-empty { aspect-ratio: 2 / 3; border: 1px dashed var(--border-strong); border-radius: 6px; }
.top9-n { position: absolute; z-index: 2; top: 4px; left: 4px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.pick9 { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.pick9-btn { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-align: left; font-size: var(--fs-sm); }
.pick9-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.pick9-n { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.pick9-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.champion-card { display: flex; align-items: center; gap: var(--space-6); position: relative; }
.champion-card .cover-md { width: 96px; flex: none; }
.crown { position: absolute; top: -14px; left: 20px; font-size: 26px; }
.bracket { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .bracket { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: center; } }
.b-round { display: flex; flex-direction: column; gap: 10px; justify-content: space-around; }
.b-round-name { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.b-match { display: flex; flex-direction: column; gap: 2px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.b-match.done { border-color: var(--accent); }
.vs { font-size: 10px; color: var(--text-muted); text-align: center; }
.entrant { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 6px; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--surface); text-align: left; font-size: var(--fs-sm); width: 100%; }
.entrant:hover:not(:disabled) { border-color: var(--accent); }
.entrant.won { border-color: var(--accent); font-weight: var(--fw-semi); }
.entrant.lost { opacity: .7; }
.entrant.tbd { color: var(--text-muted); font-style: italic; }
.e-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-tick { color: var(--success); font-weight: 700; }

/* Wrapped slides */
.wrapped { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.w-track { display: flex; gap: 16px; width: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px 0 8px; }
.w-track::-webkit-scrollbar { display: none; }
.w-slide { flex: 0 0 min(100%, 360px); scroll-snap-align: center; aspect-ratio: 9 / 16; max-height: 68vh; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 28px 22px; text-align: center;
  border: 1px solid var(--border); border-radius: 20px; background: radial-gradient(circle at 85% 12%, var(--accent-soft) 0 28%, transparent 29%), radial-gradient(circle at 10% 90%, var(--accent-soft) 0 20%, transparent 21%), var(--surface); box-shadow: var(--shadow); position: relative; }
@media (min-width: 900px) { .w-track { padding-left: calc(50% - 180px); padding-right: calc(50% - 180px); } .w-slide { flex-basis: 360px; } }
.w-kicker { font-size: var(--fs-xs); font-weight: var(--fw-semi); letter-spacing: .1em; text-transform: uppercase; color: var(--gold-ink); }
.w-big { font-family: var(--font-serif); font-size: 64px; font-weight: var(--fw-semi); line-height: 1; overflow-wrap: anywhere; }
.w-big.long { font-size: 34px; line-height: 1.1; }
.w-title { font-family: var(--font-serif); font-size: 20px; font-weight: var(--fw-semi); line-height: 1.2; }
.w-line { color: var(--text-muted); font-size: var(--fs-sm); }
.w-books { display: grid; gap: 8px; width: 100%; justify-items: center; }
.w-books.n1 { grid-template-columns: 110px; justify-content: center; }
.w-books.n2 { grid-template-columns: repeat(2, 90px); justify-content: center; }
.w-books.n3 { grid-template-columns: repeat(3, 76px); justify-content: center; }
.w-books .cover-md { width: 100%; }
.w-mark { position: absolute; bottom: 12px; font-size: 10px; color: var(--text-muted); font-family: var(--font-serif); }
.w-controls { display: flex; align-items: center; gap: 10px; }
.w-dots { display: flex; gap: 6px; }
.w-dot { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%; background: var(--border-strong); }
.w-dot[aria-selected="true"] { background: var(--accent); width: 22px; border-radius: 5px; }
.w-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.month-preview { display: flex; flex-direction: column; align-items: center; }
.month-preview .w-slide { flex: none; width: 100%; max-width: 300px; }
.mw-tiles .stat { padding: 8px 0; }
.share-preview { display: block; width: 100%; max-height: 60vh; object-fit: contain; border-radius: 10px; }
.btn.busy { opacity: .6; cursor: progress; }
.page-turn {
  position: fixed; z-index: 160; pointer-events: none;
  width: 22px; height: 28px; border-radius: 1px 4px 4px 1px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong); box-shadow: 0 2px 6px rgba(0,0,0,.15);
  transform-origin: 0 50%;
  animation: page-turn .65s var(--ease) forwards;
}
@keyframes page-turn {
  0% { transform: perspective(120px) rotateY(0); opacity: 1; }
  70% { transform: perspective(120px) rotateY(-170deg) translateY(-6px); opacity: 1; }
  100% { transform: perspective(120px) rotateY(-180deg) translateY(-14px); opacity: 0; }
}

/* v1.0.1 small fixes */
.in-out { flex-wrap: wrap; row-gap: 2px; }
.in-out > .small { flex-basis: 100%; text-align: center; font-size: var(--fs-xs); }
.chart-donut .donut-note { grid-column: 1 / -1; margin-top: -2px; }
