/* Libre — dark purple/magenta mood from the Figma file, tuned for readability. */

:root {
  --bg: #170d29;
  --bg-raised: #221438;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f5f0fb;
  --muted: #b8accb;
  --faint: #9a8eb0;
  --lav: #b4a1cc;
  --lav-soft: #d8d0e3;
  --accent: #ff6fb2;
  --accent-strong: #d6328a;
  --accent-ink: #ffffff;
  --star: #ffc85a;
  --danger: #ff8796;

  --radius: 22px;
  --radius-sm: 14px;
  --font-ui: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Amatic SC', 'Poppins', cursive;
  --font-quote: 'Lora', Georgia, serif;

  --tabbar-h: 68px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Soft glow instead of the busy circles — fixed so it works on iOS too. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(70% 45% at 90% -5%, rgba(214, 50, 138, 0.28), transparent 70%),
    radial-gradient(60% 40% at -10% 35%, rgba(106, 76, 214, 0.22), transparent 70%),
    radial-gradient(60% 40% at 110% 95%, rgba(122, 13, 85, 0.25), transparent 70%),
    var(--bg);
}

a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 44px);
  outline: none;
}

/* ---------- Type ---------- */

.display {
  font: 700 46px/1 var(--font-display);
  letter-spacing: 0.02em;
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lav);
}

.section-title {
  font: 700 30px/1.1 var(--font-display);
  letter-spacing: 0.03em;
  margin: 32px 0 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lav-soft);
  margin: 0;
}

.muted { color: var(--muted); }
.hint { color: var(--faint); font-size: 14px; margin: 8px 0 0; }
.center { text-align: center; }

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 14px;
}

.card > h2 + *, .card > .row-between + * { margin-top: 12px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent-strong); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: #e23c95; }
.btn.danger { color: var(--danger); border-color: rgba(255, 135, 150, 0.35); background: transparent; }
.btn.block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.chip {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}
.chip:hover { background: rgba(255, 255, 255, 0.14); }
.chip:active { transform: scale(0.95); }
.chip.accent { background: var(--accent-strong); border-color: transparent; color: var(--accent-ink); }
.chip.ghost { background: transparent; }
.chip.done { background: transparent; border-color: var(--lav); color: var(--lav-soft); }

.link-btn {
  background: none;
  border: 0;
  padding: 8px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--faint);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: -6px 0 12px -8px;
  padding: 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
}
.back svg { width: 20px; height: 20px; }

svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Segmented control ---------- */

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.seg button.on { background: var(--lav-soft); color: #2a1745; }
.seg .count { opacity: 0.7; font-weight: 500; margin-left: 4px; }

/* ---------- Inputs ---------- */

.input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 16px;
}
.input::placeholder { color: var(--faint); }
textarea.input { padding: 12px 16px; resize: vertical; line-height: 1.5; }

.search-box { position: relative; }
.search-box svg { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box .input { padding-left: 46px; min-height: 54px; font-size: 17px; border-radius: 999px; }

.field { display: block; margin-top: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.detail-grid .field:first-child { grid-column: 1 / -1; }

input[type='date'].input { min-width: 0; }

/* ---------- Covers ---------- */

.cover {
  --h: 290;
  position: relative;
  flex: none;
  overflow: hidden;
  border-radius: 6px 10px 10px 6px;
  aspect-ratio: 2 / 3;
  background: linear-gradient(150deg, hsl(var(--h) 45% 42%), hsl(calc(var(--h) + 40) 50% 24%));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), inset 3px 0 0 rgba(255, 255, 255, 0.12);
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10% 10% 10% 14%;
  overflow: hidden;
}
.cover-ph-title { font: 700 1.25em/1 var(--font-display); letter-spacing: 0.02em; overflow-wrap: anywhere; }
.cover-ph-author { font-size: 0.7em; opacity: 0.8; }
.cover-xs { width: 34px; font-size: 6px; border-radius: 3px 5px 5px 3px; }
.cover-xs .cover-ph { display: none; }
.cover-sm { width: 64px; font-size: 9px; }
.cover-md { width: 100%; font-size: 13px; }
.cover-lg { width: 120px; font-size: 15px; }

/* ---------- Today ---------- */

.brand {
  font: 700 26px/1 var(--font-display);
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 22px;
}

.quote-card {
  position: relative;
  margin: 22px 0 0;
  padding: 26px 22px 20px;
  border-radius: 28px;
  background: linear-gradient(150deg, #7b3f73 0%, #5a2c6e 55%, #3d2363 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.quote-card blockquote {
  margin: 0;
  font: italic 400 21px/1.45 var(--font-quote);
}
.quote-card figcaption { margin-top: 14px; color: var(--lav-soft); font-size: 15px; }
.quote-card figcaption a { color: var(--text); font-weight: 600; text-decoration-color: rgba(255,255,255,.4); }
.quote-card .hint { color: rgba(245, 240, 251, 0.75); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.stat {
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.stat-n { display: block; font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-l { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }

.reading-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.reading-card .rc-body { flex: 1; min-width: 0; }
.rc-title { display: block; font-size: 17px; font-weight: 700; line-height: 1.3; text-decoration: none; }
.rc-author { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.rc-meta { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.rc-meta b { color: var(--text); }
.rc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.bar {
  height: 6px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lav), var(--accent));
  transition: width 0.3s ease;
}

.up-next { list-style: none; margin: 0; padding: 0; }
.up-next li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.up-next li:last-child { border-bottom: 0; }
.up-next .un-text { flex: 1; min-width: 0; }
.up-next .un-text a { font-weight: 600; text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-next .un-text span { font-size: 14px; color: var(--muted); }

.welcome {
  margin-top: 22px;
  padding: 26px 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.welcome h2 { font: 700 34px/1.05 var(--font-display); margin: 0 0 8px; letter-spacing: 0.02em; }
.welcome p { margin: 0; color: var(--muted); }

/* ---------- Library ---------- */

.lib-controls { display: grid; gap: 12px; margin-bottom: 18px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 22px 14px;
}
.tile { text-decoration: none; min-width: 0; }
.tile-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.tile-sub { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .bar { height: 4px; margin-top: 6px; }
.tile .stars { margin-top: 4px; }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}
.empty p { margin: 0 0 16px; }

/* ---------- Search ---------- */

.results { list-style: none; margin: 18px 0 0; padding: 0; }
.result {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.result:last-child { border-bottom: 0; }
.result .r-body { flex: 1; min-width: 0; }
.r-title { margin: 0; font-weight: 700; line-height: 1.3; }
.r-sub { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.r-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.r-actions .chip { min-height: 36px; padding: 0 13px; font-size: 14px; }
.pill-on {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--lav);
  color: var(--lav-soft);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.skeleton .cover { background: var(--surface-2); box-shadow: none; }
.skeleton .sk-line { height: 12px; border-radius: 6px; background: var(--surface-2); margin-top: 8px; }
.skeleton .sk-line:first-child { margin-top: 2px; width: 70%; height: 16px; }
.skeleton .sk-line:nth-child(2) { width: 45%; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: pulse 1.2s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: 0.5; } }
}

.search-tip { margin-top: 26px; text-align: center; color: var(--muted); }
.search-tip a { color: var(--accent); font-weight: 600; }

/* ---------- Book ---------- */

.book-hero { display: flex; gap: 18px; align-items: flex-end; }
.book-hero .bh-text { min-width: 0; padding-bottom: 4px; }
.book-title { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 700; overflow-wrap: anywhere; }
.book-hero .muted { margin: 6px 0 0; }
.book-shelf { margin-top: 18px; }

.page-line { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 17px; }
.page-line .input { width: 96px; min-height: 44px; text-align: center; font-size: 20px; font-weight: 700; padding: 0 8px; }
.pct { font-size: 22px; font-weight: 700; color: var(--accent); }

input[type='range'] {
  width: 100%;
  margin: 16px 0 4px;
  accent-color: var(--accent);
}

.stars { display: inline-flex; gap: 2px; vertical-align: middle; }
.star { position: relative; display: inline-block; width: 14px; height: 14px; }
.star svg { position: absolute; inset: 0; width: 100%; height: 100%; stroke: none; }
.star .bg { fill: rgba(255, 255, 255, 0.18); }
.star .fg { fill: var(--star); }
.stars-lg { gap: 6px; }
.stars-lg .star { width: 40px; height: 40px; }
.star .half { position: absolute; top: 0; bottom: 0; width: 50%; padding: 0; border: 0; background: transparent; }
.star .half.l { left: 0; }
.star .half.r { right: 0; }
.star .half:focus-visible { outline-offset: 0; }

.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-list li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.entry-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.entry-list blockquote { margin: 0; font: italic 400 18px/1.5 var(--font-quote); white-space: pre-wrap; }
.entry-list .note-text { margin: 0; white-space: pre-wrap; }
.entry-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--faint); }

.card-empty { margin: 12px 0 0; color: var(--faint); font-size: 15px; }

.remove-book { display: block; margin: 28px auto 0; }

a.chip { display: inline-flex; align-items: center; text-decoration: none; }

.file-name { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.file-kind {
  flex: none;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--lav-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.file-actions .btn { flex: 1 1 0; }

/* ---------- Reader ---------- */

.reading-mode .tabbar { display: none; }
.reading-mode .app { max-width: none; padding: 0; }
.reading-mode .toast { bottom: calc(env(safe-area-inset-bottom) + 70px); }

.reader {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.reader-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}
.reader-bar .icon-btn { width: 40px; height: 40px; color: var(--text); }
.reader-bar .icon-btn svg { width: 22px; height: 22px; }
.reader-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.reader-title b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-title span { font-size: 13px; color: var(--muted); min-height: 1.25em; }
.reader-body { position: relative; flex: 1; min-height: 0; }

.reader[data-kind='pdf'] .reader-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px calc(env(safe-area-inset-bottom) + 12px);
}
.pdf-page {
  max-width: 900px;
  margin: 0 auto 12px;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.pdf-page canvas { display: block; width: 100%; height: 100%; }

.reader[data-kind='epub'] .reader-body { margin: 16px 22px 0; }
.reader-nav {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px);
}
.reader-nav .chip { display: inline-flex; align-items: center; gap: 4px; }
.reader-nav svg { width: 18px; height: 18px; }

/* ---------- Journal ---------- */

.journal-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.j-item {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.j-item blockquote { margin: 0; font: italic 400 19px/1.5 var(--font-quote); white-space: pre-wrap; }
.j-item .note-text { margin: 0; white-space: pre-wrap; }
.j-book { display: flex; align-items: center; gap: 10px; margin-top: 14px; text-decoration: none; font-size: 14px; }
.j-book b { display: block; font-weight: 600; }
.j-book .muted { display: block; font-size: 13px; }

/* ---------- Settings ---------- */

.steps { margin: 12px 0 0; padding-left: 20px; color: var(--muted); }
.steps li { margin-bottom: 4px; }
.steps b { color: var(--text); }
.file-btn input { display: none; }
.foot { margin-top: 30px; font-size: 13px; color: var(--faint); text-align: center; }
.foot a { color: var(--muted); }

/* ---------- Tab bar ---------- */

/* Floating pill, like a little shelf at the bottom of the screen. */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 520px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  gap: 2px;
  height: var(--tabbar-h);
  padding: 6px;
  border-radius: 999px;
  background: rgba(34, 20, 56, 0.86);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  z-index: 10;
}
.tabbar a, .tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  text-decoration: none;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.tabbar svg { width: 23px; height: 23px; }
.tabbar .active { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.tabbar .active svg { color: var(--accent); }

/* ---------- Sheet ---------- */

.sheet {
  width: 100%;
  max-width: 560px;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: var(--bg-raised);
  color: var(--text);
}
.sheet::backdrop { background: rgba(8, 3, 16, 0.6); }
@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: 26px; border-bottom: 1px solid var(--border); }
}
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: rise 0.22s ease-out; }
  @keyframes rise { from { transform: translateY(24px); opacity: 0; } }
}
.sheet-form { padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-form header { display: flex; align-items: center; justify-content: space-between; }
.sheet-form h2 { margin: 0; font: 700 30px/1 var(--font-display); letter-spacing: 0.03em; }
.sheet-form .btn.primary { width: 100%; margin-top: 20px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 22px);
  transform: translate(-50%, 20px);
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 14px 12px 18px;
  border-radius: 16px;
  background: #f1eaf8;
  color: #23123a;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button {
  border: 0;
  background: none;
  padding: 4px 6px;
  color: #b0216e;
  font-weight: 700;
}

/* ---------- Shared bits ---------- */

.round-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.round-btn svg { width: 22px; height: 22px; }
.round-btn.accent { background: var(--accent-strong); border-color: transparent; color: #fff; }
.round-btn.accent svg { stroke-width: 2.4; }
.page-head { align-items: center; }
.page-sub { margin: -8px 0 16px; font-size: 15px; }
.page-sub svg { width: 16px; height: 16px; vertical-align: -3px; color: var(--accent); }
.list-label { margin: 26px 0 10px; }

.avatar {
  --h: 300;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(140deg, hsl(var(--h) 55% 58%), hsl(calc(var(--h) + 50) 55% 32%));
  color: #fff;
  font-weight: 700;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 55%; height: 55%; }
.avatar-sm { width: 40px; height: 40px; font-size: 15px; }
.avatar-md { width: 52px; height: 52px; font-size: 19px; }
.avatar-xl { width: 104px; height: 104px; font-size: 36px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(255, 255, 255, 0.08); }
.avatar-fill { width: 100%; height: 100%; font-size: 26px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--lav-soft);
  font-size: 14px;
  font-weight: 600;
}
.tag.on { background: var(--lav-soft); border-color: transparent; color: #2a1745; }
.tag.sm { min-height: 28px; padding: 0 10px; font-size: 12.5px; color: var(--muted); }

/* ---------- Today additions ---------- */

.top-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.top-row .brand { margin: 0; }
.avatar-btn { display: inline-flex; border-radius: 50%; text-decoration: none; }
.more-quotes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  color: var(--lav-soft);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.more-quotes svg { width: 16px; height: 16px; }
.nudge {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  text-decoration: none;
}
.nudge > svg { flex: none; width: 26px; height: 26px; color: var(--accent); }
.nudge > svg:last-child { width: 18px; height: 18px; color: var(--faint); margin-left: auto; }
.nudge b { display: block; }
.nudge .muted { font-size: 14px; }

/* ---------- Welcome & profile form ---------- */

.bare-mode .tabbar { display: none; }
.bare-mode .app { padding-bottom: calc(env(safe-area-inset-bottom) + 32px); }

.landing { display: flex; flex-direction: column; min-height: calc(100vh - 60px); }
.landing-card {
  position: relative;
  margin: 8px 0 0;
  padding: 72px 26px 30px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 40px;
  background: linear-gradient(155deg, #7b4372 0%, #66306c 45%, #4a2560 100%);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}
.landing-card blockquote { margin: 0; font: 400 22px/1.45 var(--font-ui); }
.landing-card figcaption { margin-top: 18px; text-align: right; font-size: 19px; font-weight: 500; }
.landing-start {
  align-self: flex-end;
  margin: 46px -42px 0 0;
  min-width: 170px;
  min-height: 56px;
  font: 700 28px/1 var(--font-display);
  letter-spacing: 0.12em;
  background: rgba(150, 160, 215, 0.55);
  border-color: rgba(255, 255, 255, 0.25);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.landing-title { margin-top: 30px; }
.landing-sub { margin: 8px 0 0; font-size: 17px; }

.profile-form { padding-bottom: 12px; }
.form-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: calc(-20px - env(safe-area-inset-top)) -16px 8px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: rgba(23, 13, 41, 0.9);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.form-head h1 { margin: 0; font: 700 30px/1 var(--font-display); letter-spacing: 0.03em; text-align: center; }
.avatar-pick { display: flex; align-items: center; gap: 18px; margin: 14px 0 6px; }
.avatar-actions { display: flex; flex-direction: column; align-items: flex-start; }
.avatar-actions .link-btn { cursor: pointer; }
.muted-link { color: var(--muted); }
.input-prefix { position: relative; display: block; }
.input-prefix b { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--faint); font-weight: 600; }
.input-prefix .input { padding-left: 34px; }
.goal-input { max-width: 140px; }
.genre-field { border: 0; padding: 0; margin: 18px 0 0; }
.genre-field legend { padding: 0; margin-bottom: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.form-submit { margin-top: 22px; }

/* ---------- Profile ---------- */

.profile-head { display: flex; align-items: center; gap: 18px; margin-top: 6px; }
.profile-stats { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); }
.profile-stats a, .profile-stats button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  border: 0;
  background: none;
  text-decoration: none;
  color: inherit;
}
.profile-stats > * + * { border-left: 1px solid var(--border); }
.profile-stats b { font-size: 24px; line-height: 1.1; }
.profile-stats span { font-size: 13px; color: var(--muted); }
.profile-name { margin: 16px 0 0; font: 700 40px/1 var(--font-display); letter-spacing: 0.02em; }
.profile-handle { margin: 4px 0 0; font-size: 14px; }
.profile-bio { margin: 12px 0 0; font: italic 400 17px/1.5 var(--font-quote); color: var(--lav-soft); }
.profile-actions .btn { flex: 1 1 0; }
.profile-actions svg { width: 18px; height: 18px; }
.profile-tabs { margin: 22px 0 4px; }

.goal-card { display: flex; align-items: center; gap: 18px; }
.ring { flex: none; width: 84px; height: 84px; transform: rotate(-90deg); }
.ring circle { stroke-width: 7; }
.ring-bg { stroke: rgba(255, 255, 255, 0.1); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.ring text { transform: rotate(90deg); transform-origin: 32px 32px; fill: var(--text); stroke: none; font: 700 14px var(--font-ui); }
.goal-line { margin: 6px 0 0; font-size: 17px; }
.goal-line b { font-size: 22px; }
.goal-note { margin: 2px 0 0; font-size: 14px; }
.goal-note a { color: var(--accent); }

.about-list { padding: 4px 18px; }
.about-row { display: flex; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.about-row:last-child { border-bottom: 0; }
.about-row > span:first-child { color: var(--muted); }
.about-row > :last-child { text-align: right; font-weight: 600; }
.about-row a { color: var(--accent); }

.cover-strip { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.cover-strip::-webkit-scrollbar { display: none; }
.cover-strip a { flex: none; width: 104px; }
.mini-quote { margin: 0 0 10px; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.mini-quote blockquote { margin: 0; font: italic 400 17px/1.5 var(--font-quote); }
.mini-quote figcaption { margin-top: 6px; font-size: 14px; color: var(--muted); }

.updates { list-style: none; margin: 14px 0 0; padding: 0; }
.update { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.update:last-child { border-bottom: 0; }
.u-body { flex: 1; min-width: 0; }
.u-line { margin: 0; }
.u-line a { font-weight: 700; text-decoration: none; color: var(--lav-soft); }
.u-body blockquote { margin: 8px 0 0; font: italic 400 16px/1.5 var(--font-quote); }
.u-body .stars { margin-top: 6px; }
.u-date { margin: 6px 0 0; font-size: 13px; color: var(--faint); }

.account-row { display: flex; align-items: center; gap: 14px; }
.account-row p { margin: 0; }
.account-row .muted { display: block; font-size: 14px; }

/* ---------- My Books ---------- */

.now-strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 4px; }
.now-strip::-webkit-scrollbar { display: none; }
.now-card {
  flex: 0 0 min(100%, 440px);
  scroll-snap-align: start;
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(123, 63, 115, 0.55), rgba(61, 35, 99, 0.55));
  border: 1px solid var(--border);
}
.now-card .cover-sm { width: 76px; }
.now-body { flex: 1; min-width: 0; }
.now-body .chip { margin-top: 10px; }
.now-pct { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.now-pct .bar { flex: 1; margin: 0; }

.shelf-list { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.shelf-row {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  text-align: left;
}
.shelf-row:last-child { border-bottom: 0; }
.shelf-row > svg { width: 18px; height: 18px; color: var(--faint); margin-left: auto; }
.shelf-stack { position: relative; flex: none; width: 76px; height: 72px; }
.shelf-stack .cover { position: absolute; top: 0; width: 46px; }
.shelf-stack .cover:nth-child(1) { left: 0; z-index: 3; }
.shelf-stack .cover:nth-child(2) { left: 14px; top: 4px; z-index: 2; opacity: 0.85; }
.shelf-stack .cover:nth-child(3) { left: 28px; top: 8px; z-index: 1; opacity: 0.7; }
.shelf-stack .cover .cover-ph { display: none; }
.shelf-empty { display: grid; place-items: center; width: 46px; height: 69px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.shelf-empty svg { width: 22px; height: 22px; }
.shelf-text b { display: block; font-size: 18px; }
.shelf-text span { font-size: 14px; color: var(--muted); }

/* ---------- Search genres ---------- */

.genre-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.genre-tile {
  --h: 300;
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 78px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background:
    radial-gradient(80% 90% at 85% 10%, hsl(var(--h) 60% 55% / 0.55), transparent 70%),
    linear-gradient(150deg, hsl(var(--h) 40% 34%), hsl(calc(var(--h) + 30) 45% 18%));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.genre-tile:active { transform: scale(0.97); }

/* ---------- Quotes ---------- */

.q-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.q-card {
  padding: 20px 18px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.2s, background 0.2s;
}
.q-card blockquote { margin: 0; font: italic 400 19px/1.55 var(--font-quote); }
.q-card .q-text { padding: 0 2px; border-radius: 4px; transition: background 0.25s; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.q-card.on { border-color: rgba(255, 111, 178, 0.4); background: rgba(255, 111, 178, 0.06); }
.q-card.on .q-text { background: linear-gradient(transparent 58%, rgba(255, 111, 178, 0.32) 58%); }
.q-by { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.q-by i { color: var(--lav-soft); }
.q-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.q-tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.q-actions { display: flex; gap: 2px; flex: none; }
.q-actions .icon-btn { width: 44px; height: 44px; color: var(--muted); }
.q-actions .icon-btn svg { width: 21px; height: 21px; }
.q-hl[aria-pressed='true'] { color: var(--accent); background: rgba(255, 111, 178, 0.12); }

/* ---------- More sheet ---------- */

.more-sheet { position: relative; padding: 14px 18px calc(24px + env(safe-area-inset-bottom)); }
.grabber { display: block; width: 44px; height: 5px; margin: 0 auto 18px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 10px; }
.more-item { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; text-decoration: none; font-size: 14px; font-weight: 600; }
.more-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--lav-soft);
}
.more-icon > svg { width: 30px; height: 30px; }

/* ---------- Reader: lighting & comfort ---------- */

.reader {
  --r-bg: #2a1d16; --r-bar: #33241b; --r-text: #f2e4cc; --r-muted: rgba(242, 228, 204, 0.62);
  --r-line: rgba(242, 228, 204, 0.12); --r-chip: rgba(242, 228, 204, 0.1); --r-accent: #f3a56e;
  --r-glow: rgba(255, 168, 92, 0.2);
  /* Dark, warm pages with cream text — like the lamp is the only light in the room. */
  --r-page: invert(0.86) hue-rotate(180deg) sepia(0.4) brightness(0.95);
  background: var(--r-bg);
  color: var(--r-text);
}
.reader[data-theme='paper'] {
  --r-bg: #f8f1e4; --r-bar: #efe5d3; --r-text: #3b2c24; --r-muted: rgba(59, 44, 36, 0.6);
  --r-line: rgba(59, 44, 36, 0.12); --r-chip: rgba(59, 44, 36, 0.07); --r-accent: #a3416c;
  --r-glow: rgba(255, 214, 150, 0.35); --r-page: none;
}
.reader[data-theme='sepia'] {
  --r-bg: #eedcbb; --r-bar: #e4cfa9; --r-text: #46321f; --r-muted: rgba(70, 50, 31, 0.62);
  --r-line: rgba(70, 50, 31, 0.14); --r-chip: rgba(70, 50, 31, 0.08); --r-accent: #8d3b2a;
  --r-glow: rgba(255, 190, 110, 0.3); --r-page: sepia(0.5) contrast(0.95);
}
.reader[data-theme='night'] {
  --r-bg: #170d29; --r-bar: #221438; --r-text: #f5f0fb; --r-muted: var(--muted);
  --r-line: var(--border); --r-chip: var(--surface-2); --r-accent: #ff6fb2;
  --r-glow: rgba(214, 50, 138, 0.16); --r-page: brightness(0.85);
}
/* A soft lamp glow from above, like reading under a bedside light. */
.reader::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(130% 55% at 50% -12%, var(--r-glow), transparent 65%);
}
.reader > * { position: relative; z-index: 1; }
.reader-bar { background: var(--r-bar); border-bottom-color: var(--r-line); color: var(--r-text); }
.reader-title span { color: var(--r-muted); }
.reader .icon-btn { color: var(--r-text); }
.reader .chip { background: var(--r-chip); border-color: var(--r-line); color: var(--r-text); }
.reader .chip:hover { background: var(--r-line); }
.reader-aa { font-family: Georgia, serif; font-size: 17px; padding: 0 14px; }
.pdf-page canvas { filter: var(--r-page); }
.reader-progress { height: 3px; flex: none; background: var(--r-line); }
.reader-progress span { display: block; height: 100%; width: 0; background: var(--r-accent); border-radius: 0 3px 3px 0; transition: width 0.4s ease; }

.sheet-sub { margin: 6px 0 0; color: var(--muted); }
.theme-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 4px 10px;
  border-radius: 18px;
  border: 2px solid transparent;
  background: var(--sw-bg);
  color: var(--sw-ink);
  font-size: 13px;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.swatch span { font: 600 24px/1 Georgia, serif; }
.swatch.on { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255, 111, 178, 0.22); }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.pref-row > span { font-weight: 600; color: var(--muted); }
.pref-row .seg { flex: none; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper output { min-width: 52px; text-align: center; font-weight: 700; }

/* ---------- Home ---------- */

.tabbar .tab-brand { display: none; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.home-quote { margin-top: 0; }
a.goal-card { text-decoration: none; margin-top: 26px; }
.home-reading .reading-card:last-child { margin-bottom: 0; }

.rec-strip { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 6px; scroll-snap-type: x proximity; }
.rec-strip::-webkit-scrollbar { display: none; }
.rec { flex: 0 0 116px; scroll-snap-align: start; min-width: 0; }
.rec .cover-md { width: 116px; }
.rec-title { margin: 8px 0 0; font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-author { margin: 2px 0 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec .chip { margin-top: 8px; min-height: 34px; padding: 0 12px; font-size: 13px; }
.rec .pill-on { margin-top: 8px; font-size: 13px; }
.rec.skeleton .sk-line { width: 80%; }
.section-title i { font-style: normal; color: var(--lav-soft); }

/* ---------- Website (wide screens) ---------- */

@media (min-width: 900px) {
  :root { --tabbar-h: 64px; }

  /* The floating pill becomes a calm top bar. */
  .tabbar {
    top: 0;
    bottom: auto;
    left: 0;
    transform: none;
    width: 100%;
    max-width: none;
    display: flex;
    align-items: center;
    gap: 4px;
    height: var(--tabbar-h);
    padding: 10px max(32px, calc((100% - 1120px) / 2));
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    background: rgba(23, 13, 41, 0.88);
  }
  .tabbar .tab-brand {
    display: block;
    margin-right: auto;
    padding: 0;
    font: 700 32px/1 var(--font-display);
    letter-spacing: 0.06em;
    color: var(--accent);
    background: none;
  }
  .tabbar a:not(.tab-brand), .tabbar button { flex-direction: row; gap: 8px; height: 44px; padding: 0 16px; font-size: 15px; }
  .tabbar svg { width: 20px; height: 20px; }

  .app { max-width: 780px; padding: calc(var(--tabbar-h) + 40px) 32px 72px; }
  body[data-route='today'] .app { max-width: 1120px; }
  .top-row { display: none; }
  .toast { bottom: 28px; }
  .reading-mode .app { padding: 0; }

  /* Two quiet columns: what you're reading on the left, everything else on the right. */
  .home-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    grid-template-areas:
      'reading quote'
      'reading goal'
      'next recs';
    grid-template-rows: auto auto 1fr;
    gap: 0 44px;
    align-items: start;
  }
  .home-quote { grid-area: quote; }
  .home-reading { grid-area: reading; }
  .home-goal { grid-area: goal; }
  .home-recs { grid-area: recs; }
  .home-next { grid-area: next; }
  .home-reading .section-title { margin-top: 22px; }
  .rec-strip { margin: 0; padding: 0 0 6px; }

  .q-list { grid-template-columns: 1fr 1fr; align-items: start; }
  .now-card { flex-basis: calc(50% - 6px); }
  .genre-tiles { grid-template-columns: repeat(6, 1fr); }
  .landing { max-width: 460px; margin: 0 auto; }
}

/* ---------- Icons: thin Material Symbols, as in the Figma file ---------- */

.ms {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  overflow: hidden;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}
.search-box .ms { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; font-size: 22px; }
.icon-btn .ms { font-size: 21px; }
.back .ms { font-size: 17px; }
.round-btn .ms { font-size: 26px; }
.more-quotes .ms { font-size: 18px; }
.nudge > .ms { font-size: 30px; color: var(--accent); }
.nudge > .ms:last-child { font-size: 20px; color: var(--faint); margin-left: auto; }
.shelf-row > .ms { font-size: 22px; color: var(--faint); margin-left: auto; }
.shelf-empty .ms { font-size: 26px; }
.avatar .ms { font-size: 1.7em; }
.profile-actions .ms, .reader-nav .ms { font-size: 19px; }

/* ---------- Highlights ---------- */

mark.hl { color: inherit; border-radius: 3px; padding: 0 1px; cursor: pointer; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hl-yellow { background: rgba(245, 208, 76, 0.42); }
.hl-green { background: rgba(143, 214, 148, 0.42); }
.hl-blue { background: rgba(143, 179, 255, 0.42); }
.hl-pink { background: rgba(245, 151, 184, 0.45); }
.hl-purple { background: rgba(196, 166, 242, 0.45); }
mark.hl-underline { background: none; text-decoration: underline 2px #e0559f; text-underline-offset: 4px; }
[data-hl-host] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: none; }

.q-thought { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); font-size: 15px; color: var(--lav-soft); }
.q-thought .ms { font-size: 19px; color: var(--accent); margin-top: 1px; }
.q-tags { margin-top: 12px; }
.q-card { padding-bottom: 18px; }
.sheet-quote { margin: 14px 0 0; padding: 12px 14px; border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0; background: var(--surface); font: italic 400 17px/1.5 var(--font-quote); }

/* PDF: invisible selectable text over the page, and highlight boxes under it. */
.pdf-page { position: relative; }
.pdf-page canvas { position: relative; z-index: 0; }
.hl-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.hl-box { position: absolute; border-radius: 2px; }
.hl-box.hl-underline { background: none; border-bottom: 2px solid #e0559f; }
.textLayer { position: absolute; inset: 0; z-index: 2; overflow: hidden; line-height: 1; text-align: initial; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: transparent; }
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer ::selection { background: rgba(255, 111, 178, 0.32); }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: -1; cursor: default; user-select: none; }

/* The highlight menu: a floating panel on computers, docked at the bottom on phones. */
.sel-menu {
  position: fixed;
  z-index: 40;
  width: 300px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(40, 26, 58, 0.94);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.5);
  color: var(--text);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition: opacity 0.14s, transform 0.14s;
}
.sel-menu.show { opacity: 1; transform: none; }
.sel-menu.dock {
  left: 10px;
  right: 10px;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  width: auto;
  max-width: 520px;
  margin: 0 auto;
  max-height: 62vh;
  overflow-y: auto;
  border-radius: 24px;
  transform: translateY(24px);
}
.sel-menu.dock.show { transform: none; }

.sm-thought {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #7b3f73, #4a2560);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  color: #fff;
  text-align: left;
}
.sm-thought:hover { filter: brightness(1.08); }
.sm-thought-icon { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; background: #60044c; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35); }
.sm-thought-icon .ms { font-size: 26px; }
.sm-thought-text b { display: block; font: 700 27px/1 var(--font-display); letter-spacing: 0.03em; }
.sm-thought-text small { display: block; margin-top: 3px; font-size: 13px; color: rgba(255, 255, 255, 0.75); }

.sm-colors { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.sm-dot { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: var(--dot); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.sm-dot.on, .sm-ul.on { outline: 2px solid #fff; outline-offset: 3px; }
.sm-ul { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text); }
.sm-ul .ms { font-size: 24px; }
.sm-list { padding: 4px 0; }
.sm-list + .sm-list { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.sm-list:empty { display: none; }
.sm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font-size: 15px;
  text-align: left;
}
.sm-item:hover, .sm-item:focus-visible { background: rgba(255, 255, 255, 0.08); }
.sm-item .ms { font-size: 20px; color: var(--lav); }
.sm-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Your Figma look ---------- */

:root {
  --surface: rgba(180, 161, 204, 0.12);
  --surface-2: rgba(180, 161, 204, 0.2);
  --radius: 28px;
  --magenta: #60044c;
  --tile: #5d3f83;
}

/* Big soft circles, like the Figma backgrounds. */
body::before {
  background:
    radial-gradient(circle at 92% 6%, rgba(98, 24, 96, 0.55) 0 22%, transparent 22.3%),
    radial-gradient(circle at 8% 40%, rgba(34, 24, 98, 0.6) 0 26%, transparent 26.3%),
    radial-gradient(circle at 80% 78%, rgba(78, 15, 100, 0.45) 0 24%, transparent 24.3%),
    radial-gradient(circle at 20% 105%, rgba(98, 24, 96, 0.35) 0 20%, transparent 20.3%),
    radial-gradient(70% 45% at 90% -5%, rgba(214, 50, 138, 0.2), transparent 70%),
    var(--bg);
}

/* Handwritten labels on buttons, chips, tabs and titles. */
.btn, .chip, .seg button, .tag, .card-title, .link-btn, .back, .tabbar a, .tabbar button {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.btn { font-size: 22px; }
.chip { font-size: 20px; }
.seg button { font-size: 19px; }
.tag { font-size: 18px; }
.tag.sm { font-size: 16px; }
.link-btn { font-size: 20px; }
.back { font-size: 20px; }
.card-title { font-size: 24px; letter-spacing: 0.04em; text-transform: none; color: var(--lav-soft); }
.r-actions .chip { font-size: 18px; }
.rec .chip { font-size: 17px; }
.seg .count { font-family: var(--font-ui); font-size: 13px; }

/* Round magenta icon buttons. */
.round-btn { background: var(--magenta); border: 0; color: #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35); }
.round-btn.accent { background: var(--accent-strong); }

/* Tab bar: thin icons, the active one in a magenta circle. */
.tabbar a, .tabbar button { font-size: 16px; text-transform: uppercase; }
.tabbar .ms { box-sizing: content-box; padding: 5px; border-radius: 50%; font-size: 24px; transition: background 0.2s; }
.tabbar .active { background: transparent; }
.tabbar .active .ms { background: var(--magenta); color: #fff; }

/* Today: the "TODAY / date" card and round button from the Figma home. */
.today-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.today-card {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 12px 16px;
  border-radius: 16px;
  background: rgba(38, 64, 133, 0.6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.today-text { min-width: 0; }
.today-label { margin: 0; font: 700 16px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--lav-soft); }
.today-date { margin: 4px 0 0; font: 700 30px/1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-icons { display: flex; gap: 8px; }
.today-icons a { display: grid; place-items: center; color: #fff; text-decoration: none; }
.today-icons .ms { font-size: 24px; }
.today-orb {
  display: grid;
  place-items: center;
  flex: none;
  width: 62px;
  height: 62px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--magenta);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
}
.today-orb .ms { font-size: 38px; }
.today-orb .avatar-fill { font-size: 22px; }
.home-grid { margin-top: 0; }

/* More menu: rounded tiles like the Figma side toolbar. */
.more-icon { width: 72px; height: 72px; border-radius: 20px; background: var(--tile); border: 0; color: #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3); }
.more-icon > .ms { font-size: 34px; }
.more-item { font: 700 18px/1.1 var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; }

@media (min-width: 900px) {
  .tabbar a:not(.tab-brand), .tabbar button { font-size: 18px; }
  .tabbar .ms { padding: 4px; font-size: 22px; }
}

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

::selection { background: rgba(255, 111, 178, 0.35); color: inherit; }
.more-sheet:focus { outline: none; }

/* ---------- From the Figma Home frame ---------- */

/* Background: purple-to-navy gradient with big, softly shadowed circles. */
body::before {
  background: linear-gradient(166.74deg, #60044c 0%, rgba(23, 13, 83, 0.92) 51%, #0e044c 99%), #170d29;
}
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop i { position: absolute; border-radius: 50%; }
.backdrop i:nth-child(1) { width: 140vmax; height: 140vmax; max-width: 640px; max-height: 660px; left: -35%; top: 38%; background: #1b134e; box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.21); }
.backdrop i:nth-child(2) { width: 120vmax; height: 120vmax; max-width: 544px; max-height: 597px; left: -21%; top: 12%; background: rgba(78, 19, 77, 0.6); box-shadow: 8px 8px 8px rgba(0, 0, 0, 0.21), inset 0 0 12px rgba(0, 0, 0, 0.32); }
.backdrop i:nth-child(3) { width: 100vmax; height: 100vmax; max-width: 544px; max-height: 543px; left: 13%; top: -5%; background: #1b134e; box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.34); opacity: 0.85; }
.backdrop i:nth-child(4) { width: 80vmax; height: 80vmax; max-width: 364px; max-height: 364px; left: 32%; top: 3%; background: rgba(78, 19, 77, 0.55); box-shadow: 0 0 16px rgba(0, 0, 0, 0.25), inset 0 0 4px rgba(0, 0, 0, 0.34); }
.backdrop i:nth-child(5) { width: 90vmax; height: 90vmax; max-width: 432px; max-height: 438px; left: 26%; top: 34%; background: rgba(36, 3, 56, 0.5); box-shadow: 0 0 12px rgba(0, 0, 0, 0.44), inset 0 0 8px rgba(0, 0, 0, 0.32); }
.backdrop i:nth-child(6) { width: 100vmax; height: 100vmax; max-width: 470px; max-height: 480px; left: -49%; top: 55%; background: rgba(62, 12, 80, 0.6); box-shadow: 0 0 12px rgba(0, 0, 0, 0.44), inset 0 0 8px rgba(0, 0, 0, 0.32); }
@media (min-width: 900px) {
  .backdrop i:nth-child(1) { left: -8%; }
  .backdrop i:nth-child(3) { left: 55%; }
  .backdrop i:nth-child(4) { left: 70%; }
  .backdrop i:nth-child(5) { left: 40%; top: 50%; }
}

/* Frosted indigo cards with big rounded corners (contrast with white text stays above 7:1). */
.card, .reading-card, .q-card, .j-item, .welcome, .mini-quote, .shelf-list, .stat {
  background: linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)), rgba(34, 24, 98, 0.72);
  border-color: rgba(255, 255, 255, 0.1);
}
.card, .reading-card, .q-card, .j-item, .welcome, .shelf-list { border-radius: 32px; }

/* Handwritten, letter-spaced titles. */
.section-title { font-size: 32px; letter-spacing: 0.1em; }
.card-title { font-size: 26px; letter-spacing: 0.1em; }

/* Chips: soft indigo, rounded 14px, spaced capitals. */
.chip, .tag {
  border-radius: 14px;
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.04)), rgba(50, 38, 133, 0.55);
  letter-spacing: 0.1em;
}
.chip:hover, .tag:hover { background: rgba(74, 60, 170, 0.7); }
.tag.on { background: var(--lav-soft); color: #2a1745; }
.chip.accent { background: var(--accent-strong); }

/* Quick-action orb. */
.orb { position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); z-index: 12; width: 64px; height: 64px; }
.orb-main, .orb-act {
  position: absolute;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
  background: rgba(96, 4, 76, 0.9);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.38), inset 0 0 12px rgba(0, 0, 0, 0.28);
}
.orb-main { inset: 0; z-index: 2; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5), inset 0 0 12px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.08); }
.orb-main .ms { font-size: 34px; }
.orb-act { width: 56px; height: 56px; left: 4px; top: 4px; opacity: 0; transform: scale(0.4); pointer-events: none; transition: transform 0.22s cubic-bezier(.2, .9, .3, 1.2), opacity 0.18s; }
.orb-act .ms { font-size: 27px; }
.orb-disc { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 50%; background: #010334; box-shadow: -1px -1px 8px rgba(0, 0, 0, 0.22), inset 0 0 2px rgba(0, 0, 0, 0.12); opacity: 0; transform: scale(0.3); pointer-events: none; transition: transform 0.25s ease, opacity 0.2s; }
.orb.open .orb-disc { opacity: 0.96; transform: none; }
.orb.open .orb-act { opacity: 1; pointer-events: auto; }
.orb.open .a1 { transform: translate(-96px, 0); }
.orb.open .a2 { transform: translate(-70px, -70px); }
.orb.open .a3 { transform: translate(0, -96px); }
.orb-act:focus-visible, .orb-main:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.reading-mode .orb, .bare-mode .orb { display: none; }
body[data-route='settings'] .orb, body[data-route='signup'] .orb { display: none; }
@media (min-width: 900px) { .orb { bottom: 32px; right: 32px; } }

/* ---------- Daily tasks card ---------- */
.home-tasks .tasks-card { margin-top: 18px; }
.add-task .ms { font-size: 28px; color: #fff; }
.task-list { list-style: none; margin: 10px 0 0; padding: 0; }
.task { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.task-check { display: grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; border: 0; background: none; color: #fff; }
.task-check .ms { font-size: 28px; }
.task.done .task-check { color: var(--accent); }
.task.done .task-check .ms { font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.task-text { flex: 1; min-width: 0; font-size: 16px; }
.task.done .task-text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.35); }
.task-del { opacity: 0.6; }
.task-del:hover, .task-del:focus-visible { opacity: 1; }
@media (hover: hover) { .task-del { opacity: 0; } .task:hover .task-del, .task-del:focus-visible { opacity: 0.8; } }

@media (min-width: 900px) {
  .home-grid {
    grid-template-areas:
      'reading quote'
      'reading goal'
      'tasks recs'
      'next recs';
    grid-template-rows: auto auto auto 1fr;
  }
  .home-tasks { grid-area: tasks; }
}

/* ---------- Settings panel (from the Figma popup) ---------- */
.settings-panel {
  max-width: 460px;
  margin: 8px auto 26px;
  padding: 18px 18px 14px;
  border-radius: 24px;
  background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)), rgba(38, 54, 133, 0.62);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.settings-head { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; }
.settings-head h1 { margin: 0; font: 700 32px/1 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; }
.settings-head .icon-btn { position: absolute; right: -4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; color: #fff; }
.settings-head .icon-btn .ms { font-size: 26px; }
.settings-panel .account-row { margin: 14px 0 6px; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.07); }
.settings-panel > .btn { margin-top: 14px; }
.set-list { list-style: none; margin: 8px 0 0; padding: 0; }
.set-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 0 4px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: none;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  font-size: 15.5px;
  letter-spacing: 0.04em;
}
.set-list li:last-child .set-row { border-bottom: 0; }
.set-row > .ms:first-child { font-size: 22px; color: var(--lav); }
.set-row > .ms:last-child { font-size: 20px; color: var(--faint); }
.set-label { flex: 1; min-width: 0; }
.set-label small { display: block; font-size: 12.5px; color: var(--faint); letter-spacing: 0; }
.set-value { color: var(--muted); font-size: 14px; }
button.set-row:hover, a.set-row:hover { background: rgba(255, 255, 255, 0.05); }

/* Home layout: phones get one column in reading order; wide screens get two calm columns. */
.home-grid { display: flex; flex-direction: column; }
.home-col { display: contents; }
.home-quote { order: 1; }
.home-reading { order: 2; }
.home-goal { order: 3; }
.home-tasks { order: 4; }
.home-recs { order: 5; }
.home-next { order: 6; }
@media (min-width: 900px) {
  .home-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-areas: none; grid-template-rows: none; gap: 0 44px; align-items: start; }
  .home-col { display: block; }
  .home-col > * { grid-area: auto; }
  .home-reading .section-title { margin-top: 0; }
  .home-quote .quote-card { margin-top: 0; }
}

/* Suggestions: every card the same shape, so covers, titles and buttons line up. */
.rec { display: flex; flex-direction: column; }
.rec .cover-md { width: 116px; height: 174px; aspect-ratio: auto; }
.rec-title { min-height: calc(2 * 1.3em); }
.rec-author { min-height: 1.4em; }
.rec .chip, .rec .pill-on { margin-top: 10px; align-self: flex-start; }

/* Your picture in the top bar (computers); phones reach the profile from Today and More. */
.tabbar .tab-me { display: none; }
@media (min-width: 900px) {
  .tabbar .tab-me { display: flex; flex: none; width: 44px; height: 44px; margin-left: 10px; padding: 0; border-radius: 50%; }
  .tabbar .tab-me .avatar { width: 40px; height: 40px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15); }
  .tabbar .tab-me.active .avatar { box-shadow: 0 0 0 2px var(--accent); }
}

/* =====================================================================
   DESIGN GUIDE v1 — the rules every screen follows (see #/design).
   Fonts: Amatic SC = headings ≥ 26px only · Poppins = everything read or tapped · Lora italic = quotes.
   Colour: text ≥ 4.5:1 on cards (AA); primary buttons white-on-berry 5.9:1. Targets ≥ 44px.
   ===================================================================== */

:root {
  /* Palette, nudged: deeper berry, brighter rose for text, lifted greys, warm lamp gold. */
  --bg: #160c2b;
  --card-solid: #3d356b;              /* what the frosted card looks like on the background */
  --text: #f7f2fc;                    /* 9.8:1 on card */
  --muted: #c9bedb;                   /* 6.1:1 on card */
  --faint: #b3a6cb;                   /* 4.8:1 on card */
  --lav: #c3b2dd;
  --lav-soft: #ddd5ea;
  --accent: #ff8cc4;                  /* rose: links & active marks, 5.1:1 on card */
  --accent-strong: #b52a72;           /* berry: primary buttons, white text 5.9:1 */
  --magenta: #60044c;
  --star: #ffc85a;                    /* lamp gold */
  --danger: #ffa0ad;

  --fs-display: 46px;
  --fs-h2: 32px;
  --fs-h3: 26px;
  --fs-lead: 18px;
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-caption: 13px;
  --fs-eyebrow: 12px;
  --tap: 44px;
}

body { font-size: var(--fs-body); line-height: 1.6; }

/* Handwriting stays for big headings only. */
.display, .page-head .display { font-size: var(--fs-display); }
.section-title { font-size: var(--fs-h2); letter-spacing: 0.06em; }
.card-title { font-size: var(--fs-h3); letter-spacing: 0.06em; }

/* Everything you tap uses Poppins: clear at small sizes. */
.btn, .chip, .seg button, .tag, .link-btn, .back, .tabbar a, .tabbar button, .more-item, .set-row {
  font-family: var(--font-ui);
  text-transform: none;
}
.btn { font-size: 16px; font-weight: 600; letter-spacing: 0.01em; min-height: var(--tap); }
.chip { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; min-height: var(--tap); display: inline-flex; align-items: center; gap: 6px; }
.chip .ms { font-size: 19px; }
.seg button { font-size: 14px; font-weight: 600; letter-spacing: 0.01em; min-height: 40px; }
.tag { font-size: 14px; font-weight: 600; letter-spacing: 0.01em; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.tag .ms { font-size: 18px; }
.tag.sm { font-size: 12.5px; min-height: 32px; }
.link-btn { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; min-height: var(--tap); }
.back { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; min-height: var(--tap); }
.r-actions .chip, .rec .chip { font-size: 14px; }
.tabbar a, .tabbar button { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.more-item { font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.today-label { font: 600 var(--fs-eyebrow)/1.3 var(--font-ui); letter-spacing: 0.12em; }
.eyebrow { font-size: var(--fs-eyebrow); letter-spacing: 0.12em; color: var(--lav); }
.hint, .card-empty { color: var(--faint); }
.muted { color: var(--muted); }
.rc-title, .r-title { font-size: var(--fs-lead); font-weight: 600; }
.sm-thought-text b { font-size: 28px; }   /* "Any thoughts?" stays handwritten: it's big */
p, li { max-width: 70ch; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { text-underline-offset: 3px; }
.card-empty a, .hint a, .goal-note a, .about-row a { color: var(--accent); }
.tag.on, .seg button.on { background: var(--lav-soft); color: #241340; }
@media (min-width: 900px) { .tabbar a:not(.tab-brand), .tabbar button { font-size: 14px; } }

/* ---------- New pieces ---------- */

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.field-label { margin: 18px 0 8px; font-size: var(--fs-small); font-weight: 600; color: var(--muted); }

/* Reading timer */
.timer-card { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 12px 12px 12px 18px; border-radius: 22px; background: linear-gradient(135deg, rgba(181, 42, 114, 0.55), rgba(61, 53, 107, 0.85)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.timer-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 140, 196, 0.25); }
@media (prefers-reduced-motion: no-preference) { .timer-dot { animation: pulse 1.6s ease-in-out infinite; } }
.timer-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.timer-text b { font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-text span { font: 600 26px/1.1 var(--font-ui); font-variant-numeric: tabular-nums; }

/* Log widget */
.home-log { order: 0; }
.log-widget { margin-top: 0; margin-bottom: 18px; }
.lw-title { margin: 8px 0 0; font-weight: 600; }
.lw-book-label select { margin-top: 10px; }
.lw-row { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; }
.lw-step { display: grid; place-items: center; width: 56px; height: 56px; flex: none; border: 0; border-radius: 50%; background: var(--magenta); color: #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35); }
.lw-step .ms { font-size: 30px; }
.lw-num { display: flex; flex-direction: column; align-items: center; }
.lw-num input { width: 130px; padding: 0; border: 0; background: none; color: var(--text); text-align: center; font: 700 44px/1.1 var(--font-ui); font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.lw-num input::-webkit-outer-spin-button, .lw-num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lw-num span { font-size: var(--fs-small); color: var(--muted); }
.lw-bar { margin: 14px 0 16px; }
.log-widget.big .lw-num input { font-size: 56px; width: 160px; }
.quicklog { max-width: 480px; margin: 0 auto; }
.quicklog .brand { text-align: center; margin: 8px 0 20px; }

/* Ratings: quarter stars */
.rate-input { margin-top: 12px; }
.rate-show { display: flex; align-items: center; gap: 14px; }
.rate-out { font: 600 var(--fs-lead) var(--font-ui); color: var(--star); }
.rate-range { width: 100%; margin: 12px 0 0; accent-color: var(--star); min-height: var(--tap); }
.stars-lg .star { width: 34px; height: 34px; }
.hero-stars { margin: 8px 0 0; }
.hero-stars .star { width: 18px; height: 18px; }
.take-card .seg { flex-wrap: nowrap; }

/* Book page */
.book-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.book-actions .chip.accent .ms { font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.book-format { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Four favourites */
.favs .section-title { margin-top: 18px; }
.fav-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fav { position: relative; display: block; }
.fav .cover-md { width: 100%; }
.fav-x { position: absolute; top: -8px; right: -8px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: var(--card-solid); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
.fav-x .ms { font-size: 16px; }
.empty-fav { display: grid; place-items: center; aspect-ratio: 2 / 3; border-radius: 10px; border: 2px dashed rgba(255, 255, 255, 0.25); color: var(--muted); text-decoration: none; }
.empty-fav .ms { font-size: 28px; }
.stats-link { margin-top: 18px; }

/* Stats */
.stat-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-tile { padding: 16px; border-radius: 22px; background: linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)), rgba(34, 24, 98, 0.72); }
.stat-tile b { display: block; font: 700 30px/1.1 var(--font-ui); font-variant-numeric: tabular-nums; }
.stat-tile span { font-size: var(--fs-small); color: var(--muted); }
@media (min-width: 600px) { .stat-tiles { grid-template-columns: repeat(4, 1fr); } }
.hbars { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.hbars li { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 10px; max-width: none; }
.hb-label { font-size: var(--fs-small); color: var(--muted); text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 12px; }
.hb-fill { display: block; height: 100%; min-width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.hb-val { font-size: var(--fs-small); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.vbars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 150px; margin-top: 14px; align-items: end; }
.vb { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.vb-val { font-size: 12px; font-weight: 600; min-height: 18px; }
.vb-bar { width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; background: var(--accent); }
.vb-label { margin-top: 6px; font-size: 12px; color: var(--muted); }
.quest-list { list-style: none; margin: 10px 0 0; padding: 0; }
.quest { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.quest .ms { font-size: 26px; color: var(--muted); }
.quest.done .ms { color: var(--accent); font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.q-label { flex: 1; }
.q-count { font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; }

/* Search mood picks */
.mood-picks { margin-bottom: 4px; }

/* Design guide page */
.guide .g-font { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.guide .g-font:last-child { border-bottom: 0; }
.guide .g-font p { margin: 4px 0 0; font-size: var(--fs-small); color: var(--muted); }
.g-sample { color: var(--text) !important; }
.display-sample { font: 700 40px/1.1 var(--font-display) !important; }
.ui-sample { font: 600 20px/1.3 var(--font-ui) !important; }
.quote-sample { font: italic 400 21px/1.4 var(--font-quote) !important; }
.g-scale, .g-swatches, .g-rules { list-style: none; margin: 12px 0 0; padding: 0; }
.g-scale li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); max-width: none; }
.g-scale small { color: var(--faint); font-size: 12px; }
.t-display { font: 700 46px/1 var(--font-display); }
.t-h2 { font: 700 32px/1 var(--font-display); letter-spacing: 0.06em; }
.t-h3 { font: 700 26px/1 var(--font-display); letter-spacing: 0.06em; }
.t-lead { font: 600 18px/1.3 var(--font-ui); }
.t-body { font: 400 16px/1.6 var(--font-ui); }
.t-small { font: 500 14px/1.5 var(--font-ui); color: var(--muted); }
.t-eyebrow { font: 600 12px/1.3 var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--lav); }
.g-swatches li { display: flex; align-items: center; gap: 12px; padding: 8px 0; max-width: none; }
.g-chip { width: 40px; height: 40px; flex: none; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.g-name { flex: 1; min-width: 0; font-size: var(--fs-small); }
.g-name code { font-size: 12px; color: var(--faint); }
.g-name small { display: block; color: var(--muted); }
.g-ratio { font-size: var(--fs-small); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.g-ratio small { display: block; font-weight: 500; color: var(--muted); }
.g-ratio.bad { color: var(--danger); }
.g-rules li { position: relative; padding: 6px 0 6px 18px; color: var(--muted); }
.g-rules li::before { content: ''; position: absolute; left: 0; top: 15px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.g-rules b { color: var(--text); }
.book-shelf .seg button, .take-card .seg button { padding: 0 10px; }

/* =====================================================================
   POLISH PASS + MENU DRAWER
   ===================================================================== */

/* Menu drawer — slides in from the left (from the Figma menu screen). */
.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(86vw, 380px);
  max-width: none;
  height: 100%;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0 36px 36px 0;
  background: linear-gradient(170deg, #4a0a33 0%, #3a0628 55%, #2a041e 100%);
  color: var(--text);
  box-shadow: 18px 0 50px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}
.drawer::backdrop { background: rgba(8, 3, 16, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@media (prefers-reduced-motion: no-preference) {
  .drawer[open] { animation: drawer-in 0.24s cubic-bezier(.2, .8, .2, 1); }
  .drawer.closing { animation: drawer-out 0.18s ease-in forwards; }
  @keyframes drawer-in { from { transform: translateX(-100%); } }
  @keyframes drawer-out { to { transform: translateX(-100%); } }
}
.dr-panel { min-height: 100%; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 34px) 20px calc(env(safe-area-inset-bottom) + 24px); outline: none; }
.dr-head { position: relative; padding: 0 6px; }
.dr-avatar { display: inline-flex; border-radius: 50%; text-decoration: none; }
.dr-avatar .avatar-xl { width: 116px; height: 116px; font-size: 42px; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45); }
.dr-more { position: absolute; top: 0; right: 0; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.85); color: #fff; text-decoration: none; }
.dr-more .ms { font-size: 26px; }
.dr-name { margin: 18px 0 0; font: 600 19px/1.3 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; }
.dr-handle { margin: 2px 0 0; font-size: var(--fs-small); color: #c7b4e8; }
.dr-list { display: grid; gap: 10px; margin-top: 26px; }
.dr-row {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(20, 0, 12, 0.32);
  color: #fff;
  text-decoration: none;
  font: 500 17px/1.2 var(--font-ui);
  transition: background 0.15s, transform 0.1s;
}
.dr-row:hover { background: rgba(255, 255, 255, 0.08); }
.dr-row:active { transform: scale(0.98); }
.dr-row .ms { font-size: 30px; font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 24; }
.dr-foot { margin: auto 0 0; padding-top: 24px; text-align: center; font-size: var(--fs-caption); color: rgba(255, 255, 255, 0.55); }

/* Screen transition */
@media (prefers-reduced-motion: no-preference) {
  .app.enter > * { animation: page-in 0.22s ease-out both; }
  @keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
}

/* Cards: one consistent depth and padding everywhere. */
.card, .reading-card, .q-card, .j-item, .welcome, .shelf-list, .stat-tile, .now-card, .settings-panel, .timer-card {
  box-shadow: 0 12px 32px rgba(8, 3, 22, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.card { padding: 20px; margin-top: 16px; }
.reading-card { padding: 18px; margin-bottom: 14px; }
.section-title { margin: 34px 0 14px; }
.quote-card { box-shadow: 0 18px 40px rgba(8, 3, 22, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12); }

/* Inputs: calmer fill, clear focus. */
.input { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); transition: border-color 0.15s, background 0.15s; }
.input:hover { border-color: rgba(255, 255, 255, 0.24); }
.input:focus { outline: none; border-color: var(--accent); background: rgba(255, 255, 255, 0.1); box-shadow: 0 0 0 3px rgba(255, 140, 196, 0.2); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 44px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }

/* Buttons: soft press, gentle hover. */
.btn, .chip, .tag, .round-btn, .lw-step, .orb-main, .orb-act { transition: transform 0.1s, filter 0.15s, background 0.15s; }
.btn:hover, .round-btn:hover, .lw-step:hover { filter: brightness(1.08); }
.btn:active, .chip:active, .tag:active, .round-btn:active, .lw-step:active { transform: scale(0.96); }
.btn.primary { box-shadow: 0 8px 20px rgba(181, 42, 114, 0.35); }

/* Sheets: frosted, with a handle. */
.sheet { background: linear-gradient(rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.06)), #261744; border-color: rgba(255, 255, 255, 0.1); box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.45); }
.sheet-form { position: relative; padding-top: 26px; }
.sheet-form::before { content: ''; position: absolute; top: 10px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); }
.sheet::backdrop { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

/* Covers: a hairline edge so light covers don't melt into the page. */
.cover { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.08); }

/* Toast: matches the dark theme. */
.toast { background: #f7f2fc; color: #241340; border-radius: 18px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45); }
.toast button { color: var(--accent-strong); }

/* Tab bar: a hairline of light on top. */
.tabbar { box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08); }

/* Settings: the panel is as wide as the cards below it, so they line up. */
.settings-panel { max-width: none; margin: 0 0 16px; padding: 22px 24px 16px; border-radius: 32px; }
.settings-panel + .card { margin-top: 16px; }

/* Your picture is the menu button: the last tab on phones, the picture at the right on computers. */
.tabbar .tab-me { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.tabbar .tab-me .avatar { width: 30px; height: 30px; font-size: 12px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18); }
.tabbar .tab-me.active { background: transparent; }
.tabbar .tab-me.active .avatar { box-shadow: 0 0 0 2px var(--accent); }
.tabbar .tab-me > span:last-child { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.today-orb { border: 0; padding: 0; cursor: pointer; }
@media (min-width: 900px) {
  .tabbar .tab-me { flex-direction: row; width: auto; height: 44px; margin-left: 10px; padding: 0; background: none; }
  .tabbar .tab-me > span:last-child { display: none; }
  .tabbar .tab-me .avatar { width: 40px; height: 40px; font-size: 15px; }
}

/* "More" dropdown */
.tabbar { grid-template-columns: repeat(6, 1fr); }
.tabbar .tab-more.open .ms { background: var(--magenta); color: #fff; }
.more-menu {
  position: absolute;
  right: 8px;
  bottom: calc(100% + 10px);   /* phones: opens upward from the tab bar */
  z-index: 30;
  width: min(290px, calc(100vw - 32px));
  padding: 8px;
  border-radius: 22px;
  background: linear-gradient(rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.07)), #2a1846;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
}
.more-menu[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .more-menu:not([hidden]) { animation: mm-in 0.16s ease-out; }
  @keyframes mm-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
}
.mm-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  font: 500 15px/1.2 var(--font-ui);
  cursor: pointer;
}
.mm-item:hover, .mm-item:focus-visible { background: rgba(255, 255, 255, 0.09); outline: none; }
.mm-item .ms { font-size: 22px; color: var(--lav); }
.mm-sep { height: 1px; margin: 6px 10px; background: rgba(255, 255, 255, 0.1); }
@media (min-width: 900px) {
  .tabbar { position: fixed; }
  .tabbar .tab-more { position: relative; }
  .more-menu { top: calc(100% - 4px); bottom: auto; right: max(32px, calc((100% - 1120px) / 2) + 54px); }
  @keyframes mm-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
}
.tabbar .more-menu .mm-item { flex-direction: row; justify-content: flex-start; gap: 14px; height: auto; min-height: 46px; padding: 0 14px; border-radius: 14px; font: 500 15px/1.2 var(--font-ui); letter-spacing: 0; text-transform: none; color: var(--text); white-space: nowrap; }
.tabbar .more-menu .mm-item .ms { padding: 0; font-size: 22px; background: none; color: var(--lav); }
.tabbar .more-menu .mm-item:hover, .tabbar .more-menu .mm-item:focus-visible { background: rgba(255, 255, 255, 0.09); }
body.menu-open .orb { display: none; }
.login-line { margin: 18px 0 0; color: var(--muted); font-size: var(--fs-small); }
.login-line .link-btn { padding: 8px 4px; }
.landing .login-line { margin-top: 26px; }

/* ---------- Profile (calm, two columns on wide screens) ---------- */
.profile { display: grid; gap: 22px; }
.pf-head { display: flex; align-items: center; gap: 20px; }
.pf-id { min-width: 0; }
.pf-head .profile-name { margin: 0; display: flex; align-items: center; gap: 8px; font: 600 26px/1.2 var(--font-ui); letter-spacing: 0; text-transform: none; overflow-wrap: anywhere; }
.pf-edit { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--muted); text-decoration: none; }
.pf-edit:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.pf-genres { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pf-block .cover-strip { margin-top: 12px; }
.pf-cur { position: relative; text-decoration: none; }
.pf-cur span { display: block; margin-top: 6px; font-size: var(--fs-caption); color: var(--muted); text-align: center; }
.pf-favs { text-align: center; }
.pf-fav-title { margin: 0 0 14px; display: inline-flex; align-items: center; gap: 8px; font: 700 var(--fs-h3)/1 var(--font-display); letter-spacing: 0.06em; }
.pf-fav-title .ms { font-size: 22px; color: var(--star); font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.shelf { padding: 0 6px; }
.shelf .fav-row { align-items: end; padding: 0 10px; }
.shelf-board { height: 12px; margin-top: -2px; border-radius: 4px; background: linear-gradient(#6b3d2a, #3d2116); box-shadow: 0 10px 18px rgba(0, 0, 0, 0.45); }
.pf-nums { display: grid; grid-template-columns: 1fr 1fr; padding: 16px 8px; text-align: center; }
.pf-nums a { display: flex; flex-direction: column; text-decoration: none; }
.pf-nums a + a { border-left: 1px solid rgba(255, 255, 255, 0.12); }
.pf-nums b { font: 700 28px/1.1 var(--font-ui); }
.pf-nums span { margin-top: 2px; font-size: var(--fs-eyebrow); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.pf-goal { display: flex; align-items: center; gap: 16px; }
.pf-goal .ring { width: 70px; height: 70px; }
.pf-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.pf-buttons .btn { flex: 1 1 auto; }
.pf-side > * + * { margin-top: 16px; }
.pf-side .card { margin-top: 16px; }
@media (min-width: 900px) {
  body[data-route='me'] .app { max-width: 1120px; }
  .profile { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 48px; align-items: start; }
  .pf-head .avatar-xl { width: 120px; height: 120px; font-size: 42px; }
  .pf-head .profile-name { font-size: 34px; }
}

/* ---------- Explore filters ---------- */
.filters { padding: 0; margin-top: 16px; }
.filters summary { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 20px; cursor: pointer; list-style: none; font: 600 16px/1.2 var(--font-ui); }
.filters summary::-webkit-details-marker { display: none; }
.filters summary > span { flex: 1; }
.filters summary .ms:last-child { transition: transform 0.2s; color: var(--muted); }
.filters[open] summary .ms:last-child { transform: rotate(180deg); }
.f-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 6px; padding: 0 6px; border-radius: 11px; background: var(--accent-strong); color: #fff; font-size: 12px; }
.filter-form { padding: 0 20px 20px; }
.filter-form fieldset { border: 0; padding: 0; margin: 18px 0 0; }
.filter-form legend { padding: 0; margin-bottom: 10px; font: 600 15px/1.3 var(--font-ui); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px; }
@media (min-width: 600px) { .check-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.radio-row { display: flex; flex-wrap: wrap; gap: 2px 18px; margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
.year-row { display: flex; gap: 12px; }
.year-row label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-small); color: var(--muted); }
.year-row .input { width: 120px; }
.filter-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 22px; }
.sort-row { margin-top: 16px; }
.sort select { width: auto; min-width: 230px; }

/* Result cards */
.result { display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: start; }
.r-meta { margin: 4px 0 0; font-size: var(--fs-caption); color: var(--muted); }
.r-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.r-tags .tag.sm { pointer-events: none; text-transform: lowercase; }
.r-side { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.r-side .pill-on { margin-top: 0; display: inline-flex; align-items: center; gap: 4px; }
.r-side .pill-on .ms { font-size: 18px; }
.status-pick select { min-height: var(--tap); padding: 0 40px 0 14px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.14); background-color: rgba(50, 38, 133, 0.55); color: var(--text); font: 600 14px var(--font-ui); appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
@media (min-width: 700px) {
  .result { grid-template-columns: auto 1fr 220px; }
  .r-side { grid-column: auto; flex-direction: column; align-items: stretch; }
  .r-side .chip, .r-side .status-pick select { width: 100%; justify-content: center; }
}

/* Track progress */
.tp-row { display: flex; gap: 10px; }
.tp-num { width: 120px; font: 600 20px var(--font-ui); text-align: center; }
.tp-unit { width: 120px; }
.tp-more { margin-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.tp-more summary { display: flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; list-style: none; font-weight: 600; }
.tp-more summary::-webkit-details-marker { display: none; }
.tp-finish { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 4px; border: 0; border-top: 1px solid rgba(255, 255, 255, 0.1); background: none; color: var(--text); font: 600 15px var(--font-ui); cursor: pointer; }
.tp-finish .ms, .tp-more summary .ms { font-size: 20px; color: var(--lav); }
.lw-links { display: grid; margin-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.lw-link { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: none; color: var(--text); font: 500 15px var(--font-ui); cursor: pointer; }
.lw-link:last-child { border-bottom: 0; }
.lw-link .ms { font-size: 20px; color: var(--lav); }
.lw-link:hover { background: rgba(255, 255, 255, 0.05); }
.started-line { display: flex; align-items: center; gap: 2px; }
.sm-edit { width: 36px; height: 36px; }

/* ---------- Calmer book page & My Books ---------- */
.shelf-tabs .seg { overflow-x: auto; }
.shelf-tabs .seg button { flex: 1 0 auto; }
.main-card .main-lead { margin: 10px 0 0; font: 600 var(--fs-lead)/1.4 var(--font-ui); }
.main-card .bar { margin-top: 12px; }
.main-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.main-actions .btn { flex: 1 1 160px; }
.main-actions .btn .ms, .main-card .btn .ms { font-size: 20px; }
.more-opts { padding: 0; }
.more-opts summary { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 20px; cursor: pointer; list-style: none; font: 600 16px/1.2 var(--font-ui); }
.more-opts summary::-webkit-details-marker { display: none; }
.more-opts summary > span { flex: 1; }
.more-opts summary .ms:last-child { color: var(--muted); transition: transform 0.2s; }
.more-opts[open] summary .ms:last-child { transform: rotate(180deg); }
.mo-body { padding: 0 20px 22px; }
.mo-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mo-body .card { margin-top: 18px; background: rgba(255, 255, 255, 0.05); box-shadow: none; }
.mo-body .detail-grid { margin-top: 8px; }
/* One "+" per screen: the floating quick-action orb is retired (Today's Log widget does its job). */
.orb { display: none !important; }
.lib-controls { grid-template-columns: minmax(0, 1fr); }
.lib-controls > * { min-width: 0; }
.shelf-tabs .seg { max-width: 100%; }

/* ---------- Book info (StoryGraph-inspired) ---------- */
.book-meta { margin: 6px 0 0; font-size: var(--fs-small); color: var(--muted); }
.book-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.btag { padding: 4px 10px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.16); font-size: 12.5px; font-weight: 600; color: var(--lav-soft); }
.btag.mood { color: var(--accent); border-color: rgba(255, 140, 196, 0.35); }
.desc summary { list-style: none; cursor: pointer; }
.desc summary::-webkit-details-marker { display: none; }
.desc-text { margin: 12px 0 0; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; color: var(--text); }
.desc[open] .desc-text { display: block; -webkit-line-clamp: unset; }
.desc-more { display: inline-block; margin-top: 6px; font-weight: 600; color: var(--accent); }
.desc[open] .desc-more { display: none; }
.find-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
a.chip { color: var(--text); }
.rq { margin-top: 14px; }
.rq-q { display: block; margin-bottom: 8px; font-size: var(--fs-small); color: var(--text); }
.cw-list { list-style: none; margin: 0 0 10px; padding: 0; }
.cw-list li { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.cw-level { padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; text-transform: capitalize; background: rgba(255, 255, 255, 0.1); }
.cw-graphic { background: rgba(255, 160, 173, 0.25); color: #ffd0d7; }
.cw-moderate { background: rgba(255, 200, 90, 0.2); color: #ffe2a8; }
.cw-list .icon-btn { margin-left: auto; }
.home-reading .section-title { margin-top: 0; }
@media (max-width: 899px) { .home-reading { order: 0; } .home-quote { order: 1; } }
a.r-title { display: block; color: var(--text); text-decoration: none; }
a.r-title:hover { text-decoration: underline; }
.result > a { display: block; }
.file-actions-top { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.file-actions-top .btn { flex: 1 1 160px; }
.file-link { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: var(--fs-small); }
.file-link .link-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.file-link .ms { font-size: 18px; vertical-align: -4px; }

/* =====================================================================
   DESIGN FIXES v2 — Poppins headings, fewer boxes, calmer background,
   AA contrast, one button style, 5 tabs.
   ===================================================================== */

:root {
  --font-display: 'Poppins', system-ui, -apple-system, sans-serif;
  --muted: #d9d0e8;   /* ≥ 7:1 on the page background */
  --faint: #c6bad9;   /* ≥ 5:1 on the page background and on cards */
  --fs-display: 32px;
  --fs-h2: 21px;
  --fs-h3: 18px;
}

/* 1. Headings: Poppins Bold, normal case, slightly tight. */
.display, .page-head .display, .section-title, .card-title, .welcome h2, .landing-title, .sheet-form h2, .form-head h1,
.settings-head h1, .pf-fav-title, .profile-name, .today-date, .brand, .tabbar .tab-brand, .t-display, .t-h2, .t-h3,
.sm-thought-text b, .display-sample, .dr-name {
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
  text-transform: none !important;
  letter-spacing: -0.01em !important;
}
.display, .page-head .display { font-size: var(--fs-display) !important; line-height: 1.15 !important; }
.section-title { font-size: var(--fs-h2) !important; line-height: 1.3 !important; margin: 32px 0 12px; text-wrap: balance; }
.section-title i { font-style: normal; color: var(--lav-soft); }
.card-title { font-size: var(--fs-h3) !important; line-height: 1.3 !important; color: var(--text); }
.welcome h2, .landing-title { font-size: 28px !important; }
.sheet-form h2, .form-head h1, .settings-head h1 { font-size: 22px !important; }
.brand, .tabbar .tab-brand { font-size: 24px !important; color: var(--accent) !important; }
.pf-fav-title { font-size: 20px !important; }
.sm-thought-text b { font-size: 20px !important; }
.t-display { font-size: 34px !important; } .t-h2 { font-size: 22px !important; } .t-h3 { font-size: 18px !important; }
.display-sample { font-size: 28px !important; }
.cover-ph-title { font: 700 1.05em/1.15 var(--font-ui) !important; letter-spacing: 0; }
.landing-start { font: 600 18px/1 var(--font-ui) !important; letter-spacing: 0.02em !important; }

/* 3. Calmer background circles. */
.backdrop { opacity: 0.38; filter: blur(2px); }

/* 2. Fewer boxes: flat sections with thin dividers. */
.flat { padding: 4px 0 0; margin-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.flat > .section-title:first-child, .flat .row-between:first-child .section-title { margin-top: 20px; }
.home-quote .quote-card { margin: 4px 0 0; padding: 4px 0 0 18px; background: none; border-radius: 0; box-shadow: none; border-left: 3px solid var(--accent); }
.home-quote .quote-card blockquote { font-size: 19px; }
.goal-flat { display: block; }
.goal-flat.goal-link { display: flex; align-items: center; gap: 18px; padding-top: 6px; color: inherit; text-decoration: none; }
.goal-flat.goal-link .section-title { margin: 14px 0 4px; }
.goal-flat .btn { margin-top: 12px; }
.goal-flat .muted { margin: 0; }
.tasks-card { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.tasks-card .add-task { margin-top: 18px; }
.home-recs, .home-next { border-top: 1px solid rgba(255, 255, 255, 0.1); margin-top: 8px; }
.pf-block { border-top: 0; }
.pf-nums { display: grid; grid-template-columns: 1fr 1fr; padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); text-align: center; }
.pf-goal { display: flex; align-items: center; gap: 16px; padding-top: 14px; border-top: 0; }
.pf-goal-set { width: 100%; }
#book-info { margin-top: 18px; }

/* Currently reading = the hero card. */
.reading-card.hero { gap: 20px; padding: 20px; }
.cover-hero { width: 96px; font-size: 12px; }
.reading-card.hero .rc-title { font-size: 19px; }
.reading-card .rc-actions { margin-top: 14px; }
.reading-card .rc-actions .btn { min-height: 44px; padding: 0 20px; }

/* 4. Contrast for small text. */
.rc-meta, .hint, .card-empty, .book-meta, .u-date, .entry-meta, .r-meta, .goal-note, .more-quotes, .q-by, .tile-sub, .r-sub, .rc-author, .profile-handle { color: var(--muted) !important; }
.more-quotes { font-weight: 600; }

/* 5. One button style: pink primary; one quiet secondary for everything else. */
.btn, .chip { border-radius: 999px; }
.btn:not(.primary):not(.danger), .chip:not(.accent) {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
}
.btn:not(.primary):not(.danger):hover, .chip:not(.accent):hover { background: rgba(255, 255, 255, 0.14); }
.btn.primary, .chip.accent { background: var(--accent-strong); border-color: transparent; color: #fff; }

/* 6. Five tabs. */
.tabbar .tab-more { display: none !important; }
.tabbar { grid-template-columns: repeat(5, 1fr) !important; }

/* 9. No two-line summaries; the "…" menu. */
.more-opts summary, .filters summary { white-space: nowrap; }
.more-opts summary > span, .filters summary > span { overflow: hidden; text-overflow: ellipsis; text-align: left; }
.find-row { align-items: center; }
.find-more { position: relative; }
.find-more summary { list-style: none; width: 48px; padding: 0; justify-content: center; }
.find-more summary::-webkit-details-marker { display: none; }
.find-menu { position: absolute; left: 0; top: calc(100% + 8px); z-index: 20; width: 230px; padding: 6px; border-radius: 18px; background: #2a1846; border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); }
.find-menu a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--text); text-decoration: none; font-size: 15px; }
.find-menu a:hover { background: rgba(255, 255, 255, 0.08); }
.find-menu .ms { font-size: 20px; color: var(--lav); }

/* 10. Greeting with room to breathe. */
.today-head { gap: 12px; align-items: center; }
.today-card { padding: 14px 16px 14px 18px; }
.today-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px !important; }
.today-date { font-size: 22px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px !important; }
.today-icons { gap: 4px; flex: none; align-self: center; }
.today-icons a { width: 40px; height: 40px; border-radius: 50%; }
.today-icons a:hover { background: rgba(255, 255, 255, 0.08); }
.today-orb { width: 48px !important; height: 48px !important; }
.today-orb .avatar-fill { font-size: 18px; }

/* Fix: icons inside these summaries must not stretch. */
.more-opts summary > span:not(.ms), .filters summary > span:not(.ms) { flex: 1 1 auto; min-width: 0; }
.more-opts summary > .ms, .filters summary > .ms { flex: none !important; width: 1em; }
.find-menu { left: auto; right: 0; }
@media (max-width: 599px) {
  .today-orb { display: none !important; }   /* the You tab is right below */
  .today-card { flex: 1; }
}

/* ---------- Guest landing page ---------- */
.landing2 { max-width: 760px; margin: 0 auto; }
.l-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
.l-top .brand { margin: 0; }
.l-hero h1 { margin: 0; font: 700 38px/1.1 var(--font-display); letter-spacing: -0.02em; text-wrap: balance; }
.l-sub { margin: 16px 0 0; font-size: 17px; line-height: 1.6; color: var(--muted); }
.l-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.l-cta .btn { flex: 1 1 200px; min-height: 52px; font-size: 16px; }
.l-quote { margin: 36px 0 0; padding-left: 18px; border-left: 3px solid var(--accent); }
.l-quote blockquote { margin: 0; font: italic 400 20px/1.5 var(--font-quote); }
.l-quote figcaption { margin-top: 8px; color: var(--muted); }
.l-band { margin: 56px 0 0; padding: 28px 24px; border-radius: 28px; background: linear-gradient(135deg, rgba(181, 42, 114, 0.45), rgba(61, 53, 107, 0.7)); }
.l-band h2 { margin: 0; font: 600 22px/1.4 var(--font-display); text-wrap: balance; }
.l-band em { font-style: normal; color: #ffd0e6; }
.l-split { display: grid; gap: 30px; margin-top: 48px; }
.l-split h2, .l-grid-wrap > h2, .l-faq h2, .l-final h2 { margin: 0 0 8px; font: 700 22px/1.3 var(--font-display); letter-spacing: -0.01em; }
.l-split p { margin: 0; color: var(--muted); line-height: 1.6; }
.l-grid-wrap { margin-top: 56px; padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.l-grid { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 20px; }
.lf { display: flex; gap: 14px; max-width: none; }
.lf > .ms { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--magenta); color: #fff; font-size: 22px; }
.lf h3 { margin: 2px 0 2px; font: 600 16px/1.3 var(--font-ui); }
.lf p { margin: 0; color: var(--muted); font-size: 15px; }
.l-faq { margin-top: 56px; padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.faq { border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; cursor: pointer; list-style: none; font: 600 16px/1.4 var(--font-ui); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ms { color: var(--muted); transition: transform 0.2s; }
.faq[open] summary .ms { transform: rotate(180deg); }
.faq p { margin: 0 0 16px; color: var(--muted); line-height: 1.6; }
.l-final { margin: 56px 0 20px; text-align: center; }
.l-final .btn { min-width: 260px; min-height: 52px; }
@media (min-width: 700px) {
  .l-hero h1 { font-size: 52px; }
  .l-split { grid-template-columns: 1fr 1fr; gap: 36px 44px; }
  .l-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) { body[data-route='welcome'] .app { max-width: 900px; } }

/* ---------- Header v3: Today · My Books · Quotes · Community · Challenges · Explore · 🔔 · avatar ---------- */
.tabbar .tab-wide, .tabbar .tab-bell { display: none; }
.pf-menu { border: 0; background: none; cursor: pointer; }
.notes { list-style: none; margin: 14px 0 0; padding: 0; }
.notes a { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); color: var(--text); text-decoration: none; }
.notes .ms { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--magenta); color: #fff; font-size: 20px; }
@media (min-width: 900px) {
  .tabbar { padding: 0 max(28px, calc((100% - 1200px) / 2)) !important; gap: 4px !important; height: 64px !important; }
  .tabbar .tab-wide { display: flex; }
  .tabbar a:not(.tab-brand):not(.tab-me), .tabbar button:not(.tab-me) {
    flex-direction: row; gap: 6px; height: 40px; padding: 0 12px !important;
    font-size: 14px !important; font-weight: 500 !important; letter-spacing: 0 !important;
    text-transform: none !important; border-radius: 999px;
  }
  .tabbar a:not(.tab-brand):hover { background: rgba(255, 255, 255, 0.06); }
  .tabbar .ms { font-size: 20px !important; padding: 4px !important; }
  .tabbar .tab-bell { display: grid; place-items: center; position: relative; width: 44px; height: 44px; padding: 0 !important; margin-left: 8px; border: 0; background: none; color: var(--text); cursor: pointer; }
  .tabbar .tab-bell .ms { font-size: 24px !important; padding: 0 !important; }
  .bell-dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #1d1131; }
  .tabbar .tab-me { margin-left: 2px !important; }
  .tabbar .tab-me .avatar { width: 38px !important; height: 38px !important; }
}
@media (min-width: 900px) and (max-width: 1180px) {
  .tabbar .tab-wide .ms, .tabbar a[data-route] .ms { display: none; }
}
@media (min-width: 900px) {
  .tabbar { align-items: center !important; }
  .tabbar .tab-brand { display: flex !important; align-items: center; height: 64px; line-height: 1 !important; margin: 0 auto 0 0 !important; padding: 0 !important; font-size: 26px !important; }
}
.see-all { display: inline-flex; align-items: center; gap: 2px; margin-top: 20px; font-size: 14px; text-decoration: none; }
.see-all .ms { font-size: 18px; }
.home-reading > .row-between .section-title { margin-top: 0; }
.pf-buttons .btn .ms { font-size: 20px; }
.home-reading > .row-between { align-items: center; }
.home-reading > .row-between .see-all { margin-top: 0; min-height: 44px; }
@media (max-width: 899px) {
  .tabbar a > span:not(.ms), .tabbar .tab-me > span:last-child { font-size: 10px !important; letter-spacing: 0 !important; }
  .tabbar a, .tabbar button { padding: 0 2px !important; }
}

/* ---------- Phone landing for guests ---------- */
.g-mobile { display: none; }
@media (max-width: 699px) {
  .g-mobile { display: block; }
  .landing2 { display: none; }
  body[data-route='welcome'] .app { padding-top: calc(env(safe-area-inset-top) + 10px); }
}
.g-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; margin: 0 -16px; padding: 10px 16px 12px; background: rgba(23, 13, 41, 0.92); border-bottom: 1px solid rgba(255, 255, 255, 0.08); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.g-search { position: relative; flex: 1; }
.g-search .ms { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 22px; pointer-events: none; }
.g-search .input { padding-left: 44px; min-height: 50px; border-radius: 14px; font-size: 16px; }
.g-menu { width: 48px; height: 48px; color: var(--text); }
.g-menu .ms { font-size: 30px; }
.g-hero { padding: 56px 8px 46px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.g-hero h1 { margin: 0; font: 700 30px/1.2 var(--font-display); letter-spacing: -0.01em; color: var(--text); text-wrap: balance; }
.g-cta { display: flex; justify-content: center; gap: 14px; margin-top: 30px; }
.g-cta .btn { min-width: 120px; min-height: 52px; font-size: 18px; border-radius: 14px !important; }
.g-cta .g-login { background: var(--lav-soft) !important; color: #241340 !important; border: 0 !important; }
.g-row { margin-top: 36px; }
.g-row-head { display: flex; align-items: center; justify-content: space-between; }
.g-row-head h2 { margin: 0; font: 700 22px/1.3 var(--font-display); color: var(--text); }
.g-row-head .icon-btn { width: 44px; height: 44px; color: var(--text); }
.g-row-head .icon-btn .ms { font-size: 26px; }
.g-covers { display: flex; gap: 10px; margin: 16px -16px 0; padding: 0 16px 8px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.g-covers::-webkit-scrollbar { display: none; }
.g-cover { flex: none; width: 96px; height: 144px; padding: 0; border: 0; border-radius: 4px; overflow: hidden; background: rgba(255, 255, 255, 0.08); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4); scroll-snap-align: start; cursor: pointer; }
.g-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-cover.sk { animation: pulse 1.2s ease-in-out infinite; }
.g-foot { margin-top: 48px; padding: 20px 0 10px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.g-foot p { margin: 0 0 4px; }
.g-foot .link-btn { padding: 4px 2px; font-size: 15px; min-height: 0; }
.g-menu-list { display: grid; gap: 10px; margin-top: 14px; }
.g-cta .btn.g-login { background: var(--lav-soft) !important; color: #241340 !important; border: 0 !important; }
.g-covers { scroll-padding-left: 16px; }

/* =====================================================================
   iPHONE: tab bar = icons only, current one bolder (no coloured circle, ever);
   Today header from the Figma design.
   ===================================================================== */
.ph-only { display: none; }
@media (max-width: 699px) {
  /* Tab bar */
  .tabbar a > span:not(.ms), .tabbar button > span:not(.ms):not(.bell-dot), .tabbar .tab-me > span:last-child { display: none !important; }
  .tabbar a, .tabbar button { background: transparent !important; }
  .tabbar .ms { background: transparent !important; padding: 9px !important; border-radius: 50%; font-size: 27px !important; color: rgba(255, 255, 255, 0.62) !important;
    font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 24 !important; transition: background 0.15s, font-variation-settings 0.15s; }
  .tabbar .active .ms, .tabbar [aria-current] .ms { background: transparent !important; color: #fff !important;
    font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24 !important; }
  .tabbar a:active .ms, .tabbar button:active .ms { background: rgba(255, 255, 255, 0.08) !important; }
  .tabbar .tab-me .avatar { width: 30px !important; height: 30px !important; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) !important; }
  .tabbar .tab-me.active .avatar { box-shadow: 0 0 0 2px #fff !important; }
  .tabbar .tab-me:active .avatar { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08) !important; }

  /* Today header */
  .ph-only { display: block; }
  body[data-route='today'] .today-head { display: none; }
  body[data-route='today'] .home-reading { display: none; }
  .ph-head { display: flex; align-items: center; gap: 16px; margin: 4px 0 22px; }
  .ph-avatar { flex: none; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; text-decoration: none; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }
  .ph-avatar .avatar-fill { font-size: 24px; }
  .ph-hello { flex: 1; min-width: 0; }
  .ph-hi { margin: 0; font: 700 18px/1.25 var(--font-display); letter-spacing: 0.02em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ph-ask { margin: 2px 0 0; font: 500 16px/1.3 var(--font-ui); color: var(--muted); }
  .ph-search { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: var(--lav); text-decoration: none; }
  .ph-search .ms { font-size: 34px; }
  .ph-search:active { background: rgba(255, 255, 255, 0.08); }
  .ph-feature { padding: 22px 22px 20px; border-radius: 28px;
    background: linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)), rgba(34, 24, 98, 0.72);
    box-shadow: 0 14px 34px rgba(8, 3, 22, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
  .ph-f-text { display: block; text-decoration: none; color: inherit; }
  .ph-f-text h2 { margin: 0; font: 700 23px/1.25 var(--font-display); letter-spacing: -0.01em; }
  .ph-f-text p { margin: 4px 0 0; color: var(--muted); }
  .ph-f-cover { display: flex; justify-content: center; margin: 22px 0 18px; }
  .cover-feature { width: 62%; max-width: 230px; font-size: 18px; border-radius: 8px; box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45); }
  .ph-feature .bar { margin-top: 0; }
  .ph-f-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
  .ph-f-foot span { font-size: var(--fs-small); color: var(--muted); }
  .ph-f-foot .btn { flex: none; }
}
@media (max-width: 699px) {
  .ph-hi { white-space: normal; font-size: 17px; }
  .ph-search .ms { font-size: 36px !important; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
  .tabbar .tab-me { display: flex !important; align-items: center; justify-content: center; }
  .tabbar .tab-me .avatar { display: grid !important; }
}

/* =====================================================================
   QA FIXES
   ===================================================================== */
/* 2. Username never breaks mid-word */
.pf-head .profile-name { flex-wrap: wrap; row-gap: 0; }
.pf-handle { min-width: 0; overflow-wrap: normal; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 699px) {
  .pf-head { align-items: flex-start; }
  .pf-head .avatar-xl { width: 84px; height: 84px; font-size: 30px; }
  .pf-head .profile-name { font-size: 22px !important; }
}
/* 3 + 5. Next-up card & flat empty state */
.ph-next-title { margin: 0 0 10px; font: 700 22px/1.25 var(--font-display); }
.ph-next .up-next li { border-bottom-color: rgba(255, 255, 255, 0.12); }
.ph-next .up-next .btn { min-height: 40px; padding: 0 16px; }
.empty-start .main-actions { margin-top: 14px; }
.home-quote .quote-card, body[data-route='today'] > .app > .quote-card { background: none !important; box-shadow: none !important; border-radius: 0 !important; padding: 4px 0 0 18px !important; border-left: 3px solid var(--accent); }
@media (max-width: 699px) { .ph-hide { display: none; } }
/* 4. One picture on the computer's Today */
@media (min-width: 900px) { .today-orb { display: none !important; } }
/* 6. Thumb-sized targets */
.more-quotes, .see-all { display: inline-flex; align-items: center; min-height: 44px; }
.card-empty a, .hint a, .muted a, .find-menu a, .goal-note a { display: inline-block; padding: 10px 2px; margin: -10px 0; }
.result > a, .r-title { min-height: 44px; }
.result > a { min-width: 44px; }
.r-tags .tag.sm { min-height: 28px; }
/* 7. Profile: two buttons + a quiet list */
.pf-buttons .btn { flex: 1 1 140px; }
.pf-links { display: grid; margin-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.pf-links a, .pf-links button { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 4px; border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: none; color: var(--text); text-decoration: none; font: 500 15px var(--font-ui); text-align: left; cursor: pointer; }
.pf-links span:not(.ms) { flex: 1; }
.pf-links .ms { font-size: 21px; color: var(--lav); }
.pf-links .ms:last-child { color: var(--faint); }
/* 9. Update banner */
.update-bar { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px); transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 16px; background: #f7f2fc; color: #241340; font-size: 14px; font-weight: 500; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45); max-width: calc(100% - 24px); }
.update-bar[hidden] { display: none; }
.update-bar button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--accent-strong); color: #fff; font: 600 14px var(--font-ui); cursor: pointer; }
.sec-count { font: 600 15px var(--font-ui); color: var(--muted); margin-left: 6px; }
.page-head .btn { white-space: nowrap; flex: none; }
@media (max-width: 699px) { .page-head .btn { padding: 0 14px; font-size: 14px; } }
.foot a { display: inline-block; padding: 12px 2px; margin: -12px 0; }

/* Today v4: quote above a taller Currently reading card; tasks on the right; placeholders when empty */
.home-quote { margin-bottom: 18px; }
.home-quote + .home-reading .section-title, .home-reading > .row-between { margin-top: 6px; }
/* placeholders */
.ph-card { display: flex; text-decoration: none; color: inherit; }
.ph-cover { flex: none; width: 96px; aspect-ratio: 2 / 3; border-radius: 8px; border: 2px dashed rgba(255, 255, 255, 0.22); }
.ph-lines { flex: 1; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.ph-line { display: block; height: 14px; border-radius: 7px; background: rgba(255, 255, 255, 0.1); }
.ph-line.thin { height: 8px; }
.w40 { width: 40%; } .w60 { width: 60%; } .w70 { width: 70%; } .w90 { width: 90%; }
.ph-lines .btn { align-self: flex-start; margin-top: 8px; }
.ph-rows { display: grid; gap: 14px; margin-top: 4px; }
.ph-row { display: flex; align-items: center; gap: 14px; }
.ph-mini { flex: none; width: 36px; height: 52px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); }
.ph-covers { display: flex; gap: 14px; overflow: hidden; }
.ph-slot { flex: none; width: 116px; height: 174px; border-radius: 8px; border: 2px dashed rgba(255, 255, 255, 0.18); }
.home-recs .muted { margin: 14px 0 0; }
@media (min-width: 900px) { .ph-card .ph-cover { width: 170px; } }
/* Greeting bar: bigger, easier icons */
.today-icons { gap: 8px; }
.today-icons a { width: 52px !important; height: 52px !important; }
.today-icons .ms { font-size: 32px !important; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.today-card { padding-top: 16px; padding-bottom: 16px; }

/* =====================================================================
   READER v2 — Apple Books behaviour, Libre's themes
   ===================================================================== */
.reader { position: fixed; inset: 0; display: flex; flex-direction: column; }
.reader-bar, .reader-foot { position: absolute; left: 0; right: 0; z-index: 3; transition: opacity 0.22s, transform 0.22s; }
.reader-bar { top: 0; display: flex; align-items: center; gap: 4px; padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; background: var(--r-bar); border-bottom: 1px solid var(--r-line); }
.reader-foot { bottom: 0; padding: 10px 18px calc(env(safe-area-inset-bottom) + 12px); background: var(--r-bar); border-top: 1px solid var(--r-line); }
.reader.chrome-hidden .reader-bar { opacity: 0; transform: translateY(-100%); pointer-events: none; }
.reader.chrome-hidden .reader-foot { opacity: 0; transform: translateY(100%); pointer-events: none; }
.reader-body { flex: 1; position: relative; }
.reader[data-kind='epub'] .reader-body { margin: calc(env(safe-area-inset-top) + 30px) 28px calc(env(safe-area-inset-bottom) + 38px) !important; }
.reader[data-kind='pdf'] .reader-body { padding-top: calc(env(safe-area-inset-top) + 66px) !important; padding-bottom: calc(env(safe-area-inset-bottom) + 90px) !important; }
.rd-btn { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--r-text); cursor: pointer; }
.rd-btn:hover { background: var(--r-chip); }
.rd-btn .ms { font-size: 24px; }
.rd-btn.on .ms { color: var(--r-accent); font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.rd-aa { font: 600 19px/1 Georgia, serif; }
.reader-title { flex: 1; min-width: 0; text-align: center; display: flex; flex-direction: column; }
.reader-title b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-title span { font-size: 12px; color: var(--r-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1.2em; }
.rd-scrub { width: 100%; margin: 0; accent-color: var(--r-accent); min-height: 32px; }
.rd-pos { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--r-muted); }
.reader-progress { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 3px; }
.reader:not(.chrome-hidden) .reader-progress { opacity: 0; }
.reader-nav { display: none !important; }
/* sheet lists */
.rd-tabs { margin-top: 12px; }
.rd-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 55vh; overflow-y: auto; }
.rd-list button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 48px; padding: 10px 6px; border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: none; color: var(--text); font: 500 15px/1.4 var(--font-ui); text-align: left; cursor: pointer; }
.rd-list button.sub { padding-left: 22px; font-weight: 400; color: var(--muted); }
.rd-list button:hover { background: rgba(255, 255, 255, 0.05); }
.rd-list small { font-size: 12.5px; color: var(--muted); }
.rd-list .ms { font-size: 18px; vertical-align: -4px; color: var(--accent); }
.hl-dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; vertical-align: 0; }
.hl-dot.hl-underline { background: none; border-bottom: 2px solid #e0559f; border-radius: 0; }
.rd-results { margin-top: 6px; }
.file-actions-top .btn .ms { font-size: 20px; }

/* ===== Fixes file (2026-10-16) ===== */
/* 1 */ .ph-f-btns { display: flex; gap: 8px; } .ph-only .reading-card { margin-top: 14px; }
/* 7 */ .status-pick select, select.input, input.input, textarea.input { font-size: 16px; }
/* 10 */ .profile { grid-template-columns: minmax(0, 1fr); } .pf-main, .pf-side { min-width: 0; }
.pf-cur span { display: inline; margin: 0; } .pf-cur > span { display: block; margin-top: 6px; font-size: var(--fs-caption); color: var(--muted); text-align: center; }
@media (min-width: 900px) { .profile { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); } }
/* 11 */ body:has(dialog[open]) { overflow: hidden; }
.sheet { max-height: calc(100dvh - 20px); overflow-y: auto; overscroll-behavior: contain; }
/* 18 */ .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .detail-grid .field { min-width: 0; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.head-actions .btn { min-height: 44px; padding: 0 16px; font-size: 14px; }
.file-btn { cursor: pointer; }
.open-file-cta { margin-top: 28px; }
.open-file-cta .btn { margin-top: 12px; }
