/* Cozy Libram — theming via data-theme + data-accent on <html> */
:root, [data-theme="dark"] {
  --bg: #14101a;
  --bg2: #1d1526;
  --card: #241a30;
  --card2: #2c2040;
  --ink: #f3e9f5;
  --muted: #b9a8c4;
  --faint: #7d6b8a;
  --accent: #e5488f;
  --accent-deep: #c2377a;
  --gold: #d4a24e;
  --line: #3a2b4d;
  --ok: #7bc98a;
  --danger: #e56b6b;
  --nav-bg: rgba(20, 16, 26, 0.92);
  --glow: #2b1b3d;
  --radius: 14px;
  --nav-h: 68px;
}
[data-theme="light"] {
  --bg: #faf5ec;
  --bg2: #f0e7d5;
  --card: #fffdf7;
  --card2: #f6eedd;
  --ink: #2c2333;
  --muted: #6f5f78;
  --faint: #a08fa9;
  --accent: #e5488f;
  --accent-deep: #c2377a;
  --gold: #a87b24;
  --line: #e2d4bd;
  --ok: #3e8e52;
  --danger: #c64f4f;
  --nav-bg: rgba(250, 245, 236, 0.94);
  --glow: #f0dfc2;
}
[data-theme="hearthside"] {
  --bg: #17100a;
  --bg2: #201410;
  --card: #2a1a12;
  --card2: #352216;
  --ink: #f6e9d6;
  --muted: #c7a684;
  --faint: #8d6f52;
  --accent: #e5488f;
  --accent-deep: #c2377a;
  --gold: #d9a44f;
  --line: #453020;
  --ok: #7bc98a;
  --danger: #e56b6b;
  --nav-bg: rgba(23, 16, 10, 0.92);
  --glow: #3a2415;
}
[data-theme="candlelight"] {
  --bg: #f7efdc;
  --bg2: #eee1c6;
  --card: #fffaf0;
  --card2: #f6ebd2;
  --ink: #332619;
  --muted: #77603f;
  --faint: #ab9573;
  --accent: #e5488f;
  --accent-deep: #c2377a;
  --gold: #a87b24;
  --line: #e3d2ac;
  --ok: #3e8e52;
  --danger: #c64f4f;
  --nav-bg: rgba(247, 239, 220, 0.94);
  --glow: #ecdcae;
}
[data-theme="twilight"] {
  --bg: #0e1120;
  --bg2: #141a2e;
  --card: #1a2138;
  --card2: #222b46;
  --ink: #e9ebf7;
  --muted: #a4aac9;
  --faint: #6e7492;
  --accent: #e5488f;
  --accent-deep: #c2377a;
  --gold: #d4a24e;
  --line: #2b3352;
  --ok: #7bc98a;
  --danger: #e56b6b;
  --nav-bg: rgba(14, 17, 32, 0.92);
  --glow: #1c2342;
}
[data-theme="verdant"] {
  --bg: #0d140e;
  --bg2: #121b13;
  --card: #172419;
  --card2: #1e2f21;
  --ink: #eaf3e5;
  --muted: #a5bda1;
  --faint: #70876f;
  --accent: #e5488f;
  --accent-deep: #c2377a;
  --gold: #d4a24e;
  --line: #293b2a;
  --ok: #7bc98a;
  --danger: #e56b6b;
  --nav-bg: rgba(13, 20, 14, 0.92);
  --glow: #1a2a1c;
}
/* accent overrides (rose is the default, defined above) */
[data-accent="violet"] { --accent: #8b5cf6; --accent-deep: #6d3fd4; }
[data-accent="gold"] { --accent: #c08a24; --accent-deep: #96690f; }
[data-accent="teal"] { --accent: #2fa39a; --accent-deep: #1f7a74; }
[data-accent="crimson"] { --accent: #d43a55; --accent-deep: #a11f3c; }
[data-accent="ember"] { --accent: #e0722a; --accent-deep: #b0511a; }
[data-accent="ocean"] { --accent: #3f8fd6; --accent-deep: #2a6aa8; }
[data-accent="sage"] { --accent: #8aa864; --accent-deep: #687f4b; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(120% 60% at 50% -10%, var(--glow) 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  min-height: 100vh;
}

h1, h2, h3, .serif { font-family: 'Playfair Display', Georgia, serif; }

/* ---------- header ---------- */
.app-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px 6px;
  text-align: center;
}
.app-header .brand { min-width: 0; text-align: center; }
.app-header h1 {
  margin: 0;
  font-size: 26px;
  font-style: italic;
  letter-spacing: 0.5px;
  background: linear-gradient(100deg, var(--accent), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.app-header .tagline {
  margin: 1px 0 0;
  color: var(--faint);
  font-size: 12px;
}

/* account menu button, top right — out of the flex flow so the title stays centered */
.topbar-menu-wrap { position: absolute; top: 14px; right: 16px; }
.menu-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  cursor: pointer; padding: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.menu-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu-avatar-img.letter {
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  text-transform: uppercase;
}
.menu-avatar-img.letter.dim { font-size: 20px; background: var(--card2); }
.menu-pop {
  position: absolute; top: calc(100% + 8px); right: 0;
  z-index: 130; min-width: 200px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.menu-pop .menu-email {
  padding: 8px 12px 10px; font-size: 12px; color: var(--faint);
  border-bottom: 1px solid var(--line); margin-bottom: 4px;
  word-break: break-all;
}
.menu-pop button {
  display: flex; width: 100%; gap: 10px; align-items: center;
  background: none; border: none; color: inherit; font: inherit;
  padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: 15px;
}
.menu-pop button:active { background: var(--card2); }
.menu-pop .mi { width: 22px; text-align: center; }
.menu-pop .mi .ticon { width: 18px; height: 18px; }

/* profile view */
.pf-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px; margin-top: 12px;
}
.pf-avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.pf-avatar {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  border: 2px solid var(--accent); background: var(--card2);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 700; color: #fff; text-transform: uppercase;
}
.pf-avatar.letter { background: linear-gradient(135deg, var(--accent), var(--gold)); }
.pf-picker { margin: 4px 0 14px; }
.pf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pf-pick {
  aspect-ratio: 1; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid transparent; background: var(--card2); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.pf-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-pick.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.pf-upload { font-size: 26px; }
.pf-letter {
  font-size: 28px; font-weight: 700; color: #fff; text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
}

/* ---------- views ---------- */
#view { max-width: 560px; margin: 0 auto; padding: 6px 14px 24px; }

.toolbar { display: flex; gap: 8px; margin: 10px 0 12px; }
.search {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
}
.search:focus { border-color: var(--accent); }
.search::placeholder { color: var(--faint); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---------- book cards ---------- */
.grid { display: flex; flex-direction: column; gap: 12px; }
.book-card {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.book-card:active { transform: scale(0.985); }
.cover-wrap {
  flex: 0 0 64px;
  width: 64px; height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(140deg, var(--card2), var(--bg2));
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-meta { flex: 1; min-width: 0; }
.book-meta h3 { margin: 0 0 2px; font-size: 16px; line-height: 1.25; }
.book-meta .author { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge.status-tbr { border-color: var(--gold); color: var(--gold); }
.badge.status-reading { border-color: #6aa8e5; color: #6aa8e5; }
.badge.status-read { border-color: var(--ok); color: var(--ok); }
.badge.status-dnf { border-color: var(--danger); color: var(--danger); }
.badge.spice { border-color: var(--accent); color: var(--accent); }

.empty {
  text-align: center;
  color: var(--faint);
  padding: 48px 20px;
}
.empty .big { font-size: 44px; margin-bottom: 10px; }
.empty p { margin: 6px 0 18px; }

/* ---------- buttons / inputs ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(100deg, var(--accent), var(--accent-deep));
  color: #fff;
}
.btn.ghost { background: var(--bg2); border: 1px solid var(--line); color: var(--ink); }
.btn.small { padding: 8px 16px; font-size: 13px; }
.btn.danger { background: var(--bg2); border: 1px solid var(--danger); color: var(--danger); }
.btn.block { display: block; width: 100%; margin: 10px 0; }
.btn:disabled { opacity: 0.5; }

.field { margin: 14px 0; }
.field label { display: block; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.text-input, textarea.text-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.text-input:focus { border-color: var(--accent); }
textarea.text-input { min-height: 90px; resize: vertical; }

/* segmented status control */
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg button {
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--muted);
  border-radius: 10px;
  padding: 10px 4px;
  font-size: 12px;
  cursor: pointer;
}
.seg button.active { border-color: var(--accent); color: #fff; background: var(--accent); font-weight: 600; }

/* chili + star pickers */
.picker { display: flex; gap: 6px; }
.picker button {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 20px;
  padding: 8px 10px;
  cursor: pointer;
  filter: grayscale(1);
  opacity: 0.45;
}
.picker button.on { filter: none; opacity: 1; border-color: var(--accent); }

/* ---------- add view ---------- */
.tabs { display: flex; gap: 8px; margin: 10px 0 16px; }
.tabs button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--muted);
  border-radius: 12px;
  padding: 11px 4px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.tabs button.active { border-color: var(--accent); color: #fff; background: var(--accent); }

.scan-box {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  position: relative;
  aspect-ratio: 4/3;
}
.scan-box video, .scan-box canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-hint {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px;
  font-size: 13px; text-align: center;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: #fff;
}
.result-card {
  display: flex; gap: 12px;
  background: var(--card2);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px; margin-top: 14px;
}
.result-card .book-meta h3 { font-size: 15px; }

.search-row { display: flex; gap: 8px; }
.search-row .text-input { flex: 1; }

/* ---------- modal (bottom sheet) ---------- */
#modal-root:empty { display: none; }
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(8, 5, 12, 0.7);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 600px) { .modal-backdrop { align-items: center; } }
.modal {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideup 0.22s ease;
}
@media (min-width: 600px) { .modal { border-bottom: 1px solid var(--line); border-radius: 20px; } }
@keyframes slideup { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; gap: 14px; margin-bottom: 6px; }
.modal-head .cover-wrap { flex-basis: 84px; width: 84px; height: 126px; }
.modal-head h2 { margin: 0 0 4px; font-size: 20px; line-height: 1.25; }
.modal-head .author { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.pub-rating { color: var(--gold); font-size: 13px; }
.desc {
  font-size: 13.5px; color: var(--muted);
  max-height: 120px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
  margin: 12px 0 4px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.modal-close {
  position: sticky; top: 0; float: right;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 16px; cursor: pointer; z-index: 2;
}

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.bottom-nav button {
  flex: 1;
  background: none; border: none; color: var(--faint);
  font-size: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  cursor: pointer;
}
.bottom-nav button span { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; }
.bottom-nav button svg { width: 23px; height: 23px; flex: none; }
.bottom-nav button.active { color: var(--accent); }

/* ---------- backup view ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 20px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 6px; text-align: center;
}
.stat .n { font-family: 'Playfair Display', serif; font-size: 24px; color: var(--gold); }
.stat .l { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; }
.note { font-size: 13px; color: var(--faint); margin: 12px 0; }
h2.section { font-size: 20px; margin: 18px 0 6px; font-style: italic; }

/* ---------- toast ---------- */
#toast-root {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 16px);
  display: flex; justify-content: center; z-index: 99; pointer-events: none;
  padding: 0 16px;
}
.toast {
  background: var(--card2);
  border: 1px solid var(--accent);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14px;
  animation: slideup 0.2s ease;
  max-width: 100%;
}

/* ================= spiced-up bits (v1.1) ================= */

/* shimmering header */
.app-header { position: relative; }
.app-header h1 {
  background: linear-gradient(100deg, var(--accent) 20%, var(--gold) 40%, var(--accent) 60%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 8s linear infinite;
}
@keyframes shimmer { to { background-position: 220% center; } }
.app-header::after {
  content: '❦';
  flex-basis: 100%;
  color: var(--accent-deep);
  opacity: 0.55;
  font-size: 15px;
  margin-top: 6px;
  letter-spacing: 12px;
  text-indent: 12px;
}

/* list/grid toggle */
.view-toggle {
  flex: 0 0 auto;
  display: flex;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.view-toggle button {
  border: none; background: none; color: var(--faint);
  font-size: 15px; padding: 7px 11px; border-radius: 999px; cursor: pointer;
}
.view-toggle button.active { background: var(--card2); color: var(--ink); }

/* staggered entrance */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.rise { animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) both; animation-delay: var(--d, 0ms); }

/* Bookmory-style cover grid (v57): tall rounded dark cards, cover up top in a
   fixed 2:3 box, title below. The box is sized by aspect-ratio alone and the
   image is absolutely positioned, so tall phone photos can never stretch it. */
.book-grid {
  /* v58: fluid columns — tiles stay a comfortable ~110–160px whether the
     viewport is a 360px phone or a zoomed-out desktop-width WebView. */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px 10px;
}
.book-tile {
  cursor: pointer;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 10px 12px;
  transition: transform 0.15s ease;
}
.book-tile:active { transform: scale(0.97); }
.book-tile .bt-cover {
  /* v57-tile: single-mechanism 2:3 box */
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(140deg, var(--card2), var(--bg2));
}
.book-tile .bt-cover img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.book-tile .bt-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.book-tile .bt-title {
  font-size: clamp(11px, 3vw, 13px); font-weight: 600; color: var(--ink);
  margin: 10px 2px 0; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* stats view */
.dist { margin: 4px 0 20px; }
.dist-row { display: flex; align-items: center; gap: 10px; margin: 9px 0; font-size: 13px; }
.dist-row .lbl { flex: 0 0 118px; color: var(--muted); }
.dist-row .bar { flex: 1; height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.dist-row .fill { height: 100%; border-radius: 99px; transition: width 0.8s cubic-bezier(0.2, 0.7, 0.3, 1); }
.dist-row .num { flex: 0 0 30px; text-align: right; font-weight: 600; }
.trope-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 20px; }
.trope-pill {
  font-size: 12.5px; padding: 6px 13px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--accent-deep); color: var(--ink);
}
.trope-pill .c { color: var(--gold); font-weight: 600; margin-left: 5px; }
.stat-sub { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--faint); margin: 20px 0 4px; }
.now-reading { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.progress-line { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-line .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 99px; }
.progress-line.big { height: 10px; margin-top: 2px; }
.progress-line.slim { height: 4px; margin: 6px 0 2px; }
.pq-label { font-size: 14px; color: var(--muted); margin: 6px 0 8px; }
.pq-label b { color: var(--text); font-size: 16px; }
.stepper-row { display: flex; gap: 8px; }
.stepper-row .step { flex: 1; padding: 10px 0; font-size: 15px; }
.card-progress { font-size: 12px; color: var(--muted); margin: 0 0 2px; }

/* reading calendar (v63): month grid with covers, cells tinted by activity */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 8px; }
.cal-head h3 { margin: 0; font-size: 16px; }
.cal-head .btn { padding: 6px 16px; font-size: 18px; line-height: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--faint); padding: 2px 0; }
.cal-day { min-height: 66px; border-radius: 10px; background: var(--card); border: 1px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 13px; cursor: pointer; padding: 4px 2px; }
.cal-day.l1 { background: #3d2230; }
.cal-day.l2 { background: #5c2b41; }
.cal-day.l3 { background: #7d3355; }
.cal-day.l4 { background: #a03a6b; }
.ccover { width: 34px; height: 48px; border-radius: 5px; overflow: hidden; position: relative;
  background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.ccover img { width: 100%; height: 100%; object-fit: cover; }
.ccover .cdot { position: absolute; top: 2px; right: 2px; }
.cal-day.blank { background: transparent; cursor: default; }
.cal-day.has { border-color: var(--accent); }
.cal-day .d { line-height: 1; }
.cal-day.today .d { color: var(--accent); font-weight: 700; }
.cal-day.sel { background: var(--accent); border-color: var(--accent); }
.cal-day.sel .d { color: #fff; font-weight: 700; }
.cal-day.sel .cdot { background: rgba(255, 255, 255, .25); }
.cdot { font-size: 10px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 99px;
  min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.cday-pages { font-size: 10px; color: var(--muted); line-height: 1.2; }
.cal-day.l3 .cday-pages, .cal-day.l4 .cday-pages { color: #f3c6d8; }
/* reading activity heatmap (v62) */
.heat-scroll { overflow-x: auto; padding: 2px 0 6px; }
.heat { display: flex; gap: 3px; width: max-content; }
.heat-col { display: flex; flex-direction: column; gap: 3px; }
.heat-dows span { height: 13px; font-size: 9px; color: var(--faint); line-height: 13px; }
.heat-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--card);
  border: 1px solid var(--line); cursor: pointer; }
.heat-cell.l1 { background: #5c2b41; border-color: transparent; }
.heat-cell.l2 { background: #93355c; border-color: transparent; }
.heat-cell.l3 { background: #c74a78; border-color: transparent; }
.heat-cell.l4 { background: #e5488f; border-color: transparent; }
.heat-cell.future { opacity: .2; cursor: default; }
.heat-cell.today { outline: 1px solid var(--gold); outline-offset: 1px; }
.heat-cell.sel { outline: 2px solid #fff; outline-offset: 1px; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 11px;
  color: var(--faint); margin: 2px 0 4px; }
.heat-legend .heat-cell { cursor: default; }
/* reading pace (v62) */
.pace-hero { font-size: 15px; margin: 2px 0 10px; color: var(--muted); }
.pace-hero b { color: var(--ink); }
.pace-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.pace { background: var(--card); border-radius: 12px; padding: 10px 6px; text-align: center; }
.pace .n { font-size: 20px; font-weight: 700; }
.pace .l { font-size: 11px; color: var(--muted); }
.kv { background: var(--card); border-radius: 14px; padding: 4px 14px; margin-bottom: 14px; }
.kv-row { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv-row:last-child { border-bottom: none; }
.kv-row > span { color: var(--muted); flex: none; }
.kv-row b { font-weight: 600; text-align: right; }
.kv-row.tap { cursor: pointer; }
/* reading profile + patterns (v65) */
.meter { letter-spacing: 1px; font-size: 13px; }
.mfill { color: var(--accent); }
.mdim { color: var(--faint); opacity: .5; }
.patterns { background: var(--card); border-radius: 14px; padding: 4px 14px; margin-bottom: 14px; }
.pattern { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 14px; align-items: flex-start; }
.pattern:last-child { border-bottom: none; }
.pattern .pi { flex: none; }
.pattern p { margin: 0; }
.pattern p b { color: var(--ink); }
/* personal records + series (v66) */
.records { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.record-card { background: var(--card); border-radius: 12px; padding: 10px; cursor: pointer; text-align: center; }
.record-card .rlbl { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.record-card .cover-wrap { width: 100%; height: 118px; flex: none; margin: 0 auto 8px; }
.record-card .rtitle { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record-card .rstat { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bigday-num { height: 118px; display: flex; align-items: center; justify-content: center;
  font-size: 38px; font-weight: 800; color: var(--accent);
  background: linear-gradient(140deg, var(--card2), var(--bg2)); border-radius: 8px; margin-bottom: 8px; }
.series-list { background: var(--card); border-radius: 14px; padding: 4px 14px; margin-bottom: 14px; }
.series-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.series-row:last-child { border-bottom: none; }
.sinfo { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sname { font-weight: 700; font-size: 14px; }
.scount { font-size: 12px; color: var(--muted); flex: none; }
.snext { font-size: 13px; color: var(--muted); margin-top: 2px; }
/* previously-read toggle (v67) */
.checkline { display: flex; align-items: center; gap: 8px; margin-top: 10px;
  font-size: 13px; color: var(--muted); cursor: pointer; }
.checkline input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.chk-hint { font-size: 11px; color: var(--faint); }
/* genre evolution (v69) */
.evo-row { display: flex; align-items: center; gap: 8px; margin: 7px 0; }
.evo-lbl { width: 58px; flex: none; text-align: right; font-size: 12px; color: var(--muted); }
.evo-bar { flex: 1; display: flex; height: 18px; border-radius: 9px; overflow: hidden; background: var(--bg2); }
.evo-seg { height: 100%; min-width: 2px; }
.evo-n { width: 30px; flex: none; font-size: 12px; color: var(--faint); }
.evo-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 4px; font-size: 12px; color: var(--muted); }
.evo-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
/* year in books (v70) */
.yib-hero { text-align: center; padding: 32px 16px 20px; margin: 10px 0 6px;
  background: linear-gradient(135deg, #2b1535, #120a18);
  border: 1px solid rgba(229, 100, 142, .28); border-radius: 18px; }
.yib-kicker { letter-spacing: 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.yib-hero h2 { font-size: 34px; margin: 10px 0 6px; }
.yib-hero h2 em { color: var(--accent); }
.yib-sub { color: var(--muted); font-size: 14px; }
.yib-sec { margin-top: 22px; }
/* daily stats card */
.dstat-card { background: var(--card); border-radius: 14px; padding: 12px; }
.dstat-head { display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--muted); margin-bottom: 2px; }
.dstat-head .streak { color: var(--gold); font-weight: 700; }
.dstat-total { font-size: 22px; font-weight: 700; margin: 2px 0 4px; }
.dstat-card .cal-book { background: var(--bg); }
.cal-book { display: flex; gap: 10px; align-items: center; background: var(--card);
  border-radius: 12px; padding: 8px; margin-top: 8px; cursor: pointer; }
.cal-book .cover-wrap { width: 44px; height: 66px; flex: none; font-size: 20px; }
.cal-book h4 { margin: 0 0 2px; font-size: 14px; }
.cal-book p { margin: 0; font-size: 12px; color: var(--muted); }

/* ================= responsive: tablets & desktop ================= */

@media (min-width: 760px) {
  #view { max-width: 880px; padding: 10px 24px 48px; }

  /* book cards flow into columns */
  .grid { display: grid; grid-template-columns: repeat(2, 1fr); align-items: start; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 14px; }

  /* search results breathe a little too */
  #s-results { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 12px; align-items: start; }

  .modal-card { max-width: 660px; }
  .stat-row { gap: 12px; }

  /* nav moves to the top on bigger screens */
  body { padding-bottom: 0; padding-top: calc(var(--nav-h) + 10px); }
  .bottom-nav {
    top: 0; bottom: auto;
    height: var(--nav-h); padding-bottom: 0;
    border-top: none; border-bottom: 1px solid var(--line);
    justify-content: center;
  }
  .bottom-nav button {
    flex: 0 1 160px;
    flex-direction: row; gap: 8px;
    font-size: 17px;
  }
  .bottom-nav button span { font-size: 13px; }

  /* account menu docks to the top-right corner, next to the top nav */
  .topbar-menu-wrap {
    position: fixed; top: 13px; right: 14px; z-index: 140;
  }
  .app-header { justify-content: center; }
  .app-header .brand { text-align: center; }

  /* toasts drop from the top instead */
  #toast-root { top: calc(var(--nav-h) + 16px); bottom: auto; }
}

@media (min-width: 1140px) {
  #view { max-width: 1140px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ================= TBR roulette ================= */

.pick-filters {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0 4px;
}
.pick-filters .stat-sub { margin: 14px 0 4px; }
.pick-filters .stat-sub:first-child { margin-top: 0; }
.pick-btn { width: 100%; font-size: 18px; padding: 16px; margin-top: 10px; }

/* slot-machine flash */
.slot {
  background: var(--card);
  border: 1px solid var(--accent-deep);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  min-height: 190px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
}
.slot-cover {
  width: 64px; height: 96px; border-radius: 8px; overflow: hidden;
  background: linear-gradient(140deg, var(--card2), var(--bg2));
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}
.slot-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot-title { font-family: 'Playfair Display', serif; font-size: 17px; color: var(--muted); }

/* winner reveal */
@keyframes pop {
  0% { transform: scale(0.82); opacity: 0; }
  60% { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.winner {
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  animation: pop 0.45s cubic-bezier(0.2, 0.7, 0.3, 1.2) both;
  box-shadow: 0 12px 40px color-mix(in srgb, var(--accent) 20%, transparent);
}
.winner-cover {
  width: 120px; aspect-ratio: 2/3; margin: 6px auto 12px;
  border-radius: 10px; overflow: hidden;
  background: linear-gradient(140deg, var(--card2), var(--bg2));
  display: flex; align-items: center; justify-content: center; font-size: 44px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
}
.winner-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.winner h3 { margin: 4px 0; font-size: 22px; }
.winner .author { color: var(--muted); margin: 0 0 8px; }
.winner-desc { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 10px 2px 12px; }
.winner-actions { display: flex; gap: 8px; margin-top: 14px; }
.winner-actions .btn { flex: 1; padding: 12px 6px; font-size: 14px; }

/* genre-aware rating rows in the book editor */
#f-axes { margin-bottom: 4px; }
.axrow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 10px;
}
.axrow > span { font-size: 14px; font-weight: 600; }
.axrow .picker { margin: 0; }

/* ---------- Hardcover: series / moods / content warnings ---------- */
.series-line { color: var(--gold); margin: 8px 0 0; font-size: 0.95em; font-weight: 600; }
.mood-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.mood-chip { font-size: 0.78em; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--muted); }
.warnings { margin: 10px 0 2px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.warnings summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.warn-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.warn-tag { font-size: 0.78em; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 120, 120, 0.1); border: 1px solid rgba(255, 120, 120, 0.35); }

/* ---------- theme / accent picker ---------- */
.swatches { display: flex; gap: 14px; padding: 4px 2px; }
.th-dot {
  width: 14px; height: 14px; border-radius: 50%; display: inline-block;
  margin-right: 7px; border: 1px solid var(--line); vertical-align: -2px;
}
.sw {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--sw); border: 2px solid var(--line);
  cursor: pointer; padding: 0;
  transition: transform 0.15s ease;
}
.sw:active { transform: scale(0.92); }
.sw.active {
  border-color: var(--bg);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--sw);
}
/* page-count lookup */
.row-flex { display: flex; gap: 8px; align-items: center; }
.row-flex .text-input { flex: 1; min-width: 0; }

/* ---------- favorites bookshelf ---------- */
.fav-shelf { margin-bottom: 16px; }
.fav-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.fav-head h3 { margin: 0; font-size: 17px; }
.fav-btns { display: flex; gap: 6px; align-items: center; }
.fav-covers { padding: 4px 2px 10px; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.shelf-books { display: flex; align-items: flex-end; gap: 6px; padding: 12px 14px 0; overflow-x: auto; }
.spine { flex: 0 0 auto; border-radius: 4px 4px 2px 2px; cursor: pointer; position: relative;
  background: linear-gradient(90deg, rgba(0,0,0,.35), rgba(255,255,255,.10) 18%, rgba(255,255,255,.02) 50%, rgba(0,0,0,.30)), var(--sc);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -2px 3px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 7px 3px; }
.spine-band { width: 70%; height: 3px; border-radius: 2px; background: rgba(240,210,140,.55); flex: 0 0 auto; }
.spine-title { writing-mode: vertical-rl; font-size: 11px; font-weight: 700; color: #f7f1e3;
  letter-spacing: .04em; max-height: 62%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.spine-author { writing-mode: vertical-rl; font-size: 9px; color: rgba(247,241,227,.75);
  max-height: 22%; overflow: hidden; white-space: nowrap; }
.shelf-plank { height: 13px; margin: 0 2px; border-radius: 3px;
  background: linear-gradient(#9a6535, #6f4525 60%, #54331b);
  box-shadow: 0 5px 10px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.25); }
.fav-btn { align-self: flex-start; background: none; border: none; font-size: 24px;
  cursor: pointer; padding: 2px 4px; line-height: 1; filter: grayscale(1); opacity: .7; }
.fav-btn.on { filter: none; opacity: 1; }

/* spine pull-out animation */
.shelf-books { overflow-x: visible; }
.spine { transition: transform .32s cubic-bezier(.3,.7,.4,1), box-shadow .32s; }
.spine.pulling { transform: translateY(-52px) scale(1.05); z-index: 2;
  box-shadow: 0 18px 32px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.25); }
.pull-overlay { position: fixed; inset: 0; z-index: 60; display: flex;
  align-items: center; justify-content: center; background: rgba(5,3,8,.55);
  opacity: 0; transition: opacity .3s; pointer-events: none; }
.pull-overlay.show { opacity: 1; }
.pull-overlay img { width: min(200px, 55vw); border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0,0,0,.65);
  transform: scale(.35) rotate(-5deg); transition: transform .5s cubic-bezier(.2,1.35,.4,1); }
.pull-overlay.show img { transform: scale(1) rotate(0deg); }
@media (prefers-reduced-motion: reduce) {
  .spine, .pull-overlay, .pull-overlay img { transition: none; }
}

/* ---- book-opening transition: cover flies to center, then swings open ---- */
.bookopen-overlay { position: fixed; inset: 0; z-index: 120; pointer-events: none; }
.bookopen-backdrop { position: absolute; inset: 0; background: rgba(5,3,8,.62);
  opacity: 0; transition: opacity .35s ease; }
.bookopen-overlay.lit .bookopen-backdrop { opacity: 1; }
.bookopen-overlay.gone { opacity: 0; transition: opacity .4s ease; }
.bookopen-stage { position: absolute; perspective: 1100px;
  transition: left .4s cubic-bezier(.3,.7,.3,1), top .4s cubic-bezier(.3,.7,.3,1),
              width .4s cubic-bezier(.3,.7,.3,1), height .4s cubic-bezier(.3,.7,.3,1); }
.bookopen-book { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.bookopen-pages { position: absolute; inset: 0; border-radius: 4px 10px 10px 4px;
  background: linear-gradient(105deg, #e9dcbf 0%, #f7efdd 9%, #f7efdd 100%);
  box-shadow: 0 24px 70px rgba(0,0,0,.6), inset 10px 0 14px -8px rgba(90,70,45,.55);
  display: flex; flex-direction: column; padding: 18px 14px 14px 24px; overflow: hidden; }
.bop-title { font-family: Georgia, 'Times New Roman', serif; font-size: 15px; font-weight: 700;
  color: #4a3b28; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
.bop-lines { flex: 1; border-radius: 2px;
  background: repeating-linear-gradient(to bottom, transparent 0 7px, rgba(120,100,70,.30) 7px 8px); }
.bookopen-cover { position: absolute; inset: 0; transform-origin: left center;
  border-radius: 4px 10px 10px 4px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  transition: transform .75s cubic-bezier(.45,.05,.3,1); backface-visibility: hidden; }
.bookopen-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bookopen-book.open .bookopen-cover { transform: rotateY(-158deg); }
.bo-nocover { width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center;
  color: rgba(255,255,255,.92); }
.bo-nocover span { font-size: 34px; }
.bo-nocover b { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 5;
  -webkit-box-orient: vertical; overflow: hidden; }
/* modal entrance when it arrives via the book-open transition */
.modal-backdrop.from-book .modal { animation: modalRise .38s cubic-bezier(.2,.9,.3,1.12); }
@keyframes modalRise { from { opacity: 0; transform: translateY(26px) scale(.97); } }
@media (prefers-reduced-motion: reduce) {
  .bookopen-stage, .bookopen-cover, .bookopen-backdrop, .bookopen-overlay.gone { transition: none; }
}

/* ---- recently-read strip ---- */
.recent-strip { margin: 2px 0 12px; }
.recent-head h3 { margin: 0 0 8px; font-size: 16px; }
.recent-row { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.recent-card { scroll-snap-align: start; flex: 0 0 96px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer;
  color: inherit; font: inherit; display: flex; flex-direction: column; gap: 6px;
  align-items: stretch; text-align: left; }
.recent-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 7px; }
.recent-nocover { width: 100%; aspect-ratio: 2/3; border-radius: 7px; background: var(--card2);
  display: flex; align-items: center; justify-content: center; font-size: 26px; }
.recent-title { font-size: 11.5px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 30px; }
.recent-prog { height: 4px; border-radius: 99px; background: var(--bg2); overflow: hidden; }
.recent-prog .fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.recent-sub { font-size: 10.5px; color: var(--faint); }

/* tappable author / series links + collections */
.taplink { background: none; border: none; padding: 0; font: inherit; color: var(--accent);
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.series-line .taplink { color: inherit; }
.collection-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px;
  max-height: 60vh; overflow-y: auto; }
.crow { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 12px 8px 8px; cursor: pointer; color: inherit; font: inherit; }
.crow img { width: 40px; height: 60px; object-fit: cover; border-radius: 6px; flex: none; }
.cnocover { width: 40px; height: 60px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex: none; }
.ctext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ctext b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctext small { color: var(--muted); }
.cgo { color: var(--faint); font-size: 22px; }

/* ownership badges */
.badge.owned { background: rgba(123, 201, 138, .16); border-color: rgba(123, 201, 138, .45); }
.badge.tobuy { background: rgba(212, 162, 78, .16); border-color: rgba(212, 162, 78, .5); }
.tile-buy { position: absolute; top: 6px; right: 6px; font-size: 15px;
  background: rgba(10, 6, 14, .72); border-radius: 8px; padding: 2px 5px; }

/* wishlist tab */
.wish-head { text-align: center; padding: 18px 16px 6px; }
.wish-head h2 { margin: 0 0 4px; font-size: 1.5em; }

/* where-to-buy row */
.buy-row { display: flex; flex-wrap: wrap; gap: 8px; }
.buy-row .btn { flex: 1 1 30%; text-align: center; text-decoration: none; }
.note-inline { font-weight: 400; opacity: .6; font-size: .85em; }

/* collection sheet: external "more books" section */
.c-more-h { margin: 18px 0 8px; font-size: 1.1em; }
.crow.ext { cursor: pointer; }
.crow.missing { cursor: pointer; }
.c-added { color: var(--accent); font-weight: 600; font-size: 13px; white-space: nowrap; }

/* external book detail sheet (v60) */
.ext-detail { text-align: center; padding: 6px 2px 2px; }
.ext-cover { width: 150px; border-radius: 10px; box-shadow: 0 10px 24px rgba(0,0,0,.5); }
.ext-nocover { font-size: 64px; padding: 18px 0 6px; }
.ext-detail h2 { margin: 12px 0 4px; font-size: 1.35em; }
.ext-bits { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.ext-desc { text-align: left; font-size: 14px; line-height: 1.55; color: var(--ink);
  max-height: 38vh; overflow-y: auto; margin: 12px 0 0; opacity: .92; }

/* authors tab (v43) */
.aavatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: flex;
  align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--gold)); }
.sec-h { margin: 22px 2px 10px; font-size: 1.1em; }
.crow.missing { border-style: dashed; }
.crow.missing img, .crow.missing .cnocover { filter: grayscale(1); opacity: .45; }
.crow.missing .ctext b { color: var(--muted); font-weight: 500; }
.m-chip { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--faint); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 8px; white-space: nowrap; }

/* sign-in gate */
.gate-wrap { min-height: 72vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 340px; text-align: center; }
.gate-card h1 { margin: 0 0 2px; font-size: 1.9em; }
.gate-card .text-input { width: 100%; margin: 5px 0; box-sizing: border-box; }
.gate-card #gate-status { min-height: 2.2em; }
.gate-offline { margin-top: 18px !important; }

/* ---- Metadata check results (v46) ---- */
.vflags { display: block; font-size: 12px; opacity: .9; margin-top: 3px; line-height: 1.5; }
.vflags .vf { display: block; }
.vflags s { opacity: .65; }

/* ---- Cover picker (v47) ---- */
.mcover-col { display: flex; flex-direction: column; gap: 6px; align-items: center; flex: none; }
.mcover-col .cover-wrap { flex: none; }
#m-changecover { font-size: 15px; padding: 3px 8px; line-height: 1.2; }
.cover-picker-backdrop {
  position: fixed; inset: 0; background: rgba(8, 5, 12, 0.72);
  z-index: 70; display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 600px) { .cover-picker-backdrop { align-items: center; } }
.cover-picker {
  background: var(--nav-bg); border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0; padding: 18px;
  width: 100%; max-width: 560px; max-height: 82vh; overflow-y: auto;
}
@media (min-width: 600px) { .cover-picker { border-radius: 18px; border: 1px solid var(--line); } }
.cover-picker h3 { margin: 0 0 4px; }
.cp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.cp-pick {
  border: 2px solid transparent; border-radius: 10px; padding: 0;
  background: none; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column;
}
.cp-pick img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: var(--bg); }
.cp-pick span { font-size: 11px; color: var(--muted); padding: 4px 2px; }
.cp-pick.current { border-color: var(--accent); }
.cp-actions { display: flex; gap: 10px; justify-content: space-between; }

/* v74: Up Next queue */
.recent-card { position: relative; }
.un-num { position: absolute; top: 6px; left: 6px; z-index: 2; background: rgba(20,8,24,.85);
  color: var(--gold); font-size: 13px; font-weight: 700; min-width: 24px; height: 24px;
  line-height: 24px; text-align: center; border-radius: 12px; padding: 0 6px; }
.un-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.un-row { display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.un-pos { color: var(--gold); font-weight: 800; font-size: 18px; min-width: 24px; text-align: center; }
.un-thumb { width: 44px; height: 66px; object-fit: cover; border-radius: 6px; flex: none; }
.un-nonecover { display: flex; align-items: center; justify-content: center; background: var(--card2); font-size: 20px; }
.un-info { flex: 1; min-width: 0; background: none; border: 0; text-align: left; color: inherit; padding: 0; cursor: pointer; }
.un-title { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.un-sub { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.un-btns { display: flex; gap: 4px; }
.un-btns .btn.sm { padding: 6px 9px; }
.un-strip { margin: 2px 0 12px; }

/* v75: quotes */
.quote-row { display: flex; gap: 10px; align-items: flex-start; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.quote-mark { color: var(--accent); font-size: 22px; line-height: 1; }
.quote-body { flex: 1; min-width: 0; }
.quote-body p { margin: 0 0 4px; font-style: italic; }
.quote-page { color: var(--muted); font-size: 13px; }
#m-qform { margin: 8px 0; }
#m-qform .row-flex { display: flex; gap: 8px; margin-top: 8px; }
#m-qform .row-flex .text-input { flex: 1; min-width: 0; }
.q-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.q-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; cursor: pointer; }
.q-card.feat { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.q-text { margin: 0 0 10px; font-size: 17px; line-height: 1.5; font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.q-meta { display: flex; gap: 10px; align-items: center; }
.q-meta img { width: 36px; height: 54px; object-fit: cover; border-radius: 5px; flex: none; }
.q-meta b { display: block; font-size: 14px; }
.q-by { color: var(--muted); font-size: 13px; }
#q-spot { margin-top: 12px; }
#q-spot:empty { margin-top: 0; }

/* v76: series overview */
.sr-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.sr-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.sr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.sr-name { font-weight: 800; font-size: 17px; }
.sr-author { color: var(--muted); font-size: 13px; margin-top: 2px; }
.sr-count { color: var(--gold); font-weight: 700; font-size: 14px; white-space: nowrap; }
.sr-covers { display: flex; gap: 6px; margin-bottom: 10px; align-items: center; }
.sr-covers img { width: 44px; height: 66px; object-fit: cover; border-radius: 5px; }
/* v78: series covers tap open like the grid */
.sr-cover { background: none; border: 0; padding: 0; cursor: pointer; line-height: 0; }
.sr-cover:active { transform: scale(.93); }
.sr-nocover { width: 44px; height: 66px; display: flex; align-items: center; justify-content: center;
  background: var(--card2); border-radius: 5px; font-size: 20px; }
.sr-more { color: var(--muted); font-size: 13px; margin-left: 4px; }
.sr-card .progress-line { margin: 4px 0 10px; }
.sr-next { width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 10px;
  color: inherit; font: inherit; padding: 10px 12px; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 6px; }
.sr-next b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-done { color: var(--muted); font-size: 14px; padding: 4px 2px; }
/* v79: line-art toolbar/view icons scale with the surrounding text */
.ticon { width: 1.15em; height: 1.15em; vertical-align: -0.22em; }
.view-toggle .ticon { width: 20px; height: 20px; vertical-align: -4px; }
/* v84: book modal line-art — favorite heart fills when active */
.fav-btn .ticon { width: 26px; height: 26px; }
.fav-btn.on .ticon { fill: #ff5d7e; stroke: #ff5d7e; }
/* v84: axis rating glyphs — larger pickers, filled when selected */
.axrow > span .ticon { width: 1.25em; height: 1.25em; }
.axrow .picker .ticon { width: 26px; height: 26px; }
.axrow .picker button.on .ticon { fill: currentColor; }
/* v85: all pickers fill their glyph when selected */
.picker button.on .ticon { fill: currentColor; }
/* v84: ownership badge icons */
.badge .ticon { width: 1.2em; height: 1.2em; }
/* v85: line-art no-cover placeholders + empty states */
.cover-wrap .ticon { width: 30px; height: 30px; opacity: .55; }
.bt-fallback .ticon { width: 34px; height: 34px; opacity: .55; }
.recent-nocover .ticon, .un-nonecover .ticon { width: 30px; height: 30px; opacity: .55; }
.cnocover .ticon { width: 24px; height: 24px; opacity: .55; }
.sr-nocover .ticon { width: 26px; height: 26px; opacity: .55; }
.bo-nocover .ticon { width: 40px; height: 40px; }
.ext-nocover .ticon { width: 64px; height: 64px; opacity: .55; }
.empty .big .ticon { width: 60px; height: 60px; opacity: .6; }

/* ---- Circle (v96): friends + shared shelves ---- */
.circle-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px; margin-top: 12px;
}
.invite-code {
  font-size: 24px; letter-spacing: 4px; font-weight: 700; color: var(--accent);
  background: var(--bg2); border: 1px dashed var(--line); border-radius: 10px;
  padding: 8px 14px; flex: 1; text-align: center;
}
.circle-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.circle-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px;
}
.circle-meta { flex: 1; min-width: 0; }
.circle-meta b { display: block; }
.circle-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.c-avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--card2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff; text-transform: uppercase;
}
.c-avatar.letter { background: linear-gradient(135deg, var(--accent), var(--gold)); }
.cf-sub { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 4px 0 8px; }
.cf-sub .note { margin: 0; }
.cb-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.cb-head .cover-wrap { width: 96px; flex: 0 0 auto; }

/* ---- Circle recommendations (v97) ---- */
.cover-wrap.reco-cover { flex-basis: 44px; width: 44px; height: 66px; border-radius: 6px; }
