:root {
  color-scheme: dark;
  --bg: oklch(0.095 0 0);
  --surface: oklch(0.145 0.008 110);
  --surface-raised: oklch(0.19 0.012 110);
  --ink: oklch(0.965 0.006 110);
  --muted: oklch(0.72 0.014 110);
  --primary: oklch(0.50 0.105 110);
  --primary-strong: oklch(0.39 0.085 110);
  --accent: oklch(0.77 0.13 58);
  --danger: oklch(0.68 0.16 28);
  --focus: oklch(0.82 0.14 90);
  --reader-bg: oklch(0.92 0.022 110);
  --reader-ink: oklch(0.22 0.018 110);
  --reader-muted: oklch(0.45 0.018 110);
  --reader-rule: oklch(0.82 0.018 110);
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-reading: "Noto Serif SC", "Songti SC", STSong, SimSun, serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --z-sticky: 20;
  --z-dialog: 40;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: oklch(0.04 0 0);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: oklch(0.04 0 0);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
input,
[tabindex] {
  outline: none;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  box-shadow: 0 0 0 3px var(--focus);
}

button {
  border: 0;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.environment-badge {
  position: fixed;
  z-index: calc(var(--z-dialog) + 10);
  top: max(8px, env(safe-area-inset-top));
  right: max(12px, calc((100vw - 480px) / 2 + 12px));
  max-width: calc(100vw - 24px);
  margin: 0;
  padding: 6px 10px;
  overflow: hidden;
  color: oklch(0.16 0.02 75);
  border: 1px solid oklch(0.82 0.13 75);
  border-radius: 999px;
  background: oklch(0.86 0.15 75);
  box-shadow: 0 5px 18px oklch(0 0 0 / .24);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-midgard-environment="dev"] .login-view {
  padding-top: max(58px, calc(env(safe-area-inset-top) + 42px));
}

html[data-midgard-environment="dev"] .app-header,
html[data-midgard-environment="dev"] .immersive-header {
  min-height: calc(96px + env(safe-area-inset-top));
  padding-top: calc(30px + env(safe-area-inset-top));
}

.app-frame {
  --reader-max-width: 480px;
  position: relative;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
}

.view {
  min-height: 100dvh;
}

.login-view {
  display: flex;
  flex-direction: column;
  padding: max(24px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 85% 5%, oklch(0.31 0.07 110 / .36), transparent 34%),
    var(--bg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}

.brand-rule {
  width: 28px;
  height: 2px;
  background: var(--accent);
}

.login-copy {
  margin-top: clamp(54px, 14vh, 118px);
}

.domain-label,
.app-mark,
.section-heading > p,
.welcome-block > p,
.player-copy > p,
.sheet-header p,
.transcript-block > span,
.transcript-heading > span {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .035em;
}

.login-copy h1 {
  max-width: 8ch;
  margin: 0;
  font-size: 44px;
  font-weight: 620;
  line-height: 1.12;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.login-copy > p:last-child {
  max-width: 31ch;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  text-wrap: pretty;
}

.login-form {
  display: flex;
  flex-direction: column;
  margin-top: auto;
  padding-top: 44px;
}

.login-form label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.login-form input {
  width: 100%;
  min-height: 52px;
  margin: 0 0 18px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid oklch(0.34 0.015 110);
  border-radius: 10px;
  background: var(--surface);
  font-size: 16px;
}

.login-form input::placeholder {
  color: oklch(0.68 0.012 110);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 66px;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  min-height: 52px;
  padding: 0 14px;
}

.primary-button,
.secondary-button {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 10px;
  font-weight: 700;
  transition: background-color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.primary-button {
  color: oklch(1 0 0);
  background: var(--primary);
}

.primary-button:hover,
.primary-button:active {
  background: var(--primary-strong);
}

.primary-button:active,
.secondary-button:active,
.icon-button:active,
.destination-row:active,
.mv-row:active {
  transform: scale(.98);
}

.secondary-button {
  color: oklch(1 0 0);
  background: var(--primary-strong);
}

.text-button {
  min-height: 44px;
  padding: 0 10px;
  color: inherit;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
}

.prototype-note {
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.form-error {
  margin: -4px 0 14px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

.shell-view {
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

.app-header,
.immersive-header {
  position: sticky;
  z-index: var(--z-sticky);
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(66px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 20px 0;
  background: var(--bg);
}

.app-mark {
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: .11em;
}

.page-context {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  transition: background-color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.icon-button:hover {
  background: var(--surface-raised);
}

.icon-button svg,
.destination-row svg,
.nav-button svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main-content {
  padding: 18px 20px 28px;
}

.welcome-block {
  padding: 38px 0 34px;
}

.welcome-block h2,
.section-heading h2 {
  margin: 0;
  font-size: 36px;
  font-weight: 590;
  line-height: 1.18;
  letter-spacing: -.03em;
  text-wrap: balance;
}

.continue-panel {
  display: flex;
  width: 100%;
  padding: 22px;
  flex-direction: column;
  align-items: flex-start;
  color: oklch(0.98 0.005 110);
  border-radius: 14px;
  background: var(--primary-strong);
  text-align: left;
}

.continue-label {
  margin-bottom: 28px;
  color: oklch(0.86 0.04 110);
  font-size: 12px;
}

.continue-panel strong {
  margin-bottom: 7px;
  font-family: var(--font-reading);
  font-size: 22px;
}

.continue-panel > span:not(.continue-label, .continue-action) {
  color: oklch(0.88 0.02 110);
  font-size: 13px;
}

.continue-action {
  align-self: flex-end;
  margin-top: 30px;
  font-size: 13px;
  font-weight: 650;
}

.destination-list {
  margin-top: 24px;
  border-top: 1px solid oklch(0.28 0.012 110);
}

.destination-row {
  display: flex;
  width: 100%;
  min-height: 92px;
  align-items: center;
  gap: 16px;
  padding: 18px 2px;
  border-bottom: 1px solid oklch(0.28 0.012 110);
  background: transparent;
  text-align: left;
  transition: color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.destination-row:hover {
  color: var(--accent);
}

.destination-index {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-raised);
  font-family: var(--font-reading);
}

.destination-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 5px;
}

.destination-copy strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
}

.destination-copy span {
  color: var(--muted);
  font-size: 13px;
}

.destination-copy .coming-soon-tag {
  padding: 3px 7px;
  color: oklch(0.90 0.045 58);
  border-radius: 999px;
  background: oklch(0.31 0.055 58);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.destination-copy .coming-soon-tag.is-live {
  color: oklch(0.18 0.02 58);
  background: var(--accent);
}

.section-heading {
  padding: 42px 0 34px;
}

.book-entry {
  display: grid;
  grid-template-columns: 42% 1fr;
  gap: 20px;
  align-items: start;
}

.book-entry + .book-entry {
  margin-top: 34px;
  padding-top: 34px;
  border-top: 1px solid oklch(0.28 0.012 110);
}

.revision-alert {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 28px;
  padding: 12px 14px;
  color: var(--ink);
  border: 1px solid oklch(0.58 0.12 28 / .7);
  border-radius: 6px;
  background: oklch(0.30 0.05 28 / .22);
  text-align: left;
}

.revision-alert span:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.revision-alert small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-cover {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  padding: 0;
  overflow: hidden;
  border-radius: 6px 12px 12px 6px;
  background: #080808;
  box-shadow: -6px 0 0 oklch(0.25 0.035 110);
}

.book-cover-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Bottom-left keeps the badge off the cover's vertical title in the upper right. */
.book-cover-edition {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: grid;
  min-width: 38px;
  min-height: 24px;
  padding: 0 8px;
  place-items: center;
  color: oklch(0.16 0.02 85);
  border: 1px solid oklch(0.88 0.08 85 / .55);
  border-radius: 999px;
  background: oklch(0.88 0.10 85 / .94);
  box-shadow: 0 3px 12px oklch(0.04 0 0 / .35);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
}

.book-cover-edition.is-legacy {
  color: oklch(0.88 0.015 110);
  border-color: oklch(0.60 0.02 110 / .45);
  background: oklch(0.24 0.015 110 / .92);
}

.book-meta {
  padding-top: 4px;
}

.book-meta > p:first-child {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
}

.book-meta h3 {
  margin: 0 0 10px;
  font-family: var(--font-reading);
  font-size: 22px;
}

.book-meta > p:not(:first-child) {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.book-meta .secondary-button {
  width: 100%;
  min-height: 46px;
}

.protected-book-cover {
  display: flex;
  padding: 16px 14px 14px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  color: var(--ink);
  background: oklch(0.18 0.018 110);
  box-shadow: -6px 0 0 oklch(0.30 0.04 110);
  text-align: left;
}

.protected-book-cover::after {
  position: absolute;
  top: 0;
  right: 12px;
  width: 1px;
  height: 100%;
  background: oklch(0.38 0.035 110);
  content: "";
}

.protected-cover-type,
.protected-cover-lock {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}

.protected-book-cover strong {
  max-width: 100%;
  font-family: var(--font-reading);
  font-size: 24px;
  letter-spacing: 0;
}

.protected-book-view {
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.protected-book-body {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 44px 24px max(48px, env(safe-area-inset-bottom));
}

.protected-book-intro {
  padding: 28px 0 40px;
  border-bottom: 1px solid var(--line);
}

.protected-book-intro > p:first-child {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.protected-book-intro h1 {
  margin: 0;
  font-family: var(--font-reading);
  font-size: 48px;
  font-weight: 600;
  letter-spacing: 0;
}

.protected-book-intro > p:last-child {
  max-width: 38rem;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.protected-cover-section,
.protected-outline {
  padding: 42px 0;
  border-bottom: 1px solid var(--line);
}

.protected-section-heading {
  margin-bottom: 24px;
}

.protected-section-heading p {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.protected-section-heading h2 {
  margin: 0;
  font-family: var(--font-reading);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0;
}

.protected-cover-stage {
  margin: 0;
}

.protected-cover-stage img {
  display: block;
  width: min(100%, 32rem);
  aspect-ratio: 2 / 3;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: oklch(0.16 0.012 110);
  box-shadow: 0 18px 48px rgb(0 0 0 / .28);
  object-fit: cover;
}

.protected-cover-stage figcaption {
  display: grid;
  width: min(100%, 32rem);
  gap: 5px;
  margin: 18px auto 0;
}

.protected-cover-stage figcaption strong {
  font-size: 15px;
}

.protected-cover-stage figcaption span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.protected-cover-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 32rem);
  margin: 22px auto 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.protected-cover-tabs button {
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
}

.protected-cover-tabs button:last-child {
  border-right: 0;
}

.protected-cover-tabs button[aria-selected="true"] {
  color: var(--ink);
  background: var(--surface-raised);
}

.protected-outline-content {
  max-width: 42rem;
  color: var(--ink);
  font-family: var(--font-reading);
  font-size: 16px;
  line-height: 1.9;
}

.protected-outline-content h2,
.protected-outline-content h3,
.protected-outline-content h4 {
  margin: 2.1em 0 .7em;
  font-weight: 600;
  letter-spacing: 0;
}

.protected-outline-content h2 {
  font-size: 25px;
}

.protected-outline-content h3 {
  font-size: 21px;
}

.protected-outline-content h4 {
  font-size: 17px;
}

.protected-outline-content > h2:first-child {
  margin-top: 0;
}

.protected-outline-content p {
  margin: 0 0 1em;
}

.protected-outline-content ul,
.protected-outline-content ol {
  margin: 0 0 1.2em;
  padding-left: 1.35em;
}

.protected-outline-content li {
  margin: 0 0 .45em;
  padding-left: .2em;
}

.protected-outline-content hr {
  margin: 36px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.protected-book-body .secondary-button {
  width: 100%;
  margin-top: 36px;
}

.mv-list {
  border-top: 1px solid oklch(0.28 0.012 110);
}

.mv-row {
  display: grid;
  width: 100%;
  grid-template-columns: 88px 1fr 24px;
  gap: 16px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid oklch(0.28 0.012 110);
  background: transparent;
  text-align: left;
  transition: color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.mv-row:hover {
  color: var(--accent);
}

.mv-poster {
  position: relative;
  display: grid;
  aspect-ratio: 16 / 10;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--poster-bg, var(--surface-raised));
}

.mv-poster::before,
.orbit-mark::before {
  width: 52%;
  aspect-ratio: 1;
  border: 1px solid oklch(0.92 0.02 110 / .72);
  border-radius: 50%;
  content: "";
  transform: rotate(-22deg) scaleY(.42);
}

.mv-poster::after {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
  transform: translate(21px, -8px);
}

.mv-kind {
  position: relative;
  z-index: 1;
  display: none;
  color: oklch(0.92 0.02 110 / .86);
  font-family: var(--font-reading);
  font-size: 25px;
  font-weight: 650;
}

.mv-poster.is-audio::before,
.mv-poster.is-audio::after {
  display: none;
}

.mv-poster.is-audio .mv-kind {
  display: block;
}

.mv-copy {
  min-width: 0;
}

.mv-title-line {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 5px;
}

.mv-copy strong {
  min-width: 0;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.mv-new-badge {
  display: inline-flex;
  min-width: 34px;
  min-height: 20px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border: 1px solid oklch(0.9 0.12 80);
  border-radius: 3px;
  background: oklch(0.82 0.16 78);
  color: oklch(0.18 0.025 55);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 0 0 1px oklch(0.2 0.02 55 / .3), 0 0 12px oklch(0.82 0.16 78 / .22);
}

.mv-new-badge[hidden] {
  display: none;
}

.mv-version {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mv-arrow {
  color: var(--muted);
  font-size: 20px;
}

.asset-note {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.comics-heading {
  padding-bottom: 24px;
}

.comic-episode {
  margin: 0 -20px;
}

.comic-episode-header {
  padding: 0 20px 28px;
  border-top: 1px solid oklch(0.28 0.012 110);
}

.comic-episode-header > p:first-child {
  margin: 24px 0 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
}

.comic-episode-header h3 {
  margin: 0 0 10px;
  font-family: var(--font-reading);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.comic-episode-header > p:not(:first-child) {
  max-width: 34em;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.comic-version-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 22px;
}

.comic-version-switcher {
  width: min(100%, 260px);
}

.comic-version-switcher button {
  flex: 1;
  padding: 0 14px;
  white-space: nowrap;
}

.comic-version-status {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.comic-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-top: 22px;
}

.comic-progress > span {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: oklch(0.29 0.012 110);
}

.comic-progress i {
  display: block;
  width: 8.333%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms var(--ease-out);
}

.comic-progress strong {
  min-width: 74px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-align: right;
}

.comic-reader {
  padding: 10px 0;
  background: #050505;
}

.comic-page {
  margin: 0;
  background: #ffffff;
  position: relative;
}

.comic-page + .comic-page {
  margin-top: 10px;
}

.comic-page img {
  display: block;
  width: 100%;
  height: auto;
}

.comic-page[data-load-state="loading"] img,
.comic-page[data-load-state="error"] img {
  opacity: 0;
}

.comic-load-status {
  position: absolute;
  top: min(24%, 180px);
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  color: #666b61;
  font-size: 15px;
  line-height: 1.6;
  text-align: center;
}

.comic-load-status[hidden],
.comic-load-retry[hidden] {
  display: none;
}

.comic-load-retry {
  min-height: 44px;
  padding: 8px 18px;
  color: #36583c;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.comic-end-mark {
  margin: 0;
  padding: 36px 20px 92px;
  color: var(--muted);
  background: #050505;
  font-family: var(--font-reading);
  font-size: 14px;
  letter-spacing: .16em;
  text-align: center;
}

.bottom-nav {
  position: fixed;
  z-index: var(--z-sticky);
  right: auto;
  bottom: 0;
  left: 50%;
  width: min(100%, 480px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: calc(68px + env(safe-area-inset-bottom));
  padding: 6px 12px env(safe-area-inset-bottom);
  border-top: 1px solid oklch(0.25 0.01 110);
  background: oklch(0.105 0.004 110 / .96);
}

.nav-button {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.nav-button svg {
  width: 21px;
}

.nav-button.is-active {
  color: var(--accent);
}

.reader-view {
  --reader-font-size: 19px;
  color: var(--reader-ink);
  background: var(--reader-bg);
  color-scheme: light;
}

.reader-view[data-theme="dark"] {
  --reader-bg: oklch(0.13 0.007 110);
  --reader-ink: oklch(0.90 0.009 110);
  --reader-muted: oklch(0.68 0.012 110);
  --reader-rule: oklch(0.27 0.01 110);
  color-scheme: dark;
}

.reader-view .immersive-header {
  color: var(--reader-ink);
  border-bottom: 1px solid var(--reader-rule);
  background: var(--reader-bg);
}

.reader-version-button {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
  padding: 5px 8px;
  color: var(--reader-ink);
  background: transparent;
  text-align: center;
}

.reader-version-button strong,
.reader-version-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-version-button strong {
  font-size: 13px;
}

.reader-version-button span {
  color: var(--reader-muted);
  font-size: 10px;
}

.immersive-header > p {
  max-width: 60%;
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-icon:hover {
  background: var(--reader-rule);
}

.reader-content-action {
  display: inline-flex;
  min-width: 76px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  color: var(--reader-ink);
  border-radius: 6px;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.reader-content-action svg,
.content-request-attach svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.reader-content-action:hover:not(:disabled) {
  background: var(--reader-rule);
}

.annotation-mark {
  padding: .03em .05em;
  color: inherit;
  border-radius: 2px;
  background: oklch(0.82 0.12 90 / .42);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  cursor: pointer;
}

.annotation-mark-modified {
  background: oklch(0.76 0.06 150 / .28);
}

.annotation-mark-persistent {
  box-shadow: inset 0 -2px 0 oklch(0.48 0.09 150 / .72);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: oklch(0.42 0.06 150 / .82);
  text-underline-offset: .16em;
}

.annotation-mark.annotation-deletion-point {
  display: inline-block;
  width: 0;
  height: .9em;
  margin: 0;
  padding: 0;
  border-inline-start: 2px solid oklch(0.52 0.02 255);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  vertical-align: -.08em;
}

.annotation-mark.annotation-deletion-point-active {
  border-inline-start-color: oklch(0.38 0.02 255);
  border-inline-start-width: 3px;
}

.reader-view[data-theme="dark"] .annotation-mark {
  background: oklch(0.58 0.13 85 / .40);
}

.reader-view[data-theme="dark"] .annotation-mark-modified {
  background: oklch(0.48 0.08 150 / .38);
}

.reader-view[data-theme="dark"] .annotation-mark-persistent {
  box-shadow: inset 0 -2px 0 oklch(0.76 0.08 150 / .72);
  text-decoration-color: oklch(0.82 0.06 150 / .86);
}

.reader-view[data-theme="dark"] .annotation-mark.annotation-deletion-point {
  background: transparent;
  border-inline-start-color: oklch(0.72 0.015 255);
  box-shadow: none;
}

.reader-view[data-theme="dark"] .annotation-mark.annotation-deletion-point-active {
  border-inline-start-color: oklch(0.88 0.01 255);
}

.annotation-mark-system {
  padding: 0;
  background: transparent;
  box-shadow: none;
  text-decoration: none;
}

.annotation-mark-system::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 .2em 0 .1em;
  border-radius: 50%;
  background: var(--reader-muted);
  vertical-align: super;
}

.annotation-mark-system:focus-visible {
  outline: 1px solid var(--reader-muted);
  outline-offset: 3px;
}

.system-annotation-detail-quote {
  margin: 12px 0;
  padding-left: 12px;
  border-left: 2px solid var(--reader-rule);
  white-space: pre-wrap;
}

.reader-view[data-theme="dark"] .annotation-mark-system {
  background: transparent;
  box-shadow: none;
  text-decoration: none;
}

.annotation-mark.annotation-change-current {
  background: oklch(0.84 0.12 145 / .72);
  box-shadow: inset 0 -2px 0 oklch(0.42 0.11 145);
  text-decoration: underline;
  text-decoration-color: oklch(0.42 0.11 145);
  text-decoration-thickness: 1px;
  text-underline-offset: .14em;
}

.reader-view[data-theme="dark"] .annotation-mark.annotation-change-current {
  background: oklch(0.55 0.10 145 / .72);
  box-shadow: inset 0 -2px 0 oklch(0.78 0.09 145);
  text-decoration-color: oklch(0.82 0.08 145);
}

.update-tour-comparison-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 0 12px;
  border-radius: 6px;
}

.annotation-comparison-panel {
  position: fixed;
  z-index: var(--z-dialog);
  bottom: calc(68px + env(safe-area-inset-bottom));
  left: 50%;
  width: min(calc(100% - 24px), 456px);
  max-height: min(66dvh, 560px);
  padding: 0 18px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(-50%);
  color: var(--reader-ink);
  border: 1px solid var(--reader-rule);
  border-radius: 8px;
  background: var(--reader-bg);
  box-shadow: 0 18px 48px oklch(0.04 0.01 110 / .32);
  scrollbar-gutter: stable;
}

.annotation-comparison-header {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--reader-rule);
  background: var(--reader-bg);
}

.annotation-comparison-header p,
.annotation-comparison-header h2 {
  margin: 0;
}

.annotation-comparison-header p {
  color: var(--reader-muted);
  font-size: 10px;
  font-weight: 700;
}

.annotation-comparison-header h2 {
  margin-top: 2px;
  font-size: 17px;
}

.annotation-comparison-header .icon-button {
  flex: 0 0 auto;
  color: var(--reader-ink);
}

.annotation-comparison-body {
  display: grid;
  gap: 18px;
  padding-top: 16px;
}

.annotation-comparison-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  background: var(--reader-bg);
}

.annotation-comparison-section h3 {
  margin: 0 0 7px;
  color: var(--reader-muted);
  font-size: 11px;
}

.annotation-comparison-text {
  display: block;
  margin: 0;
  padding: 12px 0 12px 14px;
  font-family: var(--font-reading);
  font-size: calc(var(--reader-font-size) * .88);
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.annotation-comparison-before {
  color: var(--reader-muted);
  border-inline-start: 3px solid oklch(0.54 0.015 255);
  background: oklch(0.88 0.008 255 / .62);
  text-decoration-color: currentColor;
  text-decoration-thickness: 1.5px;
}

.annotation-comparison-after {
  color: var(--reader-ink);
  border-inline-start: 3px solid oklch(0.50 0.11 145);
  background: oklch(0.88 0.06 145 / .44);
  text-decoration: none;
}

.reader-view[data-theme="dark"] .annotation-comparison-panel,
.reader-view[data-theme="dark"] .annotation-comparison-header {
  background: oklch(0.18 0.008 110);
}

.reader-view[data-theme="dark"] .annotation-comparison-before {
  border-inline-start-color: oklch(0.62 0.015 255);
  background: oklch(0.30 0.012 255 / .72);
}

.reader-view[data-theme="dark"] .annotation-comparison-after {
  border-inline-start-color: oklch(0.70 0.09 145);
  background: oklch(0.32 0.06 145 / .58);
}

@media (max-height: 620px) {
  .annotation-comparison-panel {
    max-height: calc(100dvh - 148px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}

.annotation-selection-action {
  position: fixed;
  z-index: var(--z-dialog);
  min-width: 76px;
  min-height: 36px;
  padding: 6px 12px;
  color: var(--ink);
  border: 1px solid var(--reader-rule);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 24px oklch(0 0 0 / .18);
  font-size: 13px;
}

.annotation-selection-action--docked {
  top: auto;
  right: 12px;
  bottom: calc(4px + env(safe-area-inset-bottom));
  left: 12px;
  width: min(calc(100% - 24px), calc(var(--reader-max-width) - 24px));
  min-height: 48px;
  margin-inline: auto;
  padding: 10px 16px;
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  font-size: 16px;
  font-weight: 600;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.annotation-selection-notice {
  position: fixed;
  z-index: var(--z-dialog);
  right: 16px;
  bottom: max(84px, calc(64px + env(safe-area-inset-bottom)));
  left: 16px;
  width: fit-content;
  max-width: min(420px, calc(100vw - 32px));
  margin-inline: auto;
  padding: 10px 14px;
  color: var(--ink);
  border: 1px solid var(--reader-rule);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 8px 24px oklch(0 0 0 / .18);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.book-annotations-button {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.book-annotations-button span {
  min-width: 1.2em;
  color: var(--muted);
}

.annotation-toolbar {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
}

.annotation-list-dialog {
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  overflow: clip;
}

.annotation-list-dialog[open] {
  display: grid;
}

.annotation-new-content {
  width: fit-content;
  min-height: 40px;
}

.annotation-toolbar input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  color: var(--ink);
  border: 1px solid oklch(0.30 0.012 110);
  border-radius: 8px;
  background: var(--surface-raised);
}

.annotation-filters {
  display: flex;
  gap: 8px;
}

.annotation-filters button {
  min-height: 32px;
  padding: 5px 10px;
  color: var(--muted);
  border: 1px solid oklch(0.30 0.012 110);
  border-radius: 16px;
  background: transparent;
  font-size: 12px;
}

.annotation-filters button.is-selected {
  color: var(--ink);
  border-color: var(--accent);
  background: oklch(0.77 0.13 58 / .14);
}

.annotation-list-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.annotation-undo-button {
  margin-left: 6px;
  color: var(--accent);
}

.annotation-list {
  min-height: 0;
  max-height: calc(78dvh - 238px);
  overflow-y: auto;
}

.annotation-list-dialog > .annotation-list {
  max-height: none;
}

.annotation-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 16px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid oklch(0.30 0.012 110);
}

.annotation-thread + .annotation-thread,
.annotation-thread + .annotation-list-item-system {
  border-top: 1px solid oklch(0.30 0.012 110);
}

.annotation-thread > .annotation-list-item {
  border-top: 0;
}

.annotation-thread-history {
  margin: -4px 0 12px;
  padding: 0 0 12px;
}

.annotation-thread-history > summary {
  width: fit-content;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
}

.annotation-thread-rounds {
  margin-top: 10px;
  padding-left: 14px;
  border-left: 2px solid var(--rule);
}

.annotation-list-item-history {
  display: block;
  padding: 12px 0;
}

.annotation-list-item-history .annotation-list-quote {
  cursor: default;
}

.annotation-round-comparison {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.annotation-round-comparison .annotation-comparison-text {
  font-size: 13px;
  line-height: 1.6;
}

.annotation-continue-button {
  font-weight: 700;
}

.annotation-list-item-system {
  border-left: 3px solid oklch(0.55 0.09 225);
  padding-left: 12px;
}

.system-annotation-note {
  color: var(--ink);
}

.content-request-list-item {
  border-top: 1px solid oklch(0.30 0.012 110);
}

.content-request-list-open {
  display: grid;
  width: 100%;
  min-height: 76px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 12px;
  padding: 14px 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.content-request-list-open strong,
.content-request-list-open small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.content-request-list-open small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.content-request-status {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.content-request-status-failed,
.content-request-status-needs_guidance {
  color: var(--danger);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.content-request-dialog {
  height: min(760px, calc(100dvh - 12px));
  max-height: calc(100dvh - 12px);
}

.content-request-dialog[open] {
  display: grid;
  grid-template-rows: auto auto minmax(96px, 1fr) auto auto auto auto;
}

.content-request-header {
  min-width: 0;
  padding-bottom: 12px;
}

.content-request-header > div {
  min-width: 0;
}

.content-request-header h2,
.content-request-header p {
  overflow-wrap: anywhere;
}

.content-request-transcript {
  min-height: 0;
  padding: 4px 2px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.content-message {
  display: grid;
  width: fit-content;
  max-width: 88%;
  gap: 5px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid oklch(0.30 0.012 110);
  border-radius: 8px;
  background: var(--surface-raised);
}

.content-message-user {
  margin-left: auto;
  border-color: oklch(0.58 0.08 58 / .52);
  background: oklch(0.77 0.13 58 / .12);
}

.content-message strong,
.content-message small {
  color: var(--muted);
  font-size: 11px;
}

.content-message p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.content-message-attachment {
  color: var(--accent);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.content-request-empty {
  margin: 24px auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}

.content-request-understanding {
  margin: 0 0 10px;
  padding: 9px 0;
  border-top: 1px solid oklch(0.30 0.012 110);
  border-bottom: 1px solid oklch(0.30 0.012 110);
}

.content-request-understanding summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

#content-request-understanding-body {
  display: grid;
  gap: 7px;
  padding-top: 10px;
}

#content-request-understanding-body p {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

#content-request-understanding-body strong {
  color: var(--ink);
}

.content-request-error {
  margin: 0 0 8px;
}

.content-request-form {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid oklch(0.30 0.012 110);
}

.content-request-composer textarea {
  width: 100%;
  max-height: 136px;
  resize: vertical;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid oklch(0.34 0.015 110);
  border-radius: 8px;
  background: var(--surface-raised);
  font: 14px/1.55 var(--font-ui);
}

.content-request-actions,
.content-request-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.content-request-attach {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.content-request-attach input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.content-request-files {
  display: grid;
  gap: 6px;
}

.content-request-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  border: 1px solid oklch(0.30 0.012 110);
  border-radius: 6px;
  background: var(--surface-raised);
  font-size: 12px;
}

.content-request-file span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.content-request-file .icon-button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  flex-basis: 36px;
}

.content-request-footer-actions {
  min-height: 28px;
  padding-top: 6px;
}

.annotation-list-summary {
  min-width: 0;
}

.annotation-list-quote {
  width: 100%;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-family: var(--font-reading);
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
}

.annotation-list-meta,
.annotation-list-note{
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.annotation-list-note {
  color: var(--ink);
  font-size: 14px;
}

.annotation-guidance,
.annotation-agent-feedback {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
  padding: 10px 12px;
  color: oklch(0.25 0.03 58);
  border-left: 3px solid var(--accent);
  background: oklch(0.84 0.08 82 / .22);
  font-size: 12px;
  line-height: 1.55;
}

.annotation-agent-feedback {
  margin-bottom: 14px;
}

.annotation-list-actions {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

.annotation-jump-button {
  align-self: center;
  min-height: 36px;
  padding: 7px 10px;
  color: var(--accent);
  border: 1px solid oklch(0.62 0.10 58 / .72);
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.annotation-jump-button:hover,
.annotation-jump-button:focus-visible {
  border-color: var(--accent);
  background: oklch(0.77 0.13 58 / .12);
}

.danger-button {
  color: var(--danger);
}

.annotation-quote {
  max-height: 128px;
  margin: 0 0 18px;
  padding: 12px 14px;
  overflow-y: auto;
  color: var(--reader-ink);
  border-left: 3px solid var(--accent);
  background: var(--reader-rule);
  font-family: var(--font-reading);
  font-size: 15px;
  line-height: 1.65;
}

.annotation-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.annotation-field textarea {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid oklch(0.30 0.012 110);
  border-radius: 8px;
  background: var(--surface-raised);
  line-height: 1.55;
}

.annotation-compose-actions {
  position: sticky;
  z-index: 1;
  bottom: -24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin: 20px -20px -24px;
  padding: 14px 20px max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--reader-rule);
  background: var(--surface);
}

.reader-scroll {
  --reader-track-end: 0px;
  position: relative;
  height: calc(100dvh - 122px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y pinch-zoom;
}

.reader-scroll::after {
  position: absolute;
  top: 0;
  left: var(--reader-track-end);
  width: 1px;
  height: 1px;
  pointer-events: none;
  content: "";
}

.reader-content {
  width: 100%;
  overflow-wrap: anywhere;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 36px 24px 42px;
  column-width: calc(min(100vw, var(--reader-max-width)) - 48px);
  column-gap: 48px;
  column-fill: auto;
  font-family: var(--font-reading);
}

.chapter-title-block {
  break-inside: avoid-column;
}

.book-introduction {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  break-after: column;
  break-inside: avoid-column;
}

.reader-content .book-introduction h1 {
  margin: 0 0 28px;
  font-size: calc(var(--reader-font-size) * 1.68);
  line-height: 1.36;
}

.reader-content .book-introduction p {
  max-width: 30em;
  margin: 0;
  line-height: 1.9;
  text-align: justify;
}

.reader-content .book-introduction p:first-of-type::first-letter {
  float: none;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.author-frontispiece {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  break-after: column;
  break-inside: avoid-column;
  text-align: center;
}

.author-portrait {
  width: 142px;
  height: 178px;
  margin-bottom: 18px;
  border: 1px solid var(--reader-rule);
  border-radius: 3px;
  object-fit: cover;
  object-position: center 35%;
  filter: saturate(.88) contrast(1.02);
}

.reader-content .author-label {
  display: block;
  margin-bottom: 8px;
  color: var(--reader-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 650;
}

.reader-content .author-frontispiece h1 {
  margin: 0 0 16px;
  font-size: calc(var(--reader-font-size) * 1.5);
}

.reader-content .author-bio {
  max-width: 29em;
  margin: 0 auto;
  font-size: calc(var(--reader-font-size) * .88);
  line-height: 1.72;
  text-align: left;
}

.reader-content .author-frontispiece .author-bio::first-letter {
  float: none;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

@media (max-height: 650px) {
  .reader-content {
    padding-top: 24px;
    padding-bottom: 28px;
  }

  .author-portrait {
    width: 104px;
    height: 130px;
    margin-bottom: 12px;
  }

  .reader-content .author-frontispiece h1 {
    margin-bottom: 10px;
  }

  .reader-content .author-bio {
    font-size: calc(var(--reader-font-size) * .78);
    line-height: 1.55;
  }

}

.reader-content .chapter-number {
  display: block;
  margin-bottom: 14px;
  color: var(--reader-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 650;
}

.reader-sources {
  break-inside: avoid;
  margin: 2px 0 16px;
  color: var(--reader-muted);
  font-size: max(12px, calc(var(--reader-font-size) * 0.72));
  line-height: 1.55;
}

.reader-sources summary {
  width: fit-content;
  cursor: pointer;
  color: var(--primary-strong);
  font-weight: 700;
  list-style-position: outside;
}

.reader-sources ol {
  margin: 8px 0 0;
  padding-left: 1.6em;
}

.reader-sources li + li {
  margin-top: 6px;
}

.reader-sources a {
  color: inherit;
  text-underline-offset: 2px;
}

.reader-content h1 {
  margin: 0 0 44px;
  font-size: calc(var(--reader-font-size) * 1.68);
  font-weight: 700;
  line-height: 1.36;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.reader-content h2 {
  margin: 46px 0 18px;
  font-size: calc(var(--reader-font-size) * 1.18);
  line-height: 1.55;
  break-after: avoid-column;
}

.reader-content p {
  max-width: 34em;
  margin: 0 auto 1.15em;
  font-size: var(--reader-font-size);
  line-height: 1.85;
  text-align: justify;
  text-wrap: pretty;
  orphans: 2;
  widows: 2;
}

/* Long source URLs must not stretch a short Chinese label across the line. */
.reader-content p[data-block-id="blk-2d26d9ee-4ef1-4336-aa5f-5244f7b3d69f"] {
  text-align: left;
}

.reader-content p:first-of-type::first-letter {
  float: left;
  margin: .08em .12em 0 0;
  font-size: 3.1em;
  font-weight: 700;
  line-height: .9;
}

.reader-comparison-scroll {
  width: 100%;
  max-width: 100%;
  max-height: max(80px, min(65dvh, 580px, calc(100dvh - 122px - 80px - 2.4em)));
  margin: 1.2em auto;
  overflow: auto;
  overscroll-behavior: contain;
  break-inside: avoid-column;
  border: 1px solid var(--reader-rule);
  border-radius: 4px;
}

.reader-comparison-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: max(12px, calc(var(--reader-font-size) * .7));
  line-height: 1.5;
  text-align: left;
}

.reader-comparison-table th,
.reader-comparison-table td {
  padding: .55em .65em;
  border: 1px solid var(--reader-rule);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.reader-comparison-table thead th {
  position: sticky;
  top: 0;
  background: var(--reader-bg);
  z-index: 1;
}

.reader-comparison-table th:first-child { width: 20%; }

.reader-comparison-table .reader-table-separator {
  display: inline-block;
  width: 0;
  height: 0;
  overflow: hidden;
  white-space: nowrap;
}

.reader-figure {
  width: 80%;
  max-width: 34em;
  margin: 1em auto 1.2em;
  break-inside: avoid-column;
}

.reader-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--reader-rule);
  border-radius: 3px;
}

.reader-video video {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(78vh, calc(var(--reader-height, 78vh) - 4em));
  object-fit: contain;
  background: #111;
  border-radius: 3px;
}

.reader-video-status {
  margin: 8px 0 0;
  color: var(--reader-muted);
  font-family: var(--font-ui);
  font-size: calc(var(--reader-font-size) * .72);
  text-align: center;
}

.reader-figure figcaption {
  margin-top: 10px;
  color: var(--reader-muted);
  font-family: var(--font-ui);
  font-size: calc(var(--reader-font-size) * .72);
  line-height: 1.55;
  text-align: center;
}

.reader-footer {
  position: fixed;
  z-index: var(--z-sticky);
  right: auto;
  bottom: 0;
  left: 50%;
  width: min(100%, var(--reader-max-width));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 52px 1fr 104px;
  min-height: calc(56px + env(safe-area-inset-bottom));
  align-items: center;
  gap: 10px;
  padding: 0 16px env(safe-area-inset-bottom);
  color: var(--reader-ink);
  border-top: 1px solid var(--reader-rule);
  background: var(--reader-bg);
}

.reader-position {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.page-turn-controls {
  display: grid;
  grid-template-columns: repeat(2, 48px);
  gap: 4px;
}

.reader-page-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--reader-ink);
  border-radius: 50%;
  background: transparent;
  font-size: 25px;
  line-height: 1;
  transition: background-color 180ms var(--ease-out), opacity 180ms var(--ease-out);
}

.reader-page-button:hover:not(:disabled) {
  background: var(--reader-rule);
}

.reader-page-button:disabled {
  cursor: default;
  opacity: .28;
}

.reading-progress {
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--reader-rule);
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--primary);
  transition: width 180ms var(--ease-out);
}

#reading-progress-text {
  color: var(--reader-muted);
  font-size: 11px;
  text-align: left;
}

.reader-progress-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#reading-sync-status {
  min-width: 4.8em;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-align: right;
  visibility: hidden;
  white-space: nowrap;
}

#reading-sync-status.is-visible {
  visibility: visible;
}

.sheet-dialog {
  width: min(100%, 480px);
  max-height: 78dvh;
  margin: auto auto 0;
  padding: 12px 20px max(24px, env(safe-area-inset-bottom));
  color: var(--ink);
  border: 0;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  overflow: hidden;
}

.annotation-compose-dialog {
  max-height: calc(100dvh - 12px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

.sheet-dialog::backdrop {
  background: oklch(0.02 0 0 / .72);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 2px;
  background: oklch(0.42 0.012 110);
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 23px;
}

.dialog-close {
  font-size: 24px;
}

.toc-list {
  max-height: calc(78dvh - 106px);
  overflow-y: auto;
  border-top: 1px solid oklch(0.30 0.012 110);
}

.version-list,
.revision-runs-list {
  max-height: calc(78dvh - 150px);
  overflow-y: auto;
  border-top: 1px solid oklch(0.30 0.012 110);
}

.version-row {
  display: grid;
  width: 100%;
  min-height: 64px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid oklch(0.30 0.012 110);
  background: transparent;
  text-align: left;
}

.version-row > span,
.version-row-open {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.version-row-open {
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.version-row strong,
.version-row small {
  overflow-wrap: anywhere;
}

.version-row small {
  color: var(--muted);
}

.version-row.is-current strong {
  color: var(--accent);
}

.version-detail-button {
  min-width: 48px;
  min-height: 36px;
  padding: 6px;
  color: var(--accent);
  background: transparent;
}

.version-load-all {
  margin-top: 16px;
}

.version-detail-dialog {
  max-height: calc(100dvh - 12px);
  overflow-y: auto;
}

.version-change-list {
  max-height: 58dvh;
  margin: 0 0 16px;
  padding: 14px 0;
  overflow: auto;
  color: var(--ink);
  border-top: 1px solid oklch(0.30 0.012 110);
  border-bottom: 1px solid oklch(0.30 0.012 110);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.revision-run-row {
  display: grid;
  gap: 5px;
  padding: 14px 0;
  border-bottom: 1px solid oklch(0.30 0.012 110);
}

.revision-run-row small,
.revision-run-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.toc-button {
  display: flex;
  width: 100%;
  min-height: 68px;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  color: var(--ink);
  border-bottom: 1px solid oklch(0.30 0.012 110);
  background: transparent;
  text-align: left;
}

.toc-button.is-current {
  color: var(--accent);
}

.toc-number {
  width: 62px;
  flex: 0 0 62px;
  color: var(--muted);
  font-size: 12px;
}

.toc-button strong {
  font-size: 14px;
  line-height: 1.5;
}

.compact-sheet {
  max-height: none;
}

.secondary-unlock-copy {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.secondary-unlock-form {
  display: flex;
  flex-direction: column;
}

.secondary-unlock-form label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.secondary-unlock-form input {
  width: 100%;
  min-height: 52px;
  margin: 0 0 18px;
  padding: 0 66px 0 14px;
  color: var(--ink);
  border: 1px solid oklch(0.34 0.015 110);
  border-radius: 10px;
  background: var(--surface-raised);
  font-size: 16px;
}

.secondary-unlock-form input::placeholder {
  color: oklch(0.68 0.012 110);
}

.secondary-unlock-form .primary-button {
  width: 100%;
}

.setting-group,
.switch-row {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 12px 0;
  border: 0;
  border-top: 1px solid oklch(0.30 0.012 110);
}

.setting-group > span,
.setting-group legend,
.switch-row strong {
  font-size: 14px;
  font-weight: 650;
}

.segmented-control,
.theme-options {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-raised);
}

.segmented-control button,
.segmented-control output,
.theme-options button {
  display: grid;
  min-width: 44px;
  min-height: 40px;
  place-items: center;
  border-radius: 7px;
  background: transparent;
}

.theme-options button.is-selected {
  color: oklch(1 0 0);
  background: var(--primary-strong);
}

.switch-row span {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.switch-row small {
  color: var(--muted);
  font-size: 12px;
}

.switch-row input {
  width: 46px;
  height: 26px;
  accent-color: var(--primary);
}

.player-view {
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
  background: var(--bg);
}

.player-header {
  position: relative;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  margin: 20px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px oklch(0.50 0.105 110 / .16);
}

.video-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: oklch(0.06 0 0);
}

.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-stage audio {
  position: absolute;
  z-index: 2;
  right: 20px;
  bottom: 18px;
  left: 20px;
  width: calc(100% - 40px);
  min-height: 48px;
}

.video-stage.is-audio .video-placeholder {
  padding-bottom: 58px;
}

.video-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  align-content: center;
  gap: 24px;
  background:
    radial-gradient(circle at 50% 48%, oklch(0.35 0.055 110 / .55), transparent 26%),
    oklch(0.075 0 0);
}

.orbit-mark {
  position: relative;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
}

.orbit-mark::before {
  width: 88px;
}

.orbit-mark::after {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
  transform: translate(34px, -15px);
}

.video-placeholder p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.player-copy {
  padding: 30px 20px 16px;
}

.player-copy h1 {
  margin: 0 0 14px;
  font-size: 31px;
  font-weight: 620;
  line-height: 1.22;
  letter-spacing: -.03em;
  text-wrap: balance;
}

.player-copy > p:not(:first-child) {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.transcript-block {
  margin-top: 28px;
  padding: 18px 0 0;
  border-top: 1px solid oklch(0.28 0.012 110);
}

.transcript-heading {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.transcript-heading > span {
  margin-bottom: 0;
}

.lyric-follow-button {
  min-height: 40px;
  padding: 0 12px;
  color: var(--accent);
  border: 1px solid oklch(0.42 0.035 110);
  border-radius: 999px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.lyric-viewport {
  position: relative;
  height: min(42dvh, 360px);
  min-height: 260px;
  margin-top: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: oklch(0.42 0.02 110) transparent;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.synced-lyrics {
  padding-block: 34%;
}

.lyric-line {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  padding: 8px 14px 8px 18px;
  color: var(--muted);
  border-radius: 8px;
  background: transparent;
  font-family: var(--font-reading);
  font-size: 17px;
  line-height: 1.65;
  text-align: left;
  transition: color 180ms var(--ease-out), background-color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.lyric-line::before {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: 2px;
  width: 3px;
  border-radius: 2px;
  background: transparent;
  content: "";
}

.lyric-line.is-active {
  color: var(--ink);
  background: oklch(0.25 0.025 110 / .55);
  font-weight: 700;
  transform: translateX(3px);
}

.lyric-line.is-active::before {
  background: var(--accent);
}

.lyric-line:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.lyric-empty {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-reading);
  font-size: 17px;
  line-height: 1.85;
  white-space: pre-line;
}

.player-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 24px;
}

.player-actions > span {
  color: var(--muted);
  font-size: 12px;
}

@media (min-width: 768px) {
  .app-frame[data-active-view="reader"] {
    --reader-max-width: 640px;
    width: min(100%, var(--reader-max-width));
  }
}

@media (max-width: 479px) {
  .annotation-list-dialog {
    max-height: calc(100dvh - 24px - env(safe-area-inset-top));
  }

  .annotation-filters {
    gap: 6px;
  }

  .annotation-filters button {
    flex: 1 0 auto;
    padding-inline: 6px;
    white-space: nowrap;
  }

  .annotation-list-item {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
  }

  .annotation-jump-button {
    justify-self: start;
  }
}

@media (max-width: 359px) {
  .reader-view .immersive-header {
    padding-inline: 8px;
  }

  .reader-view .reader-icon,
  .reader-view .icon-button,
  .reader-content-action {
    width: 44px;
    min-width: 44px;
    height: 44px;
    flex-basis: 44px;
    padding: 5px;
  }

  .reader-content-action span {
    display: none;
  }

  .reader-version-button {
    padding-inline: 2px;
  }

  .content-request-dialog {
    padding-inline: 14px;
  }

  .content-message {
    max-width: 94%;
  }

  .content-request-actions {
    align-items: stretch;
  }

  .content-request-actions > * {
    min-width: 0;
  }

  .content-request-attach span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .login-copy h1,
  .welcome-block h2,
  .section-heading h2 {
    font-size: 32px;
  }

  .book-entry {
    grid-template-columns: 39% 1fr;
    gap: 16px;
  }

  .continue-action {
    max-width: 100%;
    align-self: flex-start;
    text-align: left;
  }
}

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

html[data-reduce-motion="true"] *,
html[data-reduce-motion="true"] *::before,
html[data-reduce-motion="true"] *::after {
  scroll-behavior: auto !important;
  transition-duration: .01ms !important;
  animation-duration: .01ms !important;
}

.reader-figure.manuscript-cover { width: min(70%, 18em); }
.reader-figure.manuscript-cover img { max-height: calc(var(--reader-height, 70vh) - 2em); object-fit: contain; border: 0; }

.book-updates-entry { margin: 12px 0 0 14px; font-weight: 650; text-decoration: underline; text-underline-offset: 5px; }
.book-updates-dialog { width: min(760px, calc(100vw - 32px)); max-width: none; height: min(820px, calc(100dvh - 48px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid #d8d4c9; border-radius: 12px; background: #faf8f2; color: #292e28; overflow: hidden; }
.book-updates-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.book-updates-dialog::backdrop { background: rgb(24 31 24 / 45%); }
.book-updates-header { padding: 24px 30px 20px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 1px solid #dedbd1; }
.book-updates-header p { margin: 0 0 5px; color: #63705e; font-size: 13px; }
.book-updates-header h2 { margin: 0; font-size: 28px; line-height: 1.3; }
.book-updates-header button { flex: 0 0 auto; min-width: 44px; min-height: 44px; border: 1px solid #d5d8ce; background: transparent; border-radius: 7px; color: inherit; font-size: 15px; }
.book-updates-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 30px 10px; }
.book-updates-intro { color: #657060; font-size: 14px; line-height: 1.7; margin: 20px 0 6px; }
.update-entry { padding: 24px 0; border-bottom: 1px solid #dddcd2; overflow-wrap: anywhere; }
.update-entry:last-child { border-bottom: 0; }
.update-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font: 13px/1.6 system-ui, sans-serif; color: #66725f; }
.update-current { font-weight: 650; color: #355339; background: #e8eee1; border-radius: 4px; padding: 2px 8px; }
.update-entry h3 { margin: 11px 0 10px; font-size: 21px; line-height: 1.5; font-weight: 650; }
.update-overview, .update-detail-overview { margin: 0 0 15px; font-size: 15px; line-height: 1.85; }
.update-details > summary { min-height: 44px; padding: 10px 0; color: #355339; font-size: 14px; font-weight: 650; cursor: pointer; }
.update-detail-body { padding: 15px 18px; border-left: 2px solid #bac8ad; background: #f0f1e9; }
.update-detail-count, .update-muted { font-size: 13px; color: #67715f; line-height: 1.7; }
.update-change { border-top: 1px solid #d8ddcf; font-size: 14px; }
.update-change > summary { padding: 14px 0; cursor: pointer; line-height: 1.65; }
.update-change p { white-space: pre-wrap; line-height: 1.9; margin: 6px 0 15px; }
.update-text-label { font-size: 12px; color: #65705f; }
.update-before { color: #737368; }
.update-after { color: #2c412e; }
.book-updates-footer { border-top: 1px solid #dedbd1; padding: 12px 30px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; }
.book-updates-footer p { margin: 0; font-size: 12px; line-height: 1.7; color: #64715f; }
.book-updates-footer button { min-height: 44px; }
.book-updates-dialog button:focus-visible, .book-updates-dialog summary:focus-visible { outline: 2px solid #547647; outline-offset: 3px; }
@media (max-width: 520px) {
  .book-updates-dialog { width: calc(100vw - 16px); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); border-radius: 9px; }
  .book-updates-header { padding: 20px 18px 16px; }
  .book-updates-header h2 { font-size: 24px; }
  .book-updates-scroll { padding: 0 18px 8px; }
  .update-entry { padding: 20px 0; }
  .update-entry h3 { font-size: 19px; }
  .update-detail-body { padding: 12px; }
  .book-updates-footer { padding: 9px 18px; }
}

.update-tour-header { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; }
.update-tour-header .update-tour-launch { padding: 10px 16px; min-height: 44px; width: auto; color: #36533b; background: #edf1e7; border: 1px solid #bfcdb4; border-radius: 6px; font: 600 14px/1.5 system-ui,sans-serif; white-space: nowrap; }
.update-tour-launch:disabled { opacity: .55; }
.update-tour-active .desk-reader-center { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.update-tour-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--reader-rule); background: var(--reader-bg); color: var(--reader-ink); font: 14px/1.5 system-ui,sans-serif; min-width: 0; }
.update-tour-bar[hidden] { display: none; }
.update-tour-copy { flex: 1; min-width: 0; }
.update-tour-copy strong { font-size: 14px; }
.update-tour-copy small { display: block; color: var(--reader-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; font-size: 12px; }
.update-tour-buttons { display: flex; gap: 7px; flex-shrink: 0; }
.update-tour-buttons button { min-height: 40px; padding: 7px 11px; border: 1px solid var(--reader-rule); border-radius: 5px; background: var(--reader-bg); color: var(--reader-ink); font: 600 13px/1.5 system-ui,sans-serif; }
.update-tour-buttons #update-tour-next { background: #35583a; color: #fff; border-color: #35583a; }
.update-tour-buttons button:disabled { opacity: .42; cursor: default; }
.update-tour-block { outline: 2px solid #9e7a25; outline-offset: 6px; border-radius: 2px; }
::highlight(book-update-tour) { background-color: #ffe38a; color: #241e10; }
.update-tour-deletion { display: inline-block; width: 3px; height: 1.25em; background: #a56424; vertical-align: text-bottom; }
.update-tour-deletion::before { content: "▾"; position: absolute; margin-top: -.8em; margin-left: -.3em; color: #a56424; }
@media(max-width:600px) {
  .update-tour-header { grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
  .update-tour-header > div { grid-column: 1; grid-row: 1; }
  .update-tour-header .update-tour-launch { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .update-tour-header > button:not(.update-tour-launch) { grid-column: 2; grid-row: 1; }
  .update-tour-bar { flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
  .update-tour-copy { flex-basis: 100%; }
  .update-tour-buttons { width: 100%; justify-content: flex-end; }
  .update-tour-buttons button { min-height: 40px; }
}


.update-tour-block { cursor: pointer; }
.update-tour-comparison { width: min(860px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 40px); margin: auto; padding: 0; border: 1px solid #d6d5c9; border-radius: 10px; background: #faf8f2; color: #292e28; overflow: hidden; }
.update-tour-comparison[open] { display: grid; grid-template-rows: auto minmax(0,1fr); }
.update-tour-comparison .sheet-header { padding: 20px 26px; margin: 0; border-bottom: 1px solid #d6d5c9; gap: 16px; }
.update-tour-comparison .sheet-header > div { min-width: 0; flex: 1; }
.update-tour-comparison-next { flex-shrink: 0; align-self: center; min-width: 116px; min-height: 44px; padding: 8px 15px; color: #fff; background: #35583a; border: 1px solid #35583a; border-radius: 6px; font: 650 14px/1.5 system-ui,sans-serif; cursor: pointer; }
.update-tour-comparison-next:disabled { opacity: .42; cursor: default; }
.update-tour-comparison-next:focus-visible { outline: 3px solid #9e7a25; outline-offset: 2px; }
.update-tour-comparison .sheet-header p { color: #64725d; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
.update-tour-comparison .sheet-header h2 { margin: 6px 0 0; font-size: 24px; }
.update-tour-comparison .dialog-close { flex-shrink: 0; color: #354631; min-width: 44px; min-height: 44px; }
.update-tour-comparison-body { overflow-y: auto; min-height: 0; overscroll-behavior: contain; padding: 22px 26px 28px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 26px; }
.update-tour-comparison-body section { min-width: 0; }
.update-tour-comparison-body h3 { margin: 0 0 12px; padding-bottom: 10px; border-bottom: 2px solid #b8c6aa; font-size: 16px; color: #36543a; }
.update-tour-comparison-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.9; font-size: 16px; margin: 0; }
.update-tour-comparison-notice { margin: 0; color: #63715e; font-size: 15px; line-height: 1.8; }
.update-tour-comparison-notice:not(:empty) { padding: 14px; border: 1px solid #d4dbca; background: #edf1e7; border-radius: 5px; }
@media(max-width:600px) {
 .update-tour-buttons { display: grid; grid-template-columns: 1.5fr 1fr 1fr .7fr; gap: 4px; }
 .update-tour-buttons button { padding: 6px; font-size: 12px; min-height: 44px; }
 .update-tour-comparison { width: calc(100vw - 16px); max-height: calc(100dvh - 24px); }
 .update-tour-comparison .sheet-header { padding: 16px 18px; gap: 8px; }
 .update-tour-comparison-next { min-width: 78px; padding: 7px 8px; font-size: 12px; }
 .update-tour-comparison-body { grid-template-columns: minmax(0,1fr); padding: 18px; gap: 26px; }
}

.update-diff-removed { background: #f7ceca; color: #662622; text-decoration: none; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.update-diff-added { background: #d3ebcc; color: #254b2a; text-decoration: none; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* Dynamic comic catalog: one compact selector for an expanding library. */
.comic-version-switcher { min-width: 0; max-width: 100%; }
.comic-version-switcher select { width: 100%; max-width: 38rem; min-width: 0; font: inherit; color: inherit; padding: .7rem; background: var(--paper, #faf8f1); border: 1px solid currentColor; border-radius: .3rem; }

/* Loading dialog occupies the top layer while retaining the page underneath. */
#page-loading {
  position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh;
  max-width: none; max-height: none; margin: 0; padding: 24px; border: 0; outline: none;
  background: rgba(20, 29, 25, .26); color: #214a40;
  z-index: 10000; align-items: center; justify-content: center;
  overscroll-behavior: contain; touch-action: none;
}
#page-loading[open] { display: flex; }
#page-loading:not([open]) { display: none; }
#page-loading::backdrop { background: transparent; }
#page-loading .page-loading-content {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  min-width: 156px; max-width: min(330px, 100%); padding: 27px 30px;
  border: 1px solid rgba(255,255,255,.5); border-radius: 14px;
  background: rgba(250,249,244,.96); box-shadow: 0 10px 40px rgba(0,0,0,.1);
  font: 16px/1.5 system-ui, sans-serif; text-align: center;
}
#page-loading [data-loading-spinner] {
  display: block; width: 30px; height: 30px; flex-shrink: 0;
  border: 3px solid rgba(33,74,64,.18); border-top-color: #214a40;
  border-radius: 50%; animation: room-loading-spin .85s linear infinite;
}
#page-loading [data-loading-spinner][hidden] { display: none; }
#page-loading [data-loading-label] { margin: 0; color: #214a40; }
#page-loading [data-loading-retry] {
  color: #214a40; font-size: 14px; padding: 6px 12px; text-underline-offset: 4px;
  position: absolute; visibility: hidden; animation: room-loading-retry 0s 20s forwards;
}
#page-loading.loading-slow [data-loading-retry] { position: static; visibility: visible; animation: none; }
@keyframes room-loading-spin { to { transform: rotate(360deg); } }
@keyframes room-loading-retry { to { position: static; visibility: visible; } }
@media (prefers-reduced-motion: reduce) {
  #page-loading [data-loading-spinner] { animation: none; }
}

/* Reading view: retain source metadata without displaying disclosures. */
.reader-sources { display: none !important; }

/* Completed edits are inspected from history/list, not painted during normal reading.
   Keep anchor DOM/text intact for selections, progress and explicit relocation. */
.reader-view .annotation-mark:is(.annotation-mark-modified, .annotation-mark-system):not(.annotation-change-current):not(.annotation-deletion-point-active) {
  background: transparent;
  box-shadow: none;
  text-decoration: none;
  padding: 0;
  border: 0;
  outline: 0;
  cursor: inherit;
  pointer-events: none;
}
.reader-view .annotation-mark-system::before {
  content: none;
  display: none;
}
.reader-view .annotation-mark.annotation-deletion-point:not(.annotation-deletion-point-active) {
  border-inline-start-width: 0;
  width: 0;
  padding: 0;
  margin: 0;
  pointer-events: none;
}
/* A pending annotation may be nested inside a quiet completed mark. */
.reader-view .annotation-mark-pending:not(.annotation-mark-system),
.reader-view .annotation-mark.annotation-change-current,
.reader-view .annotation-mark.annotation-deletion-point-active {
  pointer-events: auto;
}

.reader-figure:not(.reader-video) img { cursor: zoom-in; }

.reader-image-viewer {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(8 10 16 / 96%);
  color: #f1ece0;
  overflow: hidden;
}
.reader-image-viewer::backdrop { background: rgb(0 0 0 / 70%); }
.reader-image-viewer .riv-stage {
  position: absolute;
  inset: 52px 20px 64px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reader-image-viewer .riv-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  border-radius: 3px;
}
.reader-image-viewer[data-zoom="actual"] .riv-stage { display: block; }
.reader-image-viewer[data-zoom="actual"] .riv-stage img { max-width: none; max-height: none; cursor: zoom-out; }
.reader-image-viewer .riv-hint {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 120px;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 13px;
  color: rgb(241 236 224 / 62%);
}
.reader-image-viewer .riv-close {
  position: absolute;
  top: 10px;
  right: 16px;
  padding: 6px 14px;
  border: 1px solid rgb(241 236 224 / 40%);
  border-radius: 6px;
  background: transparent;
  color: #f1ece0;
  font-family: var(--font-ui);
  font-size: 14px;
  cursor: pointer;
}
.reader-image-viewer .riv-caption {
  position: absolute;
  left: 60px;
  right: 60px;
  bottom: 18px;
  margin: 0;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: rgb(241 236 224 / 82%);
}
