@font-face {
  font-family: "Anthropic Sans";
  src: url("https://assets-proxy.anthropic.com/claude-ai/v2/assets/v1/cc27851ad-CFxw3nG7.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #faf8f5;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #8e8a84;
  --faint: #c4bfb7;
  --line: rgba(28, 28, 30, 0.08);
  --accent: #e8916b;
  --accent-ink: #c8704b;
  --accent-soft: rgba(232, 145, 107, 0.16);
  --ke: #4a90d9;
  --ke-soft: rgba(74, 144, 217, 0.15);
  --ye: #e8916b;
  --ye-soft: rgba(232, 145, 107, 0.22);
  --ink: #2c2c2e;
  --on-ink: #ffffff;
  --chip: rgba(120, 118, 110, 0.12);
  --glass: rgba(250, 248, 245, 0.92);
  --lg-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.14));
  --lg-filter: blur(3px) saturate(1.8) brightness(1.03);
  --lg-inner: inset 0 1px 1.5px rgba(255, 255, 255, 0.85), inset 0 -1px 1px rgba(255, 255, 255, 0.4), inset 0 0 14px rgba(255, 255, 255, 0.3);
  --lg-drop: 0 10px 28px -6px rgba(31, 30, 29, 0.16), 0 2px 6px rgba(31, 30, 29, 0.06);
  --lg-hi: rgba(255, 255, 255, 1);
  --lg-hi2: rgba(255, 255, 255, 0.75);
  --lg-lo: rgba(255, 255, 255, 0.22);
  --lg-dk: rgba(255, 255, 255, 0.06);
  --shadow: 0 1px 2px rgba(40, 30, 20, 0.05), 0 8px 24px rgba(40, 30, 20, 0.07);
  --shadow-lift: 0 2px 6px rgba(40, 30, 20, 0.08), 0 18px 40px rgba(40, 30, 20, 0.12);
  --radius: 16px;
  --tab-bottom: max(12px, calc(var(--safe-b) - 6px));
  --tab-stack: calc(var(--tab-bottom) + 58px);
  --bar-h: 50px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --kb: 0px;
  --reader-font: 16px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ui: "Anthropic Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "Source Han Serif SC", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --card: #222120;
    --text: #f2efea;
    --muted: #9c968e;
    --faint: #5a5550;
    --line: rgba(255, 255, 255, 0.09);
    --accent-soft: rgba(232, 145, 107, 0.2);
    --ke-soft: rgba(74, 144, 217, 0.24);
    --ye-soft: rgba(232, 145, 107, 0.26);
    --ink: #e9e6e1;
    --on-ink: #1c1c1e;
    --chip: rgba(255, 255, 255, 0.1);
    --glass: rgba(30, 29, 28, 0.9);
    --lg-bg: linear-gradient(180deg, rgba(70, 70, 66, 0.32), rgba(40, 40, 38, 0.22));
    --lg-filter: blur(3px) saturate(1.6) brightness(0.95);
    --lg-inner: inset 0 1px 1px rgba(255, 255, 255, 0.14), inset 0 0 14px rgba(255, 255, 255, 0.04);
    --lg-drop: 0 10px 28px -6px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
    --lg-hi: rgba(255, 255, 255, 0.42);
    --lg-hi2: rgba(255, 255, 255, 0.22);
    --lg-lo: rgba(255, 255, 255, 0.06);
    --lg-dk: rgba(255, 255, 255, 0.015);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lift: 0 18px 40px rgba(0, 0, 0, 0.45);
  }
}

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

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button,
textarea,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ---------- views ---------- */

#views {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  background: var(--bg);
  will-change: transform;
}

.view.entering {
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.08);
}

.view-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: calc(var(--safe-t) + 20px) 20px calc(var(--tab-stack) + 32px);
}

.page-head {
  margin: 8px 0 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.01em;
}

#today-label {
  margin-bottom: 6px;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0;
}

.days {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.days b {
  color: var(--accent-ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.block {
  margin-top: 28px;
}

.block-title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
}

/* ---------- covers ---------- */

.cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 2px 5px 5px 2px;
  padding: 12% 11% 12% 14%;
  background: linear-gradient(155deg, var(--c1), var(--c2));
  color: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.12),
    0 4px 8px -2px rgba(0, 0, 0, 0.14),
    0 16px 28px -10px rgba(0, 0, 0, 0.28);
}

/* spine: a dark hinge line, a lit fold, then the board curving away */
.cover::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg,
      rgba(0, 0, 0, 0.28) 0,
      rgba(0, 0, 0, 0.1) 1.2%,
      rgba(255, 255, 255, 0.32) 2.4%,
      rgba(255, 255, 255, 0.1) 4%,
      rgba(0, 0, 0, 0.14) 5.6%,
      rgba(0, 0, 0, 0.04) 8%,
      transparent 12%,
      transparent 97%,
      rgba(0, 0, 0, 0.08) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 25%, transparent 80%, rgba(0, 0, 0, 0.06));
}

.cover::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  background: radial-gradient(circle at 80% 8%, rgba(255, 255, 255, 0.16), transparent 45%);
  pointer-events: none;
}

.cover img {
  z-index: 1;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cover-author {
  font-size: 10.5px;
  opacity: 0.85;
  letter-spacing: 0.04em;
}

.cover.large .cover-title {
  font-size: 17px;
}

/* ---------- home ---------- */

.now-card {
  width: 100%;
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.2s var(--ease);
}

.now-card:active,
.shelf-item:active .cover,
.recent-note:active {
  transform: scale(0.97);
}

.now-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}

.now-author {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.now-chapter {
  margin: 14px 0 8px;
  font-size: 14px;
  line-height: 1.4;
}

.now-chapter span {
  color: var(--muted);
}

.bar {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.now-pct {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.now-go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14px;
  font-weight: 600;
}

.empty-card {
  padding: 28px 20px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
}

.empty-card .now-go {
  margin-top: 12px;
}

.recent-notes {
  display: grid;
  gap: 12px;
}

.recent-note {
  display: block;
  width: 100%;
  padding: 14px 16px 14px 16px;
  border-left: 4px solid var(--ink);
  border-radius: 8px 18px 18px 8px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.2s var(--ease);
}

.rn-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.rn-book {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rn-chapter {
  color: var(--muted);
  font-weight: 500;
}

.rn-date,
.rn-sub {
  color: var(--muted);
  font-size: 12px;
  flex: none;
}

.rn-sub {
  margin-top: 3px;
}

.rn-quote {
  margin: 12px 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rn-convo {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--chip);
}

.rn-line {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.55;
}

.rn-line b {
  font-weight: 700;
}

.rn-line b.ye {
  color: var(--accent-ink);
}

.rn-line b.ke {
  color: var(--ke);
}

.rn-line span {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-row.ye {
  border-left-color: var(--ye);
}

.note-row.ke {
  border-left-color: var(--ke);
}

.msg-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- shelf ---------- */

.shelf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.round-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--chip);
  color: var(--text);
  margin-bottom: 2px;
}

.round-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.round-btn:disabled {
  opacity: 0.5;
}

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 20px;
}

@media (min-width: 640px) {
  .shelf-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

.shelf-item {
  display: block;
  width: 100%;
  text-align: left;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.shelf-item .cover {
  transition: transform 0.25s var(--ease);
}

.shelf-item.pressing .cover {
  transform: scale(0.95);
  transition-duration: 0.5s;
}

.shelf-title {
  margin: 10px 0 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shelf-meta {
  margin: 4px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.shelf-hint {
  margin: 28px 0 0;
  text-align: center;
  color: var(--faint);
  font-size: 12px;
}

/* ---------- liquid glass ---------- */

.lg {
  background: var(--lg-bg);
  -webkit-backdrop-filter: var(--lg-filter);
  backdrop-filter: var(--lg-filter);
  box-shadow: var(--lg-inner), var(--lg-drop);
}

/* mirror edge: brightness shifts around the rim instead of a flat stroke */
.lg::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: conic-gradient(from 315deg, var(--lg-hi) 0deg, var(--lg-lo) 45deg, var(--lg-dk) 90deg, var(--lg-lo) 135deg, var(--lg-hi2) 180deg, var(--lg-lo) 225deg, var(--lg-dk) 270deg, var(--lg-lo) 315deg, var(--lg-hi) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.tab,
.tool-btn {
  transition: scale 0.18s cubic-bezier(0.3, 0.7, 0.4, 1), color 0.2s, background 0.2s;
}

.tab:active,
.tool-btn:active {
  scale: 0.9;
}

/* ---------- reader ---------- */

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.read-bar {
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--bar-h) + var(--safe-t));
  padding: var(--safe-t) 6px 0;
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 0.5px solid var(--line);
  transition: transform 0.35s var(--ease);
}

.bar-btn {
  height: 40px;
  min-width: 40px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 12px;
  color: var(--text);
  flex: none;
}

.bar-btn:active,
.tool-btn:active {
  background: var(--line);
}

.bar-btn svg {
  width: 22px;
  height: 22px;
}

#read-back svg {
  stroke-width: 2.3;
}

.notes-btn {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.notes-btn svg {
  width: 19px;
  height: 19px;
}

.font-group {
  display: inline-flex;
  flex: none;
}

.font-btn {
  min-width: 36px;
  padding: 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.read-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  padding: 2px 4px;
}

.read-book,
.read-chapter {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.read-book {
  font-size: 15px;
  font-weight: 600;
}

.read-chapter {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.read-chapter::after {
  content: " ⌄";
}

.read-scroll {
  padding: calc(var(--safe-t) + var(--bar-h) + 26px) 24px calc(var(--tab-stack) + 120px);
}

.chunk-heading {
  max-width: 680px;
  margin: 0 auto 22px;
  font-family: var(--serif);
  font-size: calc(var(--reader-font) * 1.35);
  line-height: 1.35;
  font-weight: 700;
}

.text {
  max-width: 680px;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: var(--reader-font);
  line-height: 1.8;
  letter-spacing: 0.01em;
  overflow-wrap: break-word;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.text .br {
  display: block;
  height: 0.65em;
}

.text mark {
  color: inherit;
  border-radius: 3px;
  padding: 0.08em 0;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  cursor: pointer;
  transition: background-color 0.2s;
}

.text mark.by-ye {
  background: var(--ye-soft);
}

.text mark.by-ke {
  background: var(--ke-soft);
}

.text mark.unsent {
  background: transparent;
  text-decoration: underline dashed var(--ye);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.3em;
}

.text mark {
  position: relative;
  top: 0;
  transition: background-color 0.2s, box-shadow 0.25s var(--ease), top 0.25s var(--ease);
}

.text mark.active {
  border-radius: 5px;
}

.text mark.pop {
  animation: mark-pop 0.45s cubic-bezier(0.3, 0.7, 0.4, 1);
}

@keyframes mark-pop {
  40% {
    top: -3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
  }
}

.text mark.by-ye.active {
  background: rgba(232, 145, 107, 0.34);
}

.text mark.by-ke.active {
  background: rgba(74, 144, 217, 0.26);
}

.text mark.unsent.active {
  background: var(--ye-soft);
}

/* note cards (inline under the paragraph, or in the sheet) */
.note-card {
  margin: 12px 0 6px;
  padding: 14px 16px 16px 16px;
  border-left: 4px solid var(--line);
  border-radius: 8px 18px 18px 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.sheet .note-card {
  margin: 4px 0 12px;
}

.note-card.ye {
  border-left-color: var(--ye);
}

.note-card.ke {
  border-left-color: var(--ke);
}

.note-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.note-kicker time {
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.note-card .quote-block {
  font-size: 14px;
}

.note-body,
.reply-own p,
.reply-bubble p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reply-own {
  margin-top: 14px;
}

.reply-bubble {
  margin: 12px 0 0 16%;
  padding: 10px 13px;
  border-radius: 16px;
  background: var(--chip);
}

.reply-own .msg-meta,
.reply-bubble .msg-meta {
  margin-top: 4px;
}

/* inline wrapper, opened under the paragraph */
.inline-note {
  display: block;
  overflow: hidden;
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.55;
  text-align: left;
  letter-spacing: 0;
  -webkit-hyphens: manual;
  hyphens: manual;
  transition: max-height 0.38s var(--ease), opacity 0.3s ease;
}

.text mark.flash {
  animation: flash 1.2s ease;
}

@keyframes flash {
  30% {
    background: rgba(232, 145, 107, 0.5);
  }
}

.loading-text {
  color: var(--muted);
  text-align: center;
  padding: 60px 0;
  font-family: var(--ui);
}

.chapter-end {
  max-width: 680px;
  margin: 44px auto 0;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.chapter-end .end-mark {
  color: var(--faint);
  letter-spacing: 0.6em;
  margin-bottom: 8px;
}

.pill-btn {
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
}

.pill-btn.soft {
  background: var(--chip);
  box-shadow: none;
}

.read-tools {
  position: absolute;
  z-index: 5;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tab-stack) + 10px);
  height: 46px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  align-items: center;
  padding: 0 4px;
  border-radius: 23px;
  transition: transform 0.35s var(--ease), opacity 0.35s;
}

.tool-btn {
  height: 38px;
  border-radius: 19px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.tool-btn:disabled {
  color: var(--faint);
}

#continue-reading,
#mark-read.is-read {
  color: var(--accent-ink);
  font-weight: 600;
}

.send-pill {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: calc(var(--tab-stack) + 68px);
  transform: translateX(-50%);
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.35s var(--ease), opacity 0.3s;
}

.selection-bar {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: calc(var(--tab-stack) + 68px);
  transform: translateX(-50%);
  padding: 4px;
  border-radius: 999px;
  animation: pop-in 0.28s var(--ease);
}

.selection-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.selection-btn svg {
  width: 17px;
  height: 17px;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.92);
  }
}

/* immersive mode: hide chrome while reading */
body.immersive .read-bar {
  transform: translateY(-100%);
}

body.immersive .read-tools {
  transform: translateY(calc(var(--tab-stack) + 70px));
  opacity: 0;
}

body.immersive .send-pill {
  transform: translateX(-50%) translateY(200px);
}

body.immersive .tabbar {
  transform: translateY(calc(100% + var(--tab-bottom) + 10px));
}

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: var(--tab-bottom);
  width: min(320px, calc(100% - 32px));
  height: 58px;
  margin: 0 auto;
  padding: 0 6px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  border-radius: 29px;
  transition: transform 0.35s var(--ease);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  height: 48px;
  border-radius: 24px;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tab svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: none;
}

.tab.active {
  background: var(--chip);
}

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

.scrim {
  position: fixed;
  z-index: 20;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 0.3s;
}

.scrim.open {
  opacity: 1;
}

.sheet {
  position: fixed;
  z-index: 21;
  left: 0;
  right: 0;
  bottom: var(--kb);
  max-height: calc(100% - var(--safe-t) - 40px - var(--kb));
  display: flex;
  flex-direction: column;
  border-radius: 22px 22px 0 0;
  background: var(--bg);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
  transform: translateY(100%);
  transition: transform 0.38s var(--ease);
}

.sheet.open {
  transform: translateY(0);
}

.sheet.dragging {
  transition: none;
}

@media (min-width: 640px) {
  .sheet {
    left: 50%;
    right: auto;
    width: 560px;
    margin-left: -280px;
  }
}

.sheet-grabber {
  flex: none;
  display: grid;
  place-items: center;
  height: 22px;
  touch-action: none;
}

.sheet-grabber span {
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: var(--faint);
}

.sheet-body {
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 20px calc(var(--safe-b) + 20px);
}

.sheet-title {
  margin: 4px 0 4px;
  font-size: 18px;
  font-weight: 700;
}

.sheet-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.sheet-actions > * {
  flex: 1;
}

.primary-btn,
.plain-btn,
.danger-btn {
  height: 48px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
}

.primary-btn {
  background: var(--ink);
  color: var(--on-ink);
}

.plain-btn {
  background: var(--chip);
}

.danger-btn {
  background: rgba(230, 72, 60, 0.1);
  color: #e0483c;
}

.primary-btn:disabled {
  opacity: 0.5;
}

.stack {
  display: grid;
  gap: 10px;
}

textarea {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  outline: none;
}

textarea:focus {
  box-shadow: inset 0 0 0 1.5px var(--muted);
}

.quote-block {
  margin: 0 0 14px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--faint);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.65;
  max-height: 9.9em;
  overflow-y: auto;
}

.thread + .thread {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 0.5px solid var(--line);
}

.echo-line {
  margin: 14px 0 0;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
}

.unsent-tag {
  color: var(--accent-ink);
}

.reply-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.reply-form textarea {
  min-height: 44px;
  max-height: 140px;
  padding: 10px 14px;
  border-radius: 22px;
}

.reply-form button {
  height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
  flex: none;
}

.list-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 4px;
  border-bottom: 0.5px solid var(--line);
  text-align: left;
}

.list-row:active {
  background: var(--line);
}

.list-row .row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.row-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.list-row.current .row-title {
  color: var(--accent-ink);
  font-weight: 700;
}

.list-row.read .row-title {
  color: var(--muted);
}

.row-check {
  width: 20px;
  color: var(--accent);
  text-align: center;
  flex: none;
}

.note-row {
  align-items: flex-start;
  margin: 6px 0;
  padding-left: 12px;
  border-left: 3px solid var(--line);
  border-bottom: 0;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: calc(var(--safe-t) + 60px);
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.88);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lift);
  animation: toast-in 0.3s var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);
  }
}

/* ---------- ritual cards (carried over) ---------- */

.card-preview {
  display: grid;
  place-items: center;
}

.ritual-card {
  position: relative;
  width: min(420px, 100%);
  min-height: 440px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  border-radius: 24px;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.76), transparent 28%),
    linear-gradient(145deg, #fbf4ed, #ece8df 58%, #dfe5e6);
  color: #28241f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.ritual-card.card-compact {
  min-height: 360px;
}

.ritual-card.card-tall {
  min-height: 540px;
}

.card-art {
  position: absolute;
  inset: 0;
  color: rgba(155, 115, 85, 0.75);
  pointer-events: none;
}

.card-art svg {
  width: 100%;
  height: 100%;
  display: block;
  stroke-width: inherit;
}

.card-content {
  position: relative;
  z-index: 1;
  min-height: 384px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-compact .card-content {
  min-height: 304px;
}

.card-tall .card-content {
  min-height: 484px;
}

.ritual-card.echo,
.ritual-card.art-ripple {
  background:
    radial-gradient(circle at 76% 12%, rgba(255, 255, 255, 0.5), transparent 30%),
    linear-gradient(145deg, #f8f3ec, #eee9df 58%, #e6e5dc);
}

.ritual-card.art-ripple .card-art {
  color: rgba(116, 96, 78, 0.52);
}

.ritual-card.art-fold .card-art {
  color: rgba(88, 80, 72, 0.45);
}

.ritual-card.art-stardust .card-art {
  color: rgba(98, 86, 70, 0.62);
}

.ritual-card.finish {
  background:
    radial-gradient(circle at 20% 18%, rgba(217, 121, 92, 0.18), transparent 28%),
    linear-gradient(145deg, #fbf6ee, #eeece4 60%, #e4e8df);
}

.ritual-card.quiet {
  background:
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, 0.76), transparent 32%),
    linear-gradient(145deg, #f8f5ef, #eeeae2 62%, #e8e6df);
}

.card-kicker {
  margin: 0;
  color: #7d7971;
  font-size: 15px;
  font-weight: 800;
}

.ritual-card h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.card-subtitle {
  margin: -8px 0 0;
  color: #868178;
  font-size: 14px;
}

.ritual-card blockquote {
  margin: clamp(18px, 5vh, 48px) 0 0;
  padding: 0;
  color: #34302b;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.5;
}

.card-voices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: auto;
}

.card-voices.single {
  grid-template-columns: 1fr;
}

.card-voices section {
  min-width: 0;
  border-top: 1px solid rgba(40, 36, 31, 0.14);
  padding-top: 10px;
}

.card-voices span {
  color: #817b72;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.card-voices p,
.ritual-card footer {
  margin: 6px 0 0;
  color: #4b463f;
  font-size: 14px;
  line-height: 1.45;
}

.ritual-card footer {
  margin-top: auto;
  color: #817b72;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* shared passages: the original orange-to-blue wash, flowing across the lines */
.text mark.shared,
.text mark.shared.active {
  background: linear-gradient(90deg, rgba(232, 145, 107, 0.26), rgba(74, 144, 217, 0.22));
  -webkit-box-decoration-break: slice;
  box-decoration-break: slice;
}

/* ---------- long-press menu on a book ---------- */

.ctx-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  background: rgba(250, 248, 245, 0.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.ctx-open .ctx-backdrop {
  opacity: 1;
}

.ctx-book {
  position: fixed;
  z-index: 31;
  pointer-events: none;
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.ctx-book .cover {
  transition: box-shadow 0.35s ease;
}

.ctx-open .ctx-book {
  transform: scale(1.05) translateY(-4px);
}

.ctx-open .ctx-book .cover {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.12),
    0 24px 44px -10px rgba(0, 0, 0, 0.38);
}

.ctx-menu {
  position: fixed;
  z-index: 32;
  width: 180px;
  padding: 5px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.48));
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  backdrop-filter: blur(24px) saturate(1.8);
  box-shadow: var(--lg-inner), 0 18px 40px -8px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.ctx-open .ctx-menu {
  opacity: 1;
  transform: scale(1);
}

.ctx-title {
  padding: 7px 10px 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ctx-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.ctx-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 15px;
  text-align: left;
}

.ctx-item svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.7;
  flex: none;
}

.ctx-item:active {
  background: rgba(0, 0, 0, 0.07);
}

.ctx-item.danger {
  color: #e0483c;
}

.ctx-sep {
  height: 0.5px;
  margin: 4px 10px;
  background: rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  .ctx-backdrop {
    background: rgba(22, 21, 20, 0.3);
  }

  .ctx-menu {
    background: linear-gradient(180deg, rgba(60, 59, 56, 0.66), rgba(40, 39, 37, 0.58));
  }

  .ctx-item:active {
    background: rgba(255, 255, 255, 0.1);
  }

  .ctx-sep {
    background: rgba(255, 255, 255, 0.14);
  }
}

/* ---------- home skeleton ---------- */

.sk {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 6px;
  background: #e8e5e0;
}

.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, #ede9e4 50%, transparent);
  animation: sk-shimmer 1.3s ease-in-out infinite;
}

@keyframes sk-shimmer {
  to {
    transform: translateX(100%);
  }
}

.sk-line {
  height: 12px;
  margin-top: 9px;
}

.sk-cover {
  aspect-ratio: 2 / 3;
  border-radius: 2px 5px 5px 2px;
}

.sk-pill {
  width: 150px;
  height: 34px;
  margin-top: 18px;
  border-radius: 999px;
}

.sk-box {
  height: 64px;
  border-radius: 12px;
}

.sk-card {
  pointer-events: none;
}

.recent-note.sk-card {
  border-left-color: #e8e5e0;
}

.reveal {
  animation: reveal 0.8s cubic-bezier(0.45, 0, 0.25, 1) both;
}

@keyframes reveal {
  from {
    opacity: 0;
  }
}

@media (prefers-color-scheme: dark) {
  .sk,
  .recent-note.sk-card {
    background-color: rgba(255, 255, 255, 0.07);
    border-left-color: rgba(255, 255, 255, 0.07);
  }

  .recent-note.sk-card {
    background-color: var(--card);
  }

  .sk::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06) 50%, transparent);
  }
}
