:root {
  color-scheme: light;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ink: #263f48;
  --ink-soft: #596f76;
  --ink-faint: #74878c;
  --paper: #f2eddf;
  --paper-strong: #fbf7ec;
  --blue-mist: #7899a5;
  --blue-deep: #466b7b;
  --teal: #527a89;
  --teal-bright: #90adb6;
  --yellow: #355766;
  --yellow-soft: #e5dccb;
  --champagne: #a99270;
  --champagne-soft: #e8e0d1;
  --wine: #6f4744;
  --pink: #9bb8c0;
  --book-paper: #f6f1e5;
  --glass: rgba(248, 246, 237, 0.64);
  --glass-border: rgba(255, 255, 255, 0.58);
  --glass-rim: rgba(38, 63, 72, 0.17);
  --glass-edge: rgba(255, 255, 255, 0.88);
  --glass-depth: rgba(29, 53, 62, 0.13);
  --hairline: rgba(39, 70, 74, 0.13);
  --ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --serif-font: "Songti SC", "STSong", "Noto Serif CJK SC", "Hiragino Mincho ProN", serif;
  --shadow-soft: 0 18px 44px rgba(38, 62, 68, 0.13), 0 2px 9px rgba(38, 62, 68, 0.07);
  --shadow-device: 0 42px 90px rgba(24, 47, 54, 0.24), 0 8px 26px rgba(24, 47, 54, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: #a6bac0;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at 22% 16%, rgba(248, 244, 234, 0.22), transparent 30%),
    linear-gradient(145deg, #8dabb5 0%, #5c8191 100%);
}

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

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button,
[role="button"] {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

::selection {
  color: var(--ink);
  background: rgba(166, 190, 198, 0.62);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.demo-stage {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(42px, 6vw, 92px);
  padding: 20px 30px;
}

.demo-guide {
  width: min(32vw, 330px);
  color: #f5f1e6;
}

.guide-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 44px;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(246, 242, 231, 0.58);
}

.guide-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(246, 242, 231, 0.44);
  border-radius: 50%;
  color: #f5f1e6;
  font-family: var(--serif-font);
  font-size: 17px;
  letter-spacing: 0;
}

.demo-guide h1 {
  max-width: 5.8em;
  margin: 0;
  font-family: var(--serif-font);
  font-size: clamp(34px, 3.2vw, 52px);
  font-weight: 500;
  line-height: 1.28;
  letter-spacing: -0.04em;
}

.guide-lede {
  max-width: 29em;
  margin: 24px 0 34px;
  color: rgba(246, 242, 231, 0.72);
  font-size: 13px;
  line-height: 1.75;
}

.guide-steps {
  border-top: 1px solid rgba(246, 242, 231, 0.18);
}

.guide-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
  color: rgba(246, 242, 231, 0.58);
  font-size: 10px;
}

.guide-theme-switch {
  background: rgba(255, 255, 255, 0.08);
}

.guide-theme-switch button {
  min-width: 50px;
  color: rgba(246, 242, 231, 0.64);
}

.guide-theme-switch button.is-selected {
  color: var(--ink);
  background: var(--paper-strong);
}

.guide-steps button,
.guide-reset {
  width: 100%;
  min-height: 50px;
  border: 0;
  color: #f5f1e6;
  background: transparent;
}

.guide-steps button {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  padding: 0;
  border-bottom: 1px solid rgba(246, 242, 231, 0.18);
  text-align: left;
  font-size: 12px;
  cursor: pointer;
  transition: color 160ms var(--ease-out);
}

.guide-steps button span {
  color: rgba(246, 242, 231, 0.42);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.guide-reset {
  width: auto;
  min-height: 44px;
  margin-top: 26px;
  padding: 0;
  color: rgba(246, 242, 231, 0.56);
  text-align: left;
  font-size: 11px;
  cursor: pointer;
}

.guide-steps button:active,
.guide-reset:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .guide-steps button:hover {
    color: #fffdf6;
  }

  .guide-reset:hover {
    color: #fffdf6;
  }
}

.device-shell {
  --device-left: 0px;
  --device-top: 0px;
  position: relative;
  width: min(402px, calc((100dvh - 40px) * 0.46));
  max-width: 402px;
  aspect-ratio: 402 / 874;
  overflow: hidden;
  border: 7px solid #18292d;
  border-radius: 56px;
  background: var(--paper);
  box-shadow: var(--shadow-device);
  isolation: isolate;
}

.device-shell::after {
  position: absolute;
  inset: 0;
  z-index: 150;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 49px;
  pointer-events: none;
  content: "";
}

.dynamic-island {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 130;
  width: 108px;
  height: 28px;
  border-radius: 999px;
  background: #061011;
  transform: translateX(-50%);
}

.status-bar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 120;
  height: 51px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 24px 0 31px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-icons .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.1;
}

.battery-icon {
  width: 23px !important;
}

.app-main {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, #9bb9c1 0%, #b9cdd0 24%, #f3eddf 52%, #f7f1e4 100%);
}

.app-main::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background:
    radial-gradient(circle at 105% 4%, rgba(143, 174, 183, 0.32), transparent 29%),
    radial-gradient(circle at -8% 55%, rgba(248, 244, 234, 0.22), transparent 31%);
  content: "";
}

.view {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow-x: hidden;
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  scrollbar-width: none;
  transform: translateX(8px);
  transition: opacity 180ms var(--ease-out), transform 210ms var(--ease-out), visibility 0s linear 210ms;
  overscroll-behavior-y: contain;
}

.view::-webkit-scrollbar {
  display: none;
}

.view.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  transition: opacity 180ms var(--ease-out), transform 210ms var(--ease-out), visibility 0s;
}

#homeView {
  padding: 57px 21px 116px;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--serif-font);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), transform 130ms var(--ease-out);
}

.icon-button:active {
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0.94);
}

.welcome-block {
  margin: 22px 0 22px;
}

.date-line {
  margin: 0 0 9px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.welcome-block h1 {
  margin: 0;
  font-family: var(--serif-font);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.welcome-block em {
  position: relative;
  color: var(--teal);
  font-style: normal;
}

.welcome-block em::after {
  position: absolute;
  right: 0.02em;
  bottom: 0.02em;
  left: 0.02em;
  z-index: -1;
  height: 0.42em;
  border-radius: 999px;
  background: rgba(166, 190, 198, 0.62);
  content: "";
  transform: rotate(-1.5deg);
}

.rhythm-panel {
  padding: 18px 17px 15px;
  border: 1px solid var(--glass-border);
  border-radius: 27px;
  background: var(--glass);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(1.08);
  -webkit-backdrop-filter: blur(22px) saturate(1.08);
}

.panel-heading,
.shelf-heading,
.journal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading h2,
.shelf-heading h2,
.journal-heading h2 {
  margin: 0;
  font-family: var(--serif-font);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(42, 76, 79, 0.09);
  border-radius: 999px;
  background: rgba(234, 238, 231, 0.64);
}

.segmented button {
  min-width: 40px;
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  transition: color 160ms var(--ease-out), background-color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out), transform 120ms var(--ease-out);
}

.segmented button:active {
  transform: scale(0.96);
}

.segmented button.is-selected {
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: 0 2px 8px rgba(36, 61, 67, 0.1);
}

.stat-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.stat-summary p {
  margin: 0;
}

#totalReadingTime {
  font-family: var(--serif-font);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

#totalReadingTime strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart {
  height: 113px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 3px;
  margin-top: 10px;
}

.stat-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
}

.stat-metric {
  min-height: 48px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  padding-top: 8px;
}

.stat-metric + .stat-metric {
  border-left: 0;
}

.stat-metric strong {
  font-family: var(--serif-font);
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-metric span {
  color: var(--ink-soft);
  font-size: 9px;
}

.chart-bar-button {
  position: relative;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.chart-bar-button::before {
  position: absolute;
  inset: 0 -3px 20px;
  border-radius: 12px;
  background: transparent;
  content: "";
  transition: background-color 150ms var(--ease-out);
}

.chart-bar-button:active::before {
  background: rgba(255, 255, 255, 0.4);
}

.bar-fill {
  position: relative;
  z-index: 1;
  width: min(18px, 68%);
  height: var(--bar-height, 18%);
  min-height: 4px;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(180deg, #a7bec4, #6e93a1);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.35);
  transform-origin: bottom;
  animation: bar-in 260ms var(--ease-out) both;
}

.chart-bar-button.is-current .bar-fill {
  background: linear-gradient(180deg, #6f93a0, var(--yellow));
}

.chart-bar-button.is-empty .bar-fill {
  height: 4px !important;
  background: rgba(53, 91, 96, 0.14);
}

.bar-label {
  position: relative;
  z-index: 1;
  color: var(--ink-faint);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chart-bar-button.is-current .bar-label {
  color: var(--ink);
  font-weight: 700;
}

@keyframes bar-in {
  from {
    opacity: 0.4;
    transform: scaleY(0.72);
  }

  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

.continue-card {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
  padding: 10px 13px 10px 10px;
  border: 0;
  border-radius: 21px;
  color: #f8f4e8;
  background: #466b7b;
  box-shadow: 0 13px 26px rgba(31, 63, 69, 0.2);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.continue-card:active {
  transform: scale(0.98);
  box-shadow: 0 7px 16px rgba(31, 63, 69, 0.17);
}

.mini-cover {
  width: 45px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px 7px 7px 3px;
  box-shadow: 3px 4px 8px rgba(3, 16, 20, 0.22);
  font-family: var(--serif-font);
  font-size: 8px;
  line-height: 1.55;
  text-align: center;
}

.mini-cover-teal {
  color: #f8f4e8;
  background: #86a6af;
}

.continue-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.continue-kicker {
  color: rgba(248, 245, 235, 0.62);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.continue-copy strong {
  overflow: hidden;
  margin-top: 2px;
  font-family: var(--serif-font);
  font-size: 16px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continue-meta {
  margin-top: 3px;
  color: rgba(248, 245, 235, 0.7);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.continue-action {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(248, 245, 235, 0.18);
  border-radius: 50%;
  color: #f8f5eb;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(10px);
}

.continue-action .icon {
  width: 18px;
  height: 18px;
}

.shelf-section {
  margin-top: 28px;
}

.shelf-heading p,
.journal-heading p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.view-switch button {
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.view-switch .icon {
  width: 18px;
  height: 18px;
}

.shelf-content {
  margin-top: 15px;
}

.spine-shelf {
  position: relative;
  min-height: 286px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  padding: 18px 5px 17px;
}

.spine-shelf::after {
  position: absolute;
  right: 0;
  bottom: 7px;
  left: 0;
  height: 9px;
  border-radius: 50%;
  background: rgba(33, 62, 67, 0.16);
  filter: blur(4px);
  content: "";
}

.book-spine {
  position: relative;
  z-index: 1;
  width: var(--spine-width, 52px);
  height: var(--spine-height, 220px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 13px 6px 11px;
  border: 0;
  border-radius: 5px 5px 3px 3px;
  color: var(--ink);
  border: 1px solid rgba(38, 63, 72, 0.09);
  background: var(--book-paper);
  box-shadow: 2px 5px 9px rgba(30, 49, 52, 0.12);
  font-family: var(--serif-font);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.book-spine::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--book-accent, var(--teal));
  content: "";
}

.book-spine:active {
  transform: translateY(-4px) scale(0.98);
  box-shadow: 2px 8px 14px rgba(30, 49, 52, 0.2);
}

.book-spine::after {
  display: none;
}

.spine-title {
  max-height: 12em;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.25;
}

.spine-meta {
  max-height: 8em;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--ui-font);
  font-size: 8px;
  letter-spacing: 0.08em;
}

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

.flat-book {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.flat-book:active .flat-cover {
  transform: translateY(2px) scale(0.98);
}

.flat-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 0.72;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 17px 15px 15px 20px;
  border-radius: 4px 12px 12px 4px;
  color: var(--ink);
  border-left: 8px solid var(--book-accent, var(--teal));
  background-color: var(--book-paper);
  box-shadow: 5px 10px 18px rgba(31, 53, 58, 0.12);
  transition: transform 160ms var(--ease-out);
}

.flat-cover.has-cover-image {
  background-image:
    linear-gradient(180deg, rgba(8, 20, 22, 0.08), rgba(8, 20, 22, 0.58)),
    var(--cover-image);
}

.flat-cover::before {
  display: none;
}

.flat-cover::after {
  display: none;
}

.flat-cover-title {
  position: relative;
  z-index: 1;
  max-width: 5em;
  font-family: var(--serif-font);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.04em;
}

.flat-cover-author {
  position: relative;
  z-index: 1;
  max-width: 8em;
  color: var(--ink-soft);
  font-size: 8px;
  letter-spacing: 0.05em;
}

.flat-meta {
  padding-top: 9px;
}

.flat-meta strong {
  display: block;
  overflow: hidden;
  font-family: var(--serif-font);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flat-meta span {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.5;
}

.flat-meta .flat-reading {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.book-toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 101px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: end;
  gap: 7px;
  padding: 49px 12px 7px;
  background: linear-gradient(180deg, rgba(231, 237, 232, 0.97), rgba(231, 237, 232, 0.82) 75%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.book-toolbar-title {
  overflow: hidden;
  align-self: center;
  font-family: var(--serif-font);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-actions {
  display: flex;
}

.book-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 110px 21px 112px;
  scrollbar-width: none;
  scroll-behavior: smooth;
  overscroll-behavior-y: contain;
}

.book-scroll::-webkit-scrollbar {
  display: none;
}

.book-hero {
  margin-top: 3px;
  padding: 17px;
  border: 1px solid var(--glass-border);
  border-radius: 29px;
  background: rgba(248, 246, 237, 0.56);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.hero-main {
  display: grid;
  grid-template-columns: 111px minmax(0, 1fr);
  gap: 17px;
}

.hero-cover {
  position: relative;
  width: 111px;
  min-height: 158px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 14px 13px 20px;
  border-radius: 4px 13px 13px 4px;
  color: var(--ink);
  border-left: 8px solid var(--book-accent, var(--teal));
  background-color: var(--book-paper);
  box-shadow: 6px 12px 20px rgba(29, 52, 58, 0.14);
}

.hero-cover.has-cover-image {
  color: #fffdf8;
  background-image:
    linear-gradient(180deg, rgba(8, 20, 22, 0.08), rgba(8, 20, 22, 0.58)),
    var(--cover-image);
}

.hero-cover.has-cover-image .hero-cover-author {
  color: rgba(255, 253, 248, 0.7);
}

.hero-cover::before {
  position: absolute;
  top: 20px;
  right: -20px;
  width: 75px;
  height: 75px;
  border: 1px solid color-mix(in srgb, var(--ink) 16%, transparent);
  border-radius: 50%;
  content: "";
}

.hero-cover-title {
  position: relative;
  z-index: 1;
  font-family: var(--serif-font);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: 0.05em;
}

.hero-cover-author {
  position: relative;
  z-index: 1;
  max-width: 9em;
  color: var(--ink-soft);
  font-size: 8px;
}

.hero-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.status-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--teal);
  background: rgba(125, 200, 191, 0.18);
  font-size: 10px;
  font-weight: 600;
}

.status-pill-action {
  min-height: 28px;
  border: 0;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), transform 130ms var(--ease-out);
}

.status-pill-action::before {
  display: none;
}

.status-pill-action .icon {
  width: 12px;
  height: 12px;
  margin-left: 0;
}

.status-pill-action:active {
  transform: scale(0.97);
}

.status-pill-reveal {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  white-space: nowrap;
  transform: translateX(-3px);
  transition: max-width 190ms var(--ease-out), opacity 140ms var(--ease-out),
    transform 190ms var(--ease-out);
}

.status-pill-action:active .status-pill-reveal,
.status-pill-action.is-revealing .status-pill-reveal {
  max-width: 5em;
  opacity: 1;
  transform: translateX(0);
}

@media (hover: hover) and (pointer: fine) {
  .status-pill-action:hover .status-pill-reveal {
    max-width: 5em;
    opacity: 1;
    transform: translateX(0);
  }
}

.status-pill::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.hero-title {
  margin: 11px 0 0;
  font-family: var(--serif-font);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.hero-author {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 13px;
  margin-top: 17px;
  color: var(--ink-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hero-meta .icon {
  width: 14px;
  height: 14px;
}

.hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 17px;
}

.secondary-button,
.primary-button,
.reading-control {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  border-radius: 15px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 130ms var(--ease-out), background-color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out);
}

.secondary-button {
  border: 1px solid rgba(46, 77, 81, 0.11);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.46);
}

.primary-button {
  border: 1px solid rgba(32, 63, 69, 0.06);
  color: #fbf8ef;
  background: var(--ink);
  box-shadow: 0 8px 17px rgba(32, 63, 69, 0.16);
}

.secondary-button:active,
.primary-button:active,
.reading-control:active {
  transform: scale(0.97);
}

.secondary-button:disabled,
.reading-control:disabled {
  opacity: 0.52;
  cursor: default;
  transform: none;
}

.secondary-button .icon,
.primary-button .icon,
.reading-control .icon {
  width: 18px;
  height: 18px;
}

.journal-section {
  margin-top: 27px;
}

.small-text-button {
  min-height: 40px;
  padding: 0;
  border: 0;
  color: var(--teal);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.small-text-button:active {
  opacity: 0.65;
}

.chapter-list {
  margin-top: 9px;
}

.chapter-block {
  border-top: 1px solid var(--hairline);
  scroll-margin-top: 120px;
}

.chapter-block:first-child {
  border-top: 0;
}

.chapter-header {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0 10px calc((var(--chapter-level, 1) - 1) * 17px);
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.chapter-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.chapter-toggle-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  transition: transform 170ms var(--ease-out);
}

.chapter-toggle-icon .icon {
  width: 16px;
  height: 16px;
}

.chapter-block.is-expanded .chapter-toggle-icon {
  transform: rotate(90deg);
}

.chapter-name {
  overflow: hidden;
  font-family: var(--serif-font);
  font-size: 16px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-detail {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
}

.chapter-summary-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--teal);
  background: rgba(125, 200, 191, 0.16);
}

.chapter-summary-mark .icon {
  width: 13px;
  height: 13px;
}

.chapter-body {
  display: none;
  padding: 0 0 14px calc((var(--chapter-level, 1) - 1) * 17px + 30px);
}

.chapter-block.is-expanded .chapter-body {
  display: block;
}

.chapter-summary {
  width: 100%;
  display: block;
  margin: 0 0 15px;
  padding: 13px 15px;
  border: 1px solid rgba(43, 77, 81, 0.08);
  border-radius: 16px;
  color: var(--ink-soft);
  background: rgba(184, 204, 209, 0.24);
  font-family: var(--serif-font);
  font-size: 13px;
  line-height: 1.7;
  text-align: left;
  cursor: pointer;
}

.chapter-summary strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-family: var(--ui-font);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.empty-summary {
  color: var(--ink-faint);
  background: rgba(255, 255, 255, 0.24);
}

.note-item {
  position: relative;
  padding: 15px 0 17px;
  border-top: 1px solid rgba(43, 77, 81, 0.09);
  scroll-margin-top: 120px;
}

.note-item:first-of-type {
  border-top: 0;
}

.note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.note-date {
  color: var(--ink-faint);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.note-actions {
  width: 38px;
  height: 36px;
  display: grid;
  place-items: center;
  margin: -5px -8px -5px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
}

.note-actions .icon {
  width: 18px;
  height: 18px;
}

.quote-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  color: #355766;
  background: rgba(184, 204, 209, 0.36);
  font-size: 9px;
}

.quote-flag .icon {
  width: 11px;
  height: 11px;
}

.rich-content {
  overflow-wrap: anywhere;
  font-family: var(--serif-font);
  font-size: 15px;
  line-height: 1.82;
  border-radius: 10px;
  transition: background-color 160ms ease, box-shadow 160ms ease;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.rich-content u,
.rich-editor u {
  text-decoration-line: underline;
  text-decoration-thickness: 1.2px;
  text-underline-offset: 3px;
}

.thought-list {
  display: grid;
  gap: 9px;
  margin: 12px 0 0 2px;
}

.thought-extra {
  display: grid;
  gap: 9px;
}

.thought {
  position: relative;
  margin: 0;
  padding: 2px 0 2px 15px;
  color: #35555b;
  font-family: var(--serif-font);
  font-size: 14px;
  line-height: 1.75;
  border-radius: 10px;
  transition: background-color 160ms ease, box-shadow 160ms ease;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.rich-content.is-pressing,
.thought.is-pressing {
  background: rgba(247, 189, 250, 0.28);
}

.rich-content.is-copy-feedback,
.thought.is-copy-feedback {
  background: rgba(148, 160, 53, 0.16);
}

.thought::before {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--teal-bright), rgba(82, 122, 137, 0.28));
  content: "";
}

.thought-label {
  display: block;
  margin-bottom: 3px;
  color: var(--ink-faint);
  font-family: var(--ui-font);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.thought-toggle {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  padding: 0 2px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.thought-toggle .icon {
  width: 14px;
  height: 14px;
  transition: transform 170ms var(--ease-out);
}

.thought-toggle[aria-expanded="true"] .icon {
  transform: rotate(90deg);
}

.thought-toggle:active {
  opacity: 0.62;
}

.empty-chapter {
  padding: 14px 0 10px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.book-bottom-bar {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 70;
  min-height: 66px;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 9px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 23px;
  background: rgba(247, 245, 236, 0.56);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.64),
    0 12px 30px rgba(39, 61, 67, 0.13);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

.book-bottom-bar[hidden] {
  display: none;
}

.reading-control {
  border: 1px solid rgba(44, 78, 82, 0.11);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.52);
}

.note-button {
  border-radius: 17px;
}

.search-view {
  padding-top: 51px;
  background:
    radial-gradient(circle at 90% 0%, rgba(125, 200, 191, 0.18), transparent 30%),
    var(--paper);
}

.search-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 14px 10px 8px;
}

.search-field {
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  padding: 0 7px 0 13px;
  border: 1px solid rgba(46, 78, 82, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.search-field .icon {
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
}

.search-field input {
  min-width: 0;
  height: 42px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  appearance: none;
}

.search-field input::placeholder {
  color: #63787a;
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.clear-search {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
}

.clear-search .icon {
  width: 15px;
  height: 15px;
}

.search-scope-wrap {
  padding: 3px 21px 10px;
}

.search-scope {
  width: 100%;
}

.search-scope button {
  flex: 1;
}

.search-results {
  padding: 7px 21px 60px;
}

.search-section-title {
  margin: 15px 0 8px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.search-result {
  width: 100%;
  display: block;
  padding: 15px 0;
  border: 0;
  border-top: 1px solid var(--hairline);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-result:active {
  opacity: 0.68;
}

.search-result-book {
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 9px;
  font-weight: 700;
}

.search-result-title {
  margin: 0;
  font-family: var(--serif-font);
  font-size: 15px;
  font-weight: 600;
}

.search-result-excerpt {
  display: -webkit-box;
  overflow: hidden;
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-family: var(--serif-font);
  font-size: 12px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.search-empty {
  padding: 76px 32px;
  color: var(--ink-soft);
  text-align: center;
}

.search-empty .icon {
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  color: var(--teal);
}

.search-empty h3 {
  margin: 0 0 7px;
  color: var(--ink);
  font-family: var(--serif-font);
  font-size: 19px;
  font-weight: 600;
}

.search-empty p {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
}

.quick-dock {
  position: absolute;
  right: 44px;
  bottom: 19px;
  left: 44px;
  z-index: 80;
  height: 63px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 6px 11px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 23px;
  background: rgba(248, 246, 238, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.64),
    0 12px 30px rgba(39, 63, 68, 0.13);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  transition: opacity 180ms var(--ease-out), transform 200ms var(--ease-out);
}

body[data-screen="book"] .quick-dock,
body[data-screen="search"] .quick-dock {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.dock-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  border: 0;
  border-radius: 16px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 9px;
  cursor: pointer;
  transition: transform 120ms var(--ease-out), background-color 150ms var(--ease-out);
}

.dock-button .icon {
  width: 20px;
  height: 20px;
}

.dock-button:active {
  transform: scale(0.94);
}

.dock-button.is-current {
  color: var(--ink);
}

.dock-add {
  width: 46px;
  justify-self: center;
  padding: 0;
  border-radius: 50%;
  color: #fbf8ef;
  background: var(--ink);
  box-shadow: 0 5px 13px rgba(32, 63, 69, 0.2);
}

.dock-add .icon {
  width: 22px;
  height: 22px;
}

.home-indicator {
  position: absolute;
  bottom: 7px;
  left: 50%;
  z-index: 100;
  width: 132px;
  height: 5px;
  border-radius: 999px;
  background: rgba(25, 47, 51, 0.8);
  transform: translateX(-50%);
  pointer-events: none;
}

.sheet-dialog {
  --phone-left: 0px;
  --phone-top: 0px;
  --phone-width: 100vw;
  --phone-height: 100dvh;
  position: fixed;
  inset: auto;
  top: var(--phone-top);
  left: var(--phone-left);
  width: var(--phone-width);
  height: var(--phone-height);
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
}

.sheet-dialog::backdrop {
  background: rgba(15, 34, 38, 0.24);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sheet-dialog[open] {
  display: flex;
  align-items: flex-end;
}

.sheet {
  width: 100%;
  max-height: calc(var(--phone-height) - 52px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 21px calc(24px + env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-bottom: 0;
  border-radius: 31px 31px 0 0;
  background: rgba(247, 245, 237, 0.96);
  box-shadow: 0 -18px 48px rgba(31, 54, 59, 0.16);
  backdrop-filter: blur(28px) saturate(1.12);
  -webkit-backdrop-filter: blur(28px) saturate(1.12);
  transform: translateY(0);
  opacity: 1;
  transition: transform 320ms var(--ease-drawer), opacity 240ms var(--ease-out);
  scrollbar-width: none;
}

.sheet::-webkit-scrollbar {
  display: none;
}

@starting-style {
  .sheet {
    opacity: 0.7;
    transform: translateY(100%);
  }
}

.sheet-dialog.is-closing .sheet {
  opacity: 0.85;
  transform: translateY(100%);
  transition-duration: 220ms;
}

.sheet-handle {
  width: 35px;
  height: 4px;
  margin: 1px auto 15px;
  border-radius: 999px;
  background: rgba(43, 68, 72, 0.18);
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.sheet-header h2 {
  margin: 0;
  font-family: var(--serif-font);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.sheet-header p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}

.sheet-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin: -4px -8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink-soft);
  background: rgba(42, 76, 79, 0.06);
  cursor: pointer;
}

.sheet-close:active {
  transform: scale(0.94);
}

.sheet-close .icon {
  width: 17px;
  height: 17px;
}

.form-stack {
  display: grid;
  gap: 15px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span,
.field-label {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.text-input,
.text-area,
.select-input {
  width: 100%;
  border: 1px solid rgba(44, 77, 80, 0.11);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  font-size: 15px;
  transition: border-color 150ms var(--ease-out), background-color 150ms var(--ease-out);
}

.text-input,
.select-input {
  min-height: 48px;
  padding: 0 14px;
}

.text-area {
  min-height: 100px;
  resize: vertical;
  padding: 13px 14px;
  line-height: 1.65;
}

.text-input::placeholder,
.text-area::placeholder {
  color: #718486;
}

.text-input:focus,
.text-area:focus,
.select-input:focus {
  border-color: rgba(60, 127, 122, 0.48);
  outline: 0;
  background: rgba(255, 255, 255, 0.84);
}

.form-error {
  min-height: 17px;
  margin: -4px 0 0;
  color: #8e3e45;
  font-size: 10px;
}

.form-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 9px;
  margin-top: 5px;
}

.cover-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.upload-cover-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.upload-cover-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(44, 77, 80, 0.11);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.upload-cover-status {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.45;
}

.cover-upload-preview {
  width: 32px;
  height: 43px;
  flex: none;
  border-radius: 2px 5px 5px 2px;
  background-color: var(--cover);
  background-image: var(--cover-image);
  background-position: center;
  background-size: cover;
  box-shadow: 2px 4px 7px rgba(31, 53, 58, 0.16);
}

.cover-swatch {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  cursor: pointer;
}

.cover-swatch.is-selected {
  border-color: var(--paper-strong);
  box-shadow: 0 0 0 2px var(--teal), inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.notice {
  margin: 16px 0 0;
  padding: 12px 13px;
  border: 1px solid rgba(118, 93, 25, 0.12);
  border-radius: 14px;
  color: #5f522d;
  background: rgba(184, 204, 209, 0.22);
  font-size: 11px;
  line-height: 1.55;
}

.notice button {
  min-height: 30px;
  margin-top: 6px;
  padding: 0;
  border: 0;
  color: var(--teal);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.choice-button {
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid rgba(44, 77, 80, 0.1);
  border-radius: 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  cursor: pointer;
}

.choice-button.is-selected {
  border-color: rgba(60, 127, 122, 0.3);
  color: var(--ink);
  background: rgba(125, 200, 191, 0.16);
}

.inline-toggle {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 13px;
  border: 1px solid rgba(44, 77, 80, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
}

.inline-toggle span {
  font-size: 12px;
}

.inline-toggle small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 9px;
}

.inline-toggle input {
  width: 42px;
  height: 25px;
  accent-color: var(--teal);
}

.action-sheet {
  display: grid;
  gap: 4px;
  margin-top: 15px;
}

.sheet-action {
  width: 100%;
  min-height: 51px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.sheet-action .icon {
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
}

.sheet-action:active {
  background: rgba(42, 76, 79, 0.07);
  transform: scale(0.99);
}

.sheet-action.is-danger {
  color: #863b43;
}

.sheet-action.is-danger .icon {
  color: currentColor;
}

.sheet-action small {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 9px;
}

.period-summary {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 8px;
  margin-top: 19px;
}

.period-summary-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.period-summary-three .period-stat {
  padding-right: 9px;
  padding-left: 9px;
}

.period-summary-three .period-stat strong {
  font-size: 17px;
}

.period-stat {
  padding: 13px 14px;
  border: 1px solid rgba(44, 77, 80, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.42);
}

.period-stat span {
  color: var(--ink-soft);
  font-size: 9px;
}

.period-stat strong {
  display: block;
  margin-top: 5px;
  font-family: var(--serif-font);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.period-books {
  display: grid;
  gap: 0;
  margin-top: 17px;
}

.period-book {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  border-top: 1px solid var(--hairline);
}

.period-book-cover {
  width: 31px;
  height: 42px;
  border-radius: 2px 5px 5px 2px;
  background: var(--cover);
  box-shadow: 2px 3px 6px rgba(32, 53, 58, 0.15);
}

.period-book-title {
  overflow: hidden;
  font-family: var(--serif-font);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-book-meta {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 9px;
}

.period-book-time {
  color: var(--ink-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.quote-viewer {
  position: relative;
  min-height: 145px;
  margin-top: 20px;
  padding: 17px 18px 35px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 21px;
  color: #f8f4e8;
  background:
    radial-gradient(circle at 92% 12%, rgba(248, 244, 234, 0.18), transparent 28%),
    #3e6475;
}

.quote-viewer > .icon {
  width: 22px;
  height: 22px;
  color: #b8d0d5;
}

.quote-copy {
  margin: 8px 0 0;
  font-family: var(--serif-font);
  font-size: 16px;
  line-height: 1.75;
  transition: opacity 240ms var(--ease-out), filter 240ms var(--ease-out);
}

.quote-copy.is-changing {
  opacity: 0;
  filter: blur(2px);
}

.quote-source {
  margin: 8px 0 0;
  color: rgba(248, 244, 231, 0.58);
  font-size: 9px;
}

.quote-dots {
  position: absolute;
  right: 16px;
  bottom: 14px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quote-dot {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.quote-dot::after {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(248, 244, 231, 0.35);
  content: "";
  transition: width 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.quote-dot.is-selected::after {
  width: 15px;
  border-radius: 999px;
  background: var(--yellow);
}

.no-quotes {
  margin-top: 18px;
  padding: 17px;
  border: 1px dashed rgba(44, 77, 80, 0.15);
  border-radius: 17px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.25);
  font-size: 11px;
  line-height: 1.6;
}

.editor-shell {
  margin-top: 18px;
}

.editor-block {
  position: relative;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(44, 77, 80, 0.09);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.44);
}

.editor-block.has-thought {
  padding-left: 18px;
}

.editor-block.has-thought::before {
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 8px;
  width: 2px;
  border-radius: 999px;
  background: rgba(60, 127, 122, 0.45);
  content: "";
}

.editor-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.editor-remove {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin: -8px -6px -8px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
}

.editor-remove .icon {
  width: 14px;
  height: 14px;
}

.rich-editor {
  min-height: 112px;
  overflow-wrap: anywhere;
  padding: 2px 0;
  font-family: var(--serif-font);
  font-size: 15px;
  line-height: 1.82;
  outline: 0;
}

.rich-editor:empty::before {
  color: #78898b;
  content: attr(data-placeholder);
  pointer-events: none;
}

.rich-editor.thought-editor {
  min-height: 66px;
}

.add-thought-button {
  width: 100%;
  min-height: 45px;
  margin-top: 10px;
  border: 1px dashed rgba(60, 127, 122, 0.3);
  border-radius: 14px;
  color: var(--teal);
  background: rgba(125, 200, 191, 0.08);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.add-thought-button:disabled {
  color: var(--ink-faint);
  opacity: 0.56;
  cursor: default;
}

.editor-toolbar {
  position: sticky;
  bottom: -24px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 12px -21px -24px;
  padding: 10px 21px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(44, 77, 80, 0.08);
  background: rgba(247, 245, 237, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.format-button,
.highlight-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 11px;
  color: var(--ink);
  background: transparent;
  font-family: Georgia, serif;
  font-size: 15px;
  cursor: pointer;
}

.format-button:active,
.highlight-button:active {
  background: rgba(42, 76, 79, 0.08);
  transform: scale(0.94);
}

.format-button.is-active {
  color: var(--teal);
  background: rgba(125, 200, 191, 0.14);
}

.highlight-divider {
  width: 1px;
  height: 22px;
  margin: 0 3px;
  background: var(--hairline);
}

.highlight-button::after {
  width: 17px;
  height: 17px;
  border: 1px solid rgba(31, 55, 59, 0.12);
  border-radius: 50%;
  background: var(--highlight);
  content: "";
}

.format-spacer {
  flex: 1;
}

.save-note-button {
  min-height: 40px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  color: #fbf8ef;
  background: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.save-note-button:active {
  transform: scale(0.97);
}

.save-note-button:disabled {
  opacity: 0.45;
  cursor: default;
}

mark.highlight-pink {
  color: inherit;
  background: rgba(237, 169, 189, 0.42);
}

mark.highlight-blue {
  color: inherit;
  background: rgba(137, 188, 217, 0.38);
}

.sheet mark.highlight-mint,
mark.highlight-mint {
  color: inherit;
  background: rgba(125, 200, 191, 0.36);
}

mark.highlight-pale {
  color: inherit;
  background: rgba(166, 190, 198, 0.55);
}

mark.highlight-wine {
  color: inherit;
  background: rgba(65, 28, 27, 0.2);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.segmented-wide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
  padding: 4px;
  border-radius: 15px;
  background: rgba(234, 238, 231, 0.64);
}

.segmented-wide button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.segmented-wide button.is-selected {
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: 0 2px 8px rgba(36, 61, 67, 0.1);
}

.toast {
  position: fixed;
  z-index: 500;
  left: 50%;
  bottom: 94px;
  max-width: min(340px, calc(100vw - 40px));
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: #f8f5eb;
  background: rgba(24, 48, 53, 0.94);
  box-shadow: 0 12px 28px rgba(20, 38, 43, 0.22);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px) scale(0.97);
  transition: opacity 220ms ease, transform 320ms var(--ease-out);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.completion-celebration {
  position: absolute;
  inset: 0;
  z-index: 115;
  display: grid;
  place-items: center;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.completion-celebration.is-active {
  visibility: visible;
  opacity: 1;
}

.celebration-ring {
  position: absolute;
  width: 94px;
  height: 94px;
  border: 1px solid var(--champagne);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.72);
}

.completion-celebration.is-active .celebration-ring {
  animation: completion-ring 820ms var(--ease-out) both;
}

.celebration-word {
  position: relative;
  z-index: 2;
  padding: 10px 22px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 253, 249, 0.82);
  box-shadow: 0 16px 42px rgba(43, 31, 20, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: var(--serif-font);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.12em;
  opacity: 0;
  transform: translateY(7px) scale(0.96);
}

.completion-celebration.is-active .celebration-word {
  animation: completion-word 720ms var(--ease-out) 80ms both;
}

.celebration-shards {
  position: absolute;
  inset: 0;
}

.celebrate-shard {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--w, 5px);
  height: var(--h, 13px);
  border-radius: 999px;
  background: var(--shard-color, var(--pink));
  opacity: 0;
  transform: translate(-50%, -50%);
}

.completion-celebration.is-active .celebrate-shard {
  animation: completion-shard 780ms var(--ease-out) var(--delay, 0ms) both;
}

@keyframes completion-ring {
  0% {
    opacity: 0;
    transform: scale(0.72);
  }

  30% {
    opacity: 0.75;
  }

  100% {
    opacity: 0;
    transform: scale(2.8);
  }
}

@keyframes completion-word {
  0% {
    opacity: 0;
    transform: translateY(7px) scale(0.96);
  }

  45%,
  75% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-5px) scale(0.99);
  }
}

@keyframes completion-shard {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--start-rotate)) translateY(0);
  }

  20% {
    opacity: 0.9;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--end-rotate)) translateY(var(--distance));
  }
}

.sheet.sheet-completion {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--pink) 32%, transparent), transparent 31%),
    rgba(255, 252, 246, 0.97);
}

.completion-card {
  position: relative;
  margin: 4px 0 0;
  padding: 18px 4px 12px;
  color: var(--ink);
  background: transparent;
}

.completion-card::before {
  display: none;
}

.completion-card > * {
  position: relative;
  z-index: 1;
}

.completion-date {
  color: var(--ink-soft);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.completion-sentence {
  max-width: 12em;
  margin: 20px 0 0;
  font-family: var(--serif-font);
  font-size: 29px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.035em;
}

.completion-sentence strong,
.completion-sentence em {
  font-style: normal;
  font-weight: 600;
}

.completion-sentence .completion-book-title {
  display: inline-block;
  max-width: 100%;
  color: var(--wine);
  white-space: nowrap;
}

.completion-author {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
}

.completion-quote-wrap {
  margin: 27px 0 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
}

.completion-quote {
  margin: 0;
  font-family: var(--serif-font);
  font-size: 18px;
  line-height: 1.82;
  letter-spacing: -0.012em;
}

.completion-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  padding-top: 17px;
  border-top: 0;
}

.completion-duration span {
  display: block;
  color: var(--ink-soft);
  font-size: 9px;
}

.completion-duration strong {
  display: block;
  margin-top: 4px;
  font-family: var(--serif-font);
  font-size: 20px;
  font-weight: 600;
}

.completion-signature {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
  text-align: right;
}

.completion-signature strong {
  display: block;
  color: var(--ink);
  font-family: var(--serif-font);
  font-size: 15px;
  font-weight: 600;
}

.completion-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 16px;
}

.completion-actions .primary-button {
  min-width: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.finish-ending-preview {
  margin-top: 19px;
  padding: 15px 16px;
  border: 1px solid rgba(199, 164, 95, 0.22);
  border-radius: 17px;
  background: rgba(247, 189, 250, 0.2);
}

.finish-ending-preview span {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.finish-ending-preview p {
  margin: 8px 0 0;
  font-family: var(--serif-font);
  font-size: 14px;
  line-height: 1.72;
}

.theme-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.theme-choice-card {
  min-height: 92px;
  padding: 11px 10px;
  border: 1px solid rgba(44, 77, 80, 0.11);
  border-radius: 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  text-align: left;
  cursor: pointer;
}

.theme-choice-card.is-selected {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.theme-choice-card strong {
  display: block;
  font-size: 12px;
}

.theme-choice-card span {
  display: block;
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.5;
}

.theme-swatch {
  display: flex;
  gap: 4px;
  margin-top: 9px;
}

.theme-swatch i {
  width: 13px;
  height: 8px;
  border-radius: 999px;
  background: var(--swatch);
}

/* 2.0 is the working palette. The original token set above remains intact as 1.0. */
html[data-theme="v2"] {
  --ink: #181412;
  --ink-soft: #554b45;
  --ink-faint: #756960;
  --paper: #fbf8f4;
  --paper-strong: #fffdf9;
  --blue-mist: #f7bdfa;
  --blue-deep: #411c1b;
  --teal: #94a035;
  --teal-bright: #b8c268;
  --yellow: #411c1b;
  --yellow-soft: #f3d9f4;
  --wine: #411c1b;
  --pink: #f7bdfa;
  --champagne: #c7a45f;
  --champagne-soft: #f0e3c5;
  --book-paper: #fffdf9;
  --glass: rgba(255, 253, 249, 0.7);
  --glass-border: rgba(255, 255, 255, 0.74);
  --glass-rim: rgba(65, 28, 27, 0.15);
  --glass-edge: rgba(255, 255, 255, 0.92);
  --glass-depth: rgba(65, 28, 27, 0.12);
  --hairline: rgba(65, 28, 27, 0.12);
  --shadow-soft: 0 18px 44px rgba(65, 28, 27, 0.1), 0 2px 9px rgba(65, 28, 27, 0.05);
  --shadow-device: 0 42px 90px rgba(28, 21, 15, 0.22), 0 8px 26px rgba(28, 21, 15, 0.14);
}

html[data-theme="v2"] body {
  background:
    radial-gradient(circle at 82% 18%, rgba(148, 160, 53, 0.5), transparent 30%),
    linear-gradient(145deg, #f7bdfa 0%, #e6bee8 100%);
}

html[data-theme="v2"] .app-main {
  background:
    linear-gradient(180deg, #94a035 0%, #a6ae49 18%, #f7f0d5 43%, #fbf8f4 66%, #fbf8f4 100%);
}

html[data-theme="v2"] .app-main::before {
  opacity: 0;
}

html[data-theme="v2"] .rhythm-panel,
html[data-theme="v2"] .book-hero {
  border-color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 253, 249, 0.76);
}

html[data-theme="v2"] .segmented {
  background: rgba(255, 255, 255, 0.34);
}

html[data-theme="v2"] .segmented button.is-selected {
  color: #181412;
  background: #f7bdfa;
}

html[data-theme="v2"] .welcome-block em {
  color: #411c1b;
}

html[data-theme="v2"] .welcome-block em::after {
  height: 0.2em;
  border-radius: 999px;
  background: #f7bdfa;
  transform: none;
}

html[data-theme="v2"] .chart-bar-button .bar-fill {
  background: #f7bdfa;
}

html[data-theme="v2"] .chart-bar-button.is-current .bar-fill {
  background: #411c1b;
}

html[data-theme="v2"] .chart-bar-button.is-empty .bar-fill {
  background: rgba(65, 28, 27, 0.12);
}

html[data-theme="v2"] .continue-card {
  color: #fff9f5;
  background: #411c1b;
  box-shadow: 0 14px 28px rgba(65, 28, 27, 0.2);
}

html[data-theme="v2"] .mini-cover-teal {
  color: #181412;
  background: #f7bdfa;
}

html[data-theme="v2"] .continue-action {
  border-color: rgba(255, 249, 245, 0.26);
}

html[data-theme="v2"] .status-pill {
  color: #411c1b;
  background: rgba(247, 189, 250, 0.7);
}

html[data-theme="v2"] .primary-button {
  color: #181412;
  background: #f7bdfa;
  box-shadow: 0 8px 18px rgba(151, 67, 154, 0.15);
}

html[data-theme="v2"] .dock-add,
html[data-theme="v2"] .save-note-button {
  color: #181412;
  background: #f7bdfa;
}

html[data-theme="v2"] .quick-dock,
html[data-theme="v2"] .book-bottom-bar {
  background: rgba(255, 253, 249, 0.56);
}

html[data-theme="v2"] .chapter-summary {
  color: #554b45;
  background: rgba(199, 164, 95, 0.14);
}

html[data-theme="v2"] .chapter-summary-mark {
  color: #67731d;
  background: rgba(148, 160, 53, 0.16);
}

html[data-theme="v2"] .thought::before,
html[data-theme="v2"] .editor-block.has-thought::before {
  background: #94a035;
}

html[data-theme="v2"] .thought {
  color: #554b45;
}

html[data-theme="v2"] .small-text-button {
  color: #67731d;
}

html[data-theme="v2"] .status-pill::before {
  background: #411c1b;
}

html[data-theme="v2"] .quote-flag {
  color: #411c1b;
  background: rgba(199, 164, 95, 0.28);
}

html[data-theme="v2"] .rich-content span[style*="background-color"],
html[data-theme="v2"] .rich-editor span[style*="background-color"] {
  background-color: rgba(65, 28, 27, 0.2) !important;
}

html[data-theme="v2"] .quote-viewer {
  background:
    radial-gradient(circle at 92% 12%, rgba(247, 189, 250, 0.25), transparent 28%),
    #411c1b;
}

html[data-theme="v2"] .quote-viewer > .icon {
  color: #c7a45f;
}

html[data-theme="v2"] .quote-dot.is-selected::after {
  background: #c7a45f;
}

html[data-theme="v2"] .book-toolbar {
  background: linear-gradient(180deg, rgba(148, 160, 53, 0.94), rgba(178, 188, 104, 0.8) 75%, transparent);
}

html[data-theme="v2"] .search-view {
  background:
    radial-gradient(circle at 90% 0%, rgba(148, 160, 53, 0.34), transparent 31%),
    #fbf8f4;
}

html[data-theme="v2"] .search-field input::placeholder {
  color: #756960;
}

html[data-theme="v2"] .guide-mark {
  color: #181412;
  border-color: rgba(65, 28, 27, 0.32);
  background: #94a035;
}

html[data-theme="v2"] .guide-theme-switch button.is-selected {
  color: #181412;
  background: #94a035;
}

html[data-theme="v2"] .completion-card {
  background: transparent;
}

html[data-theme="v2"] .demo-guide {
  color: #411c1b;
}

html[data-theme="v2"] .guide-brand,
html[data-theme="v2"] .guide-theme {
  color: rgba(65, 28, 27, 0.63);
}

html[data-theme="v2"] .guide-lede {
  color: rgba(65, 28, 27, 0.72);
}

html[data-theme="v2"] .guide-steps {
  border-color: rgba(65, 28, 27, 0.16);
}

html[data-theme="v2"] .guide-steps button {
  color: #411c1b;
  border-color: rgba(65, 28, 27, 0.16);
}

html[data-theme="v2"] .guide-steps button span,
html[data-theme="v2"] .guide-reset {
  color: rgba(65, 28, 27, 0.5);
}

html[data-theme="v2"] .guide-theme-switch {
  background: rgba(255, 253, 249, 0.26);
}

html[data-theme="v2"] .book-spine {
  color: #181412;
  background: #fffdf9;
  border: 1px solid rgba(65, 28, 27, 0.1);
}

html[data-theme="v2"] .book-spine::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--book-accent, var(--pink));
  content: "";
}

html[data-theme="v2"] .book-spine::after {
  display: none;
}

html[data-theme="v2"] .book-spine .spine-meta {
  color: #756960;
}

html[data-theme="v2"] .flat-cover {
  color: #181412;
  background-color: #fffdf9;
  background-image: none;
  border-left: 8px solid var(--book-accent, var(--pink));
  box-shadow: 5px 10px 18px rgba(65, 28, 27, 0.12);
}

html[data-theme="v2"] .flat-cover::before {
  border-color: rgba(65, 28, 27, 0.18);
}

html[data-theme="v2"] .flat-cover::after {
  background: rgba(65, 28, 27, 0.22);
}

html[data-theme="v2"] .flat-cover .flat-cover-author {
  color: #756960;
}

html[data-theme="v2"] .flat-cover.has-cover-image {
  color: #fff;
  background-image:
    linear-gradient(180deg, rgba(8, 20, 22, 0.08), rgba(8, 20, 22, 0.58)),
    var(--cover-image);
}

/* 3.0 uses the V2 reference: mint, chartreuse and a deep wine-black. */
html[data-theme="v3"] {
  --ink: #2a0000;
  --ink-soft: #685b55;
  --ink-faint: #897b74;
  --paper: #fbfaf4;
  --paper-strong: #fffef9;
  --blue-mist: #71cac4;
  --blue-deep: #2a0000;
  --teal: #c5c429;
  --teal-bright: #71cac4;
  --yellow: #2a0000;
  --yellow-soft: #e8ecc6;
  --wine: #2a0000;
  --pink: #71cac4;
  --champagne: #c5c429;
  --champagne-soft: #edf0d1;
  --book-paper: #fffef9;
  --glass: rgba(255, 254, 249, 0.74);
  --glass-border: rgba(255, 255, 255, 0.72);
  --glass-rim: rgba(42, 0, 0, 0.16);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-depth: rgba(42, 0, 0, 0.13);
  --hairline: rgba(42, 0, 0, 0.12);
  --shadow-soft: 0 18px 44px rgba(42, 0, 0, 0.11), 0 2px 9px rgba(42, 0, 0, 0.05);
  --shadow-device: 0 42px 90px rgba(42, 0, 0, 0.26), 0 8px 26px rgba(42, 0, 0, 0.18);
}

html[data-theme="v3"] body {
  background:
    radial-gradient(circle at 18% 18%, rgba(113, 202, 196, 0.32), transparent 32%),
    linear-gradient(145deg, #2a0000 0%, #4a1210 100%);
}

html[data-theme="v3"] .app-main {
  background:
    linear-gradient(180deg, #71cac4 0%, #a8dfd8 22%, #f1f2e6 48%, #fbfaf4 70%, #fbfaf4 100%);
}

html[data-theme="v3"] .app-main::before {
  opacity: 0;
}

html[data-theme="v3"] .rhythm-panel,
html[data-theme="v3"] .book-hero {
  border-color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 254, 249, 0.8);
}

html[data-theme="v3"] .segmented {
  background: rgba(255, 255, 255, 0.34);
}

html[data-theme="v3"] .segmented button.is-selected,
html[data-theme="v3"] .guide-theme-switch button.is-selected {
  color: #2a0000;
  background: #c5c429;
}

html[data-theme="v3"] .welcome-block em {
  color: #2a0000;
}

html[data-theme="v3"] .welcome-block em::after {
  height: 0.2em;
  border-radius: 999px;
  background: #c5c429;
  transform: none;
}

html[data-theme="v3"] .chart-bar-button .bar-fill {
  background: #c5c429;
}

html[data-theme="v3"] .chart-bar-button.is-current .bar-fill {
  background: #2a0000;
}

html[data-theme="v3"] .chart-bar-button.is-empty .bar-fill {
  background: rgba(42, 0, 0, 0.12);
}

html[data-theme="v3"] .continue-card {
  color: #fffef9;
  background: #2a0000;
  box-shadow: 0 14px 28px rgba(42, 0, 0, 0.22);
}

html[data-theme="v3"] .mini-cover-teal {
  color: #2a0000;
  background: #71cac4;
}

html[data-theme="v3"] .continue-action {
  border-color: rgba(255, 254, 249, 0.27);
}

html[data-theme="v3"] .status-pill {
  color: #2a0000;
  background: rgba(113, 202, 196, 0.62);
}

html[data-theme="v3"] .status-pill::before {
  background: #2a0000;
}

html[data-theme="v3"] .primary-button,
html[data-theme="v3"] .dock-add,
html[data-theme="v3"] .save-note-button {
  color: #2a0000;
  background: #c5c429;
  box-shadow: 0 8px 18px rgba(74, 78, 10, 0.18);
}

html[data-theme="v3"] .quick-dock,
html[data-theme="v3"] .book-bottom-bar {
  background: rgba(255, 254, 249, 0.55);
}

html[data-theme="v3"] .book-toolbar {
  background: linear-gradient(180deg, rgba(113, 202, 196, 0.94), rgba(169, 222, 215, 0.8) 75%, transparent);
}

html[data-theme="v3"] .search-view {
  background:
    radial-gradient(circle at 90% 0%, rgba(113, 202, 196, 0.36), transparent 31%),
    #fbfaf4;
}

html[data-theme="v3"] .search-field input::placeholder {
  color: #897b74;
}

html[data-theme="v3"] .chapter-summary {
  color: #685b55;
  background: rgba(197, 196, 41, 0.13);
}

html[data-theme="v3"] .chapter-summary-mark {
  color: #2a0000;
  background: rgba(113, 202, 196, 0.28);
}

html[data-theme="v3"] .thought::before,
html[data-theme="v3"] .editor-block.has-thought::before {
  background: #c5c429;
}

html[data-theme="v3"] .thought {
  color: #685b55;
}

html[data-theme="v3"] .small-text-button {
  color: #6e6f13;
}

html[data-theme="v3"] .quote-flag {
  color: #2a0000;
  background: rgba(197, 196, 41, 0.26);
}

html[data-theme="v3"] .rich-content span[style*="background-color"],
html[data-theme="v3"] .rich-editor span[style*="background-color"] {
  background-color: rgba(42, 0, 0, 0.18) !important;
}

html[data-theme="v3"] .quote-viewer {
  background:
    radial-gradient(circle at 92% 12%, rgba(113, 202, 196, 0.27), transparent 28%),
    #2a0000;
}

html[data-theme="v3"] .quote-viewer > .icon {
  color: #c5c429;
}

html[data-theme="v3"] .quote-dot.is-selected::after {
  background: #c5c429;
}

html[data-theme="v3"] .guide-mark {
  color: #2a0000;
  border-color: rgba(255, 254, 249, 0.46);
  background: #c5c429;
}

html[data-theme="v3"] .guide-theme-switch {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="v3"] .book-spine {
  color: #2a0000;
  background: #fffef9;
  border: 1px solid rgba(42, 0, 0, 0.1);
}

html[data-theme="v3"] .book-spine::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--book-accent, #71cac4);
  content: "";
}

html[data-theme="v3"] .book-spine::after {
  display: none;
}

html[data-theme="v3"] .book-spine .spine-meta {
  color: #897b74;
}

html[data-theme="v3"] .flat-cover {
  color: #2a0000;
  background-color: #fffef9;
  background-image: none;
  border-left: 8px solid var(--book-accent, #71cac4);
  box-shadow: 5px 10px 18px rgba(42, 0, 0, 0.11);
}

html[data-theme="v3"] .flat-cover::before {
  border-color: rgba(42, 0, 0, 0.18);
}

html[data-theme="v3"] .flat-cover::after {
  background: rgba(42, 0, 0, 0.22);
}

html[data-theme="v3"] .flat-cover .flat-cover-author {
  color: #897b74;
}

html[data-theme="v3"] .flat-cover.has-cover-image {
  color: #fff;
  background-image:
    linear-gradient(180deg, rgba(8, 20, 22, 0.08), rgba(8, 20, 22, 0.58)),
    var(--cover-image);
}

html[data-theme="v3"] .completion-card {
  background: transparent;
}

html[data-theme="v1"] .rhythm-panel,
html[data-theme="v1"] .book-hero {
  border-color: rgba(255, 255, 255, 0.62);
  background: rgba(251, 247, 237, 0.72);
}

html[data-theme="v1"] .date-line {
  color: #2d4d58;
}

html[data-theme="v1"] .demo-guide {
  color: #1d3640;
}

html[data-theme="v1"] .guide-brand,
html[data-theme="v1"] .guide-theme {
  color: rgba(29, 54, 64, 0.64);
}

html[data-theme="v1"] .guide-lede {
  color: rgba(29, 54, 64, 0.78);
}

html[data-theme="v1"] .guide-mark {
  color: #fbf7ec;
  border-color: rgba(251, 247, 236, 0.68);
  background: #466b7b;
}

html[data-theme="v1"] .guide-steps {
  border-color: rgba(29, 54, 64, 0.18);
}

html[data-theme="v1"] .guide-steps button {
  color: #1d3640;
  border-color: rgba(29, 54, 64, 0.18);
}

html[data-theme="v1"] .guide-steps button span,
html[data-theme="v1"] .guide-reset {
  color: rgba(29, 54, 64, 0.54);
}

html[data-theme="v1"] .segmented button.is-selected {
  color: #263f48;
  background: #fbf7ec;
}

html[data-theme="v1"] .welcome-block em::after {
  background: rgba(197, 159, 99, 0.55);
}

html[data-theme="v1"] .chart-bar-button.is-current .bar-fill {
  background: linear-gradient(180deg, #d7bf8e, #b58a50);
}

html[data-theme="v1"] .primary-button,
html[data-theme="v1"] .dock-add,
html[data-theme="v1"] .save-note-button {
  color: #fffdf7;
  background: #466b7b;
}

html[data-theme="v1"] .book-toolbar {
  background: linear-gradient(180deg, rgba(155, 185, 193, 0.94), rgba(188, 208, 211, 0.78) 75%, transparent);
}

html[data-theme="v1"] .status-pill {
  color: #355766;
  background: rgba(184, 204, 209, 0.48);
}

html[data-theme="v1"] .quote-flag {
  color: #5b4931;
  background: rgba(215, 191, 142, 0.3);
}

html[data-theme="v1"] .search-view {
  background:
    radial-gradient(circle at 90% 0%, rgba(155, 185, 193, 0.32), transparent 31%),
    #f2eddf;
}

html[data-theme="v1"] .sheet {
  background: rgba(248, 244, 234, 0.97);
}

/* Liquid Glass approximation: translucent fill, a crisp inner edge,
   a soft outer rim and a restrained specular highlight. */
.icon-button,
.sheet-close {
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: linear-gradient(
    150deg,
    rgba(255, 255, 255, 0.5),
    rgba(255, 255, 255, 0.12) 58%,
    rgba(255, 255, 255, 0.28)
  );
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    inset 0 0 0 1px var(--glass-rim),
    0 5px 14px var(--glass-depth);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}

.secondary-button,
.reading-control,
.search-field,
.choice-button {
  border-color: rgba(255, 255, 255, 0.5);
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.68),
    rgba(255, 255, 255, 0.22) 62%,
    rgba(255, 255, 255, 0.42)
  );
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    inset 0 0 0 1px var(--glass-rim),
    inset 0 -1px 0 rgba(255, 255, 255, 0.18),
    0 8px 20px var(--glass-depth);
  backdrop-filter: blur(22px) saturate(1.28);
  -webkit-backdrop-filter: blur(22px) saturate(1.28);
}

.primary-button {
  border-color: rgba(255, 255, 255, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    0 9px 22px var(--glass-depth);
}

.segmented,
.sheet {
  border-color: var(--glass-border);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    inset 0 0 0 1px var(--glass-rim),
    0 15px 36px var(--glass-depth);
}

.quick-dock,
.book-bottom-bar {
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 10px 28px var(--glass-depth);
}

.segmented {
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.quick-dock,
.book-bottom-bar {
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

.sheet {
  backdrop-filter: blur(26px) saturate(1.35);
  -webkit-backdrop-filter: blur(26px) saturate(1.35);
}

.secondary-button:active,
.reading-control:active,
.icon-button:active,
.sheet-close:active,
.primary-button:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 0 0 1px var(--glass-rim),
    0 3px 9px var(--glass-depth);
}

@media (hover: hover) and (pointer: fine) {
  .icon-button:hover,
  .note-actions:hover {
    background: rgba(255, 255, 255, 0.38);
  }

  .continue-card:hover {
    transform: translateY(-1px);
  }

  .book-spine:hover,
  .flat-book:hover .flat-cover {
    transform: translateY(-4px);
  }

  .chapter-header:hover .chapter-name {
    color: var(--teal);
  }
}

@media (max-width: 980px) {
  .demo-stage {
    gap: 28px;
    padding-right: 20px;
    padding-left: 20px;
  }

  .demo-guide {
    width: 260px;
  }

  .guide-lede {
    font-size: 12px;
  }
}

@media (max-width: 780px) {
  .demo-stage {
    display: block;
    min-height: 100dvh;
    padding: 0;
  }

  .demo-guide {
    display: none;
  }

  .device-shell {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .device-shell::after {
    display: none;
  }

  .dynamic-island {
    top: max(10px, env(safe-area-inset-top));
  }

  .status-bar {
    height: calc(51px + env(safe-area-inset-top));
    padding-top: max(4px, env(safe-area-inset-top));
  }

  #homeView {
    padding-top: calc(57px + env(safe-area-inset-top));
  }

  .book-toolbar {
    height: calc(101px + env(safe-area-inset-top));
    padding-top: calc(49px + env(safe-area-inset-top));
  }

  .book-scroll {
    padding-top: calc(110px + env(safe-area-inset-top));
  }

  .search-view {
    padding-top: calc(51px + env(safe-area-inset-top));
  }

  .quick-dock {
    bottom: calc(19px + env(safe-area-inset-bottom));
  }

  .home-indicator {
    bottom: max(7px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 370px) {
  #homeView,
  .book-scroll,
  .search-results {
    padding-right: 17px;
    padding-left: 17px;
  }

  .welcome-block h1 {
    font-size: 31px;
  }

  .stat-summary {
    display: block;
  }

  .spine-shelf {
    gap: 4px;
  }
}

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