/* The web reader — the Chromatics app's "Opening…" overlay and reader, in
   its three themes. Values are the native app's (apple/Chromatics:
   HomeView, ReaderView, ReaderChrome, ReaderMenu, ReaderSettingsSheet,
   PageTextBuilder, ReaderLayout, ReaderTheme), which themselves port
   css/styles.css. */

@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url('https://cdn.jsdelivr.net/npm/@fontsource/atkinson-hyperlegible@5/files/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: italic; font-weight: 400; font-display: swap; src: url('https://cdn.jsdelivr.net/npm/@fontsource/atkinson-hyperlegible@5/files/atkinson-hyperlegible-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url('https://cdn.jsdelivr.net/npm/@fontsource/atkinson-hyperlegible@5/files/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 400; font-display: swap; src: url('https://cdn.jsdelivr.net/npm/@fontsource/lexend@5/files/lexend-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 700; font-display: swap; src: url('https://cdn.jsdelivr.net/npm/@fontsource/lexend@5/files/lexend-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'OpenDyslexic'; font-style: normal; font-weight: 400; font-display: swap; src: url('https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic@5/files/opendyslexic-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'OpenDyslexic'; font-style: italic; font-weight: 400; font-display: swap; src: url('https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic@5/files/opendyslexic-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'OpenDyslexic'; font-style: normal; font-weight: 700; font-display: swap; src: url('https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic@5/files/opendyslexic-latin-700-normal.woff2') format('woff2'); }

.cx {
  /* Refined Dark — :root in css/styles.css */
  --bg: #121212;
  --surface: #1e1e1e;
  --elevated: #262626;
  --text: #d4cfc4;
  --muted: #928d86;
  --dim: #7a756e;
  --line: #2e2e2e;
  --accent: #d4a857;
  --accent-muted: #b89a6a;
  --teal: #6ab0a0;
  --place: var(--teal);
  --speaker-fallback: #8a8a80;
  --speaker-uncertain: #7a7a72;
  --doc-bg: #14141a;
  --doc-rule: rgba(180, 170, 160, 0.15);
  --stripe: rgba(255, 255, 255, 0.035);
  --stripe-more: rgba(255, 255, 255, 0.075);
  --pane-bg: rgba(32, 30, 25, 0.82);
  --pane-hairline: rgba(228, 216, 197, 0.09);
  --pane-shadow: 0 20px 44px -14px rgba(0, 0, 0, 0.55), 0 4px 14px rgba(0, 0, 0, 0.3);
  --wash: rgba(18, 18, 18, 0.7);
  --scrim: rgba(0, 0, 0, 0.45);
  --press: rgba(212, 207, 196, 0.08);
  --ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  --serif: Georgia, 'Times New Roman', serif;
  --book: Charter, 'Bitstream Charter', 'Iowan Old Style', Georgia, serif;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}
/* Rosé Pine Dawn — [data-theme="warm-paper"] */
.cx[data-theme="warm-paper"] {
  --bg: #faf4ed; --surface: #f2e9e1; --elevated: #ece1d6;
  --text: #575279; --muted: #6e6a86; --dim: #87829a; --line: #e6dccd;
  --accent: #286983; --accent-muted: #235c74; --teal: #316f7d;
  --speaker-fallback: hsl(318, 38%, 45%); --speaker-uncertain: hsl(318, 38%, 45%);
  --doc-bg: #f4ece2; --doc-rule: rgba(40, 105, 131, 0.16);
  --stripe: rgba(87, 82, 121, 0.04); --stripe-more: rgba(87, 82, 121, 0.08);
  --pane-bg: rgba(250, 244, 237, 0.88); --pane-hairline: rgba(87, 82, 121, 0.14);
  --pane-shadow: 0 20px 44px -14px rgba(68, 60, 90, 0.26), 0 4px 14px rgba(68, 60, 90, 0.12);
  --wash: rgba(250, 244, 237, 0.7); --scrim: rgba(68, 60, 90, 0.28); --press: rgba(87, 82, 121, 0.08);
  color-scheme: light;
}
/* One Light — [data-theme="soft-light"] */
.cx[data-theme="soft-light"] {
  --bg: #fafafa; --surface: #f0f0f1; --elevated: #e5e5e6;
  --text: #383a42; --muted: #696c77; --dim: #80838c; --line: #d6d6d8;
  --accent: #3b6fd4; --accent-muted: #3567c8; --teal: #04769f;
  --speaker-fallback: hsl(305, 62%, 41%); --speaker-uncertain: hsl(305, 62%, 41%);
  --doc-bg: #eef0f4; --doc-rule: rgba(53, 103, 200, 0.18);
  --stripe: rgba(56, 58, 66, 0.04); --stripe-more: rgba(56, 58, 66, 0.08);
  --pane-bg: rgba(250, 250, 250, 0.88); --pane-hairline: rgba(56, 58, 66, 0.12);
  --pane-shadow: 0 20px 44px -14px rgba(40, 42, 48, 0.2), 0 4px 14px rgba(40, 42, 48, 0.1);
  --wash: rgba(250, 250, 250, 0.7); --scrim: rgba(40, 42, 48, 0.3); --press: rgba(56, 58, 66, 0.08);
  color-scheme: light;
}
.cx[data-font="default"] { --book: Georgia, 'Times New Roman', serif; }
.cx[data-font="atkinson-hyperlegible"] { --book: 'Atkinson Hyperlegible', system-ui, sans-serif; }
.cx[data-font="lexend"] { --book: Lexend, system-ui, sans-serif; }
.cx[data-font="opendyslexic"] { --book: OpenDyslexic, sans-serif; }

.cx[hidden], .cx [hidden] { display: none !important; }
:where(.cx) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:where(.cx) button:disabled { cursor: default; }
.cx :focus-visible { outline: 2px solid var(--accent-muted); outline-offset: 2px; }
.cx .rd-page:focus-visible, .rd:focus-visible { outline: none; }

/* ---------- "Opening…" (HomeView) ---------- */
.op {
  z-index: 110; display: grid; place-items: center;
  background: rgba(10, 10, 12, 0.62);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: #d4cfc4;
}
.op-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  max-width: 260px; padding: 24px; text-align: center;
  animation: cx-rise 0.22s ease-out;
}
.op-card .op-cover { width: 92px; aspect-ratio: 2 / 3; border-radius: 6px; box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55); object-fit: cover; background: #1d1d24; }
.op-title { font-family: var(--serif); font-size: 15.2px; line-height: 1.3; }
.op-author { margin-top: -4px; font-family: var(--serif); font-size: 12.5px; font-style: italic; color: #a39e96; }
.op-label { font-family: var(--ui); font-size: 12.5px; letter-spacing: 0.75px; color: #a39e96; }
.op-label i { display: inline-block; animation: cx-dot 1.2s infinite ease-in-out; font-style: normal; }
.op-label i:nth-child(2) { animation-delay: 0.15s; }
.op-label i:nth-child(3) { animation-delay: 0.3s; }

/* ---------- reader ---------- */
.rd {
  --fs: 17px;
  --lh: 1.85;
  overflow: hidden;
  animation: cx-sheet 0.42s cubic-bezier(0.32, 0.72, 0, 1);
  touch-action: pan-y;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.rd.is-closing { animation: cx-sheet-out 0.32s cubic-bezier(0.32, 0.72, 0, 1) forwards; }
.rd-pages { position: absolute; inset: 0; }
.rd-spread { position: absolute; inset: 0; display: flex; }
.rd-spread.is-spread { padding: 0 40px; gap: 48px; }
.rd-page {
  position: relative; flex: 1; min-width: 0; height: 100%;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  user-select: text; -webkit-user-select: text;
}
.rd-page::-webkit-scrollbar { display: none; }
.rd-banner {
  position: sticky; top: 0; z-index: 1;
  height: 30px; padding-top: 10px;
  background: linear-gradient(to bottom, var(--bg) 0, var(--bg) 32px, transparent 46px);
  font-family: var(--ui); font-size: 12px; color: var(--muted);
  white-space: nowrap;
  transition: opacity 0.2s ease-in-out;
}
.rd-banner-row {
  display: flex; align-items: center; gap: 8px;
  max-width: var(--measure); margin: 0 auto; padding: 0 var(--side); box-sizing: border-box;
  transition: opacity 0.2s ease-in-out;
}
.rd-banner-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* .banner-bookmark-btn: an outline ribbon at the banner's end, filled with the
   bookmark's colour once set. The glyph is 12x16; the target is 44x44,
   handed back to the strip by negative margins (BannerBookmarkButton). */
.rd-bm {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: -10px -14px -14px 0;
  color: var(--dim); position: relative; z-index: 2;
}
.rd-bm svg { width: 12px; height: 16px; }
.rd.is-desk .rd-bm:hover { color: var(--text); }
/* On a phone the position line takes the banner's strip, so the banner steps
   aside; on a desktop the line has its own place and the banner stays. */
.rd:not(.is-desk).chrome-on .rd-banner-row { opacity: 0; pointer-events: none; }
.rd-text {
  max-width: var(--measure);
  margin: 16px auto 0;
  padding: 0 var(--side) 100px;
  font-family: var(--book); font-size: var(--fs); line-height: var(--lh);
}
/* A letter or diary page is tinted to the foot of the page, however short
   its text: in a book every page is the same length. (The page scrolls
   only if its text runs past the floor.) 56px = the banner's 30 + 10 and
   the text's 16 top margin, so the tint ends exactly at the page's foot. */
.rd-text.is-doc { background: var(--doc-bg); box-shadow: inset 2px 0 var(--doc-rule); padding-top: 12px; box-sizing: border-box; min-height: calc(100% - 56px); }
.rd-text p { margin: 0 0 0.8em; }
.rd-text h1, .rd-text h2, .rd-text h3 { font-family: var(--book); font-weight: 700; line-height: 1.3; margin: 0 0 0.6em; }
.rd-text .chapter-heading {
  margin: 0 0 1.2rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line);
  font-family: var(--ui); font-size: 16px; font-weight: 500; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted); line-height: 1.6;
}
.rd-text hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.rd-text blockquote { margin: 0 0 0.8em 1.2em; }
.rd-text img { max-width: 100%; height: auto; }
.rd-empty { flex: 1; }
.rd-progress {
  position: absolute; left: var(--pinset); right: var(--pinset); bottom: 5px; height: 3px;
  border-radius: 3px; background: var(--line); pointer-events: none;
}
.rd-progress span { display: block; height: 100%; border-radius: 3px; background: var(--dim); transition: width 0.3s ease-out; }
.rd-fade { position: absolute; left: 0; right: 0; bottom: 0; height: 27px; pointer-events: none; background: linear-gradient(to top, var(--bg) 13px, transparent); }

/* ---------- chrome: hidden until a centre tap (ReaderChrome) ---------- */
.rd-glass {
  background: var(--pane-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--pane-hairline);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.rd-top, .rd-capsule, .rd-arrow { transition: opacity 0.2s ease-in-out; }
.rd-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 4px 12px 0 12px;
  opacity: 0; pointer-events: none;
}
.rd-top > * { pointer-events: auto; }
.rd.chrome-on .rd-top { opacity: 1; }
.rd:not(.chrome-on) .rd-top > * { pointer-events: none; }
.rd-where {
  display: flex; align-items: center; min-width: 44px; max-width: calc(100% - 72px);
  height: 28px; margin-top: 6px; padding: 0 0 10px 8px; box-sizing: content-box;
  font-family: var(--ui); font-size: 12px; color: var(--muted); white-space: nowrap;
}
.rd-where-ch { overflow: hidden; text-overflow: ellipsis; }
.rd-where-n { flex: none; font-variant-numeric: tabular-nums; }
.rd-where svg { flex: none; width: 8px; height: 8px; margin-left: 5px; opacity: 0.75; }
.rd-where:active { opacity: 0.55; }
.rd-close { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: var(--text); }
.rd-close svg { width: 15px; height: 15px; }

.rd-capsule {
  position: absolute; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 3;
  display: flex; align-items: center; border-radius: 999px;
  background: linear-gradient(var(--wash), var(--wash)), var(--pane-bg);
  opacity: 0; pointer-events: none;
}
.rd.chrome-on .rd-capsule { opacity: 1; pointer-events: auto; }
.rd-audio { display: flex; align-items: center; gap: 4px; padding-left: 6px; }
.rd-audio button { display: grid; place-items: center; width: 44px; height: 44px; color: var(--muted); }
.rd-audio .rd-speed { width: auto; min-width: 48px; font-family: var(--ui); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rd-audio .rd-skip svg { width: 24px; height: 24px; }
.rd-audio .rd-play svg { width: 18px; height: 18px; }
.rd-seam { width: 1px; height: 20px; margin-left: 4px; background: var(--muted); opacity: 0.35; }
.rd-menu-btn { display: grid; place-items: center; min-height: 48px; padding: 0 17px; color: var(--text); }
.rd-menu-btn svg { width: 20px; height: 20px; }

/* ---------- the reading menu (ReaderMenu) ---------- */
.rd-pane {
  background: var(--pane-bg);
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--pane-hairline);
  box-shadow: var(--pane-shadow);
}
.rd-menu {
  position: absolute; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 4;
  width: 264px; padding: 8px 0; border-radius: 20px;
  animation: cx-rise 0.18s ease-out; transform-origin: bottom right;
}
.rd-menu-row {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 12px); margin: 0 6px;
  padding: 13px 12px; border-radius: 12px; text-align: left;
  font-family: var(--serif); font-size: 15px; color: var(--text);
}
.rd-menu-row:active, .rd-menu-row:hover { background: var(--press); }
.rd-menu-row > svg, .rd-menu-row > .rd-aa { flex: none; width: 22px; color: var(--muted); }
.rd-menu-row > svg { height: 15px; }
.rd-menu-row span { flex: 1; }
.rd-aa { font: 700 14px var(--ui); text-align: center; }
.rd-aa small { font-size: 11px; }
.rd-menu kbd { display: none; font: 11px var(--ui); color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.rd-menu hr { height: 1px; margin: 6px 16px; border: 0; background: var(--text); opacity: 0.12; }
/* Get the app: gilt, like the home page's button, the same in every theme. */
.rd-menu-row.rd-menu-get {
  justify-content: center; width: calc(100% - 28px); margin: 8px 14px 6px; padding: 12px;
  background: #d4a857; color: #1b1712; font-weight: 700;
  box-shadow: 0 1px 0 rgba(255, 240, 200, 0.35) inset, 0 8px 22px -12px rgba(212, 168, 87, 0.6);
}
.rd-menu-row.rd-menu-get span { flex: none; }
.rd-menu-row.rd-menu-get > svg { color: #1b1712; width: 16px; }
.rd-menu-row.rd-menu-get:hover { background: #dcb365; }
.rd-menu-row.rd-menu-get:active { background: #c99c4c; }
.rd-nudge { display: flex; gap: 8px; padding: 8px 14px; }
.rd-nudge button, .rd-chip {
  flex: 1; min-height: 38px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line);
  font: 13px var(--ui); color: var(--text);
}
.rd-nudge button:hover, .rd-chip:hover { background: var(--elevated); }

/* ---------- sheets: Contents, Themes & Settings ---------- */
.rd-scrim { position: absolute; inset: 0; z-index: 5; background: var(--scrim); animation: cx-fade 0.2s ease-out; }
.rd-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; flex-direction: column;
  max-height: min(85%, 720px); border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: cx-sheet 0.34s cubic-bezier(0.32, 0.72, 0, 1);
}
.rd-sheet--settings { height: min(85%, 720px); }
.rd-grab { flex: none; width: 36px; height: 5px; margin: 6px auto 0; border-radius: 3px; background: var(--muted); opacity: 0.4; }
.rd-sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 4px 20px; }
.rd-sheet-head h2 { margin: 0; font: 11px var(--serif); letter-spacing: 1.5px; text-transform: uppercase; color: var(--dim); font-weight: 400; }
.rd-sheet-x { display: grid; place-items: center; width: 44px; height: 44px; color: var(--muted); }
.rd-sheet-x svg { width: 13px; height: 13px; }
.rd-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 24px; }

.rd-toc-book { margin: 0 0 8px; font: 13px var(--serif); color: var(--muted); }
.rd-toc { list-style: none; margin: 0; padding: 0; }
.rd-toc-row {
  display: flex; align-items: baseline; gap: 12px; width: 100%;
  padding: 11px 10px; margin: 0 -10px; border-radius: 10px; text-align: left;
  font: 16px/1.35 var(--serif); color: var(--text);
}
.rd-toc-row span { flex: 1; }
.rd-toc-row small { flex: none; font: 12px var(--ui); color: var(--dim); font-variant-numeric: tabular-nums; }
.rd-toc-row.is-here { color: var(--accent); }
.rd-toc-row:hover, .rd-toc-mark button:hover { background: var(--press); }
.rd-toc-mark { display: flex; align-items: center; }
.rd-toc-mark button:first-child {
  flex: 1; display: flex; gap: 8px; align-items: flex-start; text-align: left;
  padding: 7px 8px; border-radius: 8px; font: 13px/1.4 var(--serif); color: var(--muted);
}
.rd-toc-mark button:first-child svg { flex: none; width: 12px; height: 16px; margin-top: 1px; }
.rd-toc-line { display: flex; align-items: center; }
.rd-toc-line .rd-toc-row { flex: 1; min-width: 0; }
.rd-toc-dots { flex: none; display: flex; align-items: center; gap: 15px; min-height: 46px; padding: 0 6px 0 12px; }
.rd-toc-dots svg { width: 12px; height: 16px; }
.rd-toc-mark { background: var(--press); border-radius: 8px; margin: 0 0 4px 12px; }
.rd-toc-unmark { display: grid; place-items: center; width: 36px; height: 36px; color: var(--dim); }
.rd-toc-unmark svg { width: 10px; height: 10px; }

.rd-sheet section { margin-top: 20px; }
.rd-sheet section:first-child { margin-top: 4px; }
.rd-sheet h3 { margin: 0 0 10px; font: 11px var(--serif); letter-spacing: 1.5px; text-transform: uppercase; color: var(--dim); font-weight: 400; }
.rd-size { display: flex; align-items: center; gap: 8px; }
.rd-size .rd-chip { min-height: 44px; font-size: 15px; }
.rd-size .rd-chip:disabled { opacity: 0.35; }
.rd-size output { min-width: 44px; text-align: center; font: 16px var(--ui); font-variant-numeric: tabular-nums; }
.rd-themes { display: flex; gap: 8px; }
.rd-theme { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border-radius: 12px; }
.rd-theme i {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font: 600 12px var(--serif); font-style: normal; box-shadow: 0 0 0 1px var(--line);
}
.rd-theme span { font: 11px var(--serif); color: var(--muted); text-align: center; }
.rd-theme.is-on i { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.rd-theme.is-on span { color: var(--text); }
.rd-fonts { display: flex; flex-direction: column; gap: 6px; }
.rd-font {
  display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left;
}
.rd-font span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rd-font b { font-weight: 400; color: var(--text); line-height: 1.2; }
.rd-font b[data-font="charter"] { font-family: Charter, 'Bitstream Charter', 'Iowan Old Style', Georgia, serif; }
.rd-font b[data-font="default"] { font-family: Georgia, serif; }
.rd-font b[data-font="atkinson-hyperlegible"] { font-family: 'Atkinson Hyperlegible', sans-serif; }
.rd-font b[data-font="lexend"] { font-family: Lexend, sans-serif; }
.rd-font b[data-font="opendyslexic"] { font-family: OpenDyslexic, sans-serif; }
.rd-font small { font: 12px var(--serif); color: var(--muted); }
.rd-font svg { flex: none; width: 14px; height: 14px; color: var(--accent); }
.rd-font.is-on { border-color: var(--accent); }
.rd-chips { display: flex; gap: 8px; }
.rd-chip.is-on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.rd-zebra { margin-bottom: 8px; }
.rd-zebra > span { display: block; margin-bottom: 8px; font: 15px var(--serif); }
.rd-switch {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  min-height: 44px; font: 15px var(--serif); text-align: left;
}
.rd-switch i {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px;
  border: 1.5px solid var(--muted); color: transparent;
}
.rd-switch i svg { width: 13px; height: 13px; }
.rd-switch[aria-checked="true"] i { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.rd-note { margin: 4px 0 0; font: italic 13px var(--serif); color: var(--muted); }
.rd-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font: 13px var(--serif); }
.rd-keys dt { font: 12px var(--ui); color: var(--muted); white-space: pre; }
.rd-keys dd { margin: 0; }

/* ---------- desktop & large screens: the page arrows, a quiet capsule ---------- */
.rd-arrow { display: none; }
.rd.is-desk .rd-arrow {
  position: absolute; top: 50%; z-index: 2; display: grid; place-items: center;
  width: 44px; height: 88px; margin-top: -44px; border-radius: 22px; color: var(--muted);
  opacity: 0;
}
.rd.is-desk .rd-arrow svg { width: 20px; height: 20px; }
.rd-arrow--prev { left: max(4px, calc(50% - var(--measure) / 2 - 76px)); }
.rd-arrow--next { right: max(4px, calc(50% - var(--measure) / 2 - 76px)); }
.rd.is-spread .rd-arrow--prev { left: 0; }
.rd.is-spread .rd-arrow--next { right: 0; }
.rd.is-desk.is-awake .rd-arrow:not(:disabled) { opacity: 0.6; }
.rd.is-desk .rd-arrow:not(:disabled):hover { opacity: 1; background: var(--press); color: var(--text); }
.rd.is-desk .rd-arrow:disabled { visibility: hidden; }
.rd.is-desk .rd-capsule { opacity: 0.4; pointer-events: auto; }
.rd.is-desk.is-awake .rd-capsule, .rd.is-desk .rd-capsule:hover, .rd.is-desk.chrome-on .rd-capsule { opacity: 1; }
.rd.is-desk.is-awake .rd-top { opacity: 1; }
.rd.is-desk.is-awake .rd-top > * { pointer-events: auto; }
.rd.is-desk .rd-menu kbd { display: inline-block; }
.rd.is-desk .rd-where:hover { color: var(--text); }
/* Desktop: the scene banner keeps the top of the page, and chapter · page
   moves to a quiet pill bottom-left, the capsule's mirror. */
.rd.is-desk .rd-top { position: static; }
.rd.is-desk .rd-close { position: absolute; top: 12px; right: 24px; z-index: 3; }
.rd.is-desk .rd-where {
  position: absolute; left: 24px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 3;
  height: 48px; margin: 0; padding: 0 16px; box-sizing: border-box; max-width: min(420px, calc(50% - 48px));
  border-radius: 999px; background: linear-gradient(var(--wash), var(--wash)), var(--pane-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--pane-hairline);
}
.rd.is-desk .rd-where svg { transform: rotate(180deg); }
.rd.is-desk .rd-close:hover, .rd.is-desk .rd-menu-btn:hover, .rd.is-desk .rd-audio button:hover { color: var(--text); }
.rd.is-desk .rd-pages { cursor: default; }
@media (min-width: 700px) {
  .rd-top { padding: 12px 24px 0; }
  .rd-capsule { right: 24px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .rd-menu { right: 26px; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  /* The popover the regular-width chrome presents, anchored to the capsule. */
  .rd-sheet {
    left: auto; right: 24px; bottom: 88px; width: 380px;
    max-height: calc(100% - 136px); border-radius: 20px; padding-bottom: 0;
    animation: cx-rise 0.2s ease-out; transform-origin: bottom right;
  }
  .rd-sheet--settings { height: auto; }
  .rd-grab { display: none; }
  .rd-scrim { background: transparent; }
}

/* ---------- the book's own markup (css/styles.css) ---------- */
.rd-text .speaker-fallback { color: var(--speaker-fallback); }
.rd-text .speaker-uncertain { color: var(--speaker-uncertain); font-style: italic; }
.rd-text .temporal { color: var(--teal); }
.rd-text [class^="place-"], .rd-text [class*=" place-"] { color: var(--place); }
.rd-text .speaker-tag { font-size: 13px; opacity: 0.6; margin-right: 4px; }
.rd-text .pronoun-hint { font-family: var(--ui); font-size: 11px; color: var(--muted); opacity: 0.7; margin-right: 2px; }
.rd[data-font="opendyslexic"] .rd-text .pronoun-hint { font-family: inherit; font-style: normal; }
.rd-text .gloss { font-size: 13px; line-height: 1.5; color: var(--dim); padding-top: 40px; }
.rd-text .gloss-entry { margin-bottom: 4px; }
.rd[data-dialogue="off"] .rd-text [class^="speaker-"], .rd[data-dialogue="off"] .rd-text [class*=" speaker-"],
.rd[data-dialogue="off"] .rd-text [class^="char-"], .rd[data-dialogue="off"] .rd-text [class*=" char-"] { color: inherit !important; }
.rd[data-temporal="off"] .rd-text .temporal { color: inherit !important; }
.rd[data-hints="off"] .rd-text .pronoun-hint { display: none; }
.rd-text .beeline {
  --line-height: 1.85em; --text-height: 1em;
  --stripe-inset: max(0px, calc((var(--line-height) - var(--text-height)) / 2 - 0.08em));
  --stripe-start: calc(var(--line-height) + var(--stripe-inset));
  --stripe-end: calc((var(--line-height) * 2) - var(--stripe-inset));
  --stripe-color: var(--stripe);
  position: relative;
}
.rd[data-zebra="pronounced"] .rd-text .beeline { --stripe-color: var(--stripe-more); }
.rd[data-zebra="off"] .rd-text .beeline::before { display: none; }
.rd-text .beeline::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent var(--stripe-start),
    var(--stripe-color) var(--stripe-start), var(--stripe-color) var(--stripe-end),
    transparent var(--stripe-end), transparent calc(var(--line-height) * 2));
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.6) 6%, black 15%, black 85%, rgba(0,0,0,0.6) 94%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
  -webkit-mask-composite: destination-in;
  mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.6) 6%, black 15%, black 85%, rgba(0,0,0,0.6) 94%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
  mask-composite: intersect;
}

@keyframes cx-fade { from { opacity: 0; } }
@keyframes cx-rise { from { opacity: 0; transform: scale(0.96); } }
@keyframes cx-sheet { from { transform: translateY(100%); } }
@keyframes cx-sheet-out { to { transform: translateY(100%); } }
@keyframes cx-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-3px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .op-card, .rd, .rd.is-closing, .rd-menu, .rd-sheet, .rd-scrim { animation: none; }
  .rd-progress span { transition: none; }
}

/* ---------- Get the app (the site's intent ladder, in the reader) ---------- */
a.rd-menu-row { text-decoration: none; box-sizing: border-box; }
.rd-app p { margin: 0 0 14px; font: 16px/1.5 var(--serif); }
.rd-app a { color: var(--accent); }
.rd-app-qr { display: flex; align-items: center; gap: 16px; margin: 4px 0 18px; }
.rd-app-qr img {
  flex: none; width: 148px; height: 148px; padding: 8px; box-sizing: border-box;
  border-radius: 14px; background: #f6f0e0;
}
.rd-app-qr p { margin: 0; font-size: 14px; color: var(--muted); }
.rd-send { margin: 0 0 16px; }
.rd-send label { display: block; margin-bottom: 8px; font: 14px var(--serif); color: var(--muted); }
.rd-send div { display: flex; gap: 8px; }
.rd-send input[type="email"] {
  flex: 1; min-width: 0; height: 44px; padding: 0 12px; box-sizing: border-box;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 15px var(--ui);
}
.rd-send button {
  flex: none; height: 44px; padding: 0 18px; border-radius: 8px;
  background: var(--accent-muted); color: var(--bg); font: 600 15px var(--ui);
}
.rd-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.rd-send-done { font-style: italic; color: var(--muted); }

.rd-app h3 { margin: 18px 0 8px; }
.rd-app-list { margin: 0 0 18px; padding: 0; list-style: none; font: 14px/1.45 var(--serif); }
.rd-app-list li { position: relative; padding: 3px 0 3px 16px; }
.rd-app-list li::before {
  content: ''; position: absolute; left: 0; top: 0.72em; width: 6px; height: 6px; border-radius: 50%;
  background: var(--dot, var(--muted));
}
/* The six bookmark hues, in turn: the list wears the book's colours. */
.rd-app-list li:nth-child(6n+1) { --dot: hsl(50,50%,72%); }
.rd-app-list li:nth-child(6n+2) { --dot: hsl(345,55%,75%); }
.rd-app-list li:nth-child(6n+3) { --dot: hsl(165,50%,74%); }
.rd-app-list li:nth-child(6n+4) { --dot: hsl(220,65%,80%); }
.rd-app-list li:nth-child(6n+5) { --dot: hsl(250,60%,80%); }
.rd-app-list li:nth-child(6n+6) { --dot: hsl(280,55%,78%); }
.cx[data-theme="warm-paper"] .rd-app-list li, .cx[data-theme="soft-light"] .rd-app-list li { --dot: var(--muted); }

/* ---------- read here, or in the app (the Opening card, once per book) ---------- */
.op { overflow-y: auto; }
.op-book { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.op--choice .op-card { max-width: 360px; gap: 22px; padding: 32px 24px; }
.op--choice .op-cover { width: clamp(132px, 24vh, 200px); border-radius: 8px; box-shadow: 0 22px 48px rgba(0, 0, 0, 0.6); }
.op--choice .op-title { font-size: 21px; margin-top: 6px; }
.op--choice .op-author { font-size: 15px; margin-top: -2px; }
.op-choice { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(320px, 84vw); }
.op-app {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%;
  min-height: 58px; padding: 0 24px; border-radius: 999px;
  background: #d4a857; color: #121212;
  font-family: var(--serif); font-size: 19px; white-space: nowrap;
  box-shadow: 0 10px 28px rgba(212, 168, 87, 0.25);
  transition: background 0.15s ease, transform 0.15s ease;
}
.op-app:hover { background: #e0b766; }
.op-app:active { transform: scale(0.98); }
.op-app img { width: 30px; height: 30px; border-radius: 22.5%; }
.op-note { margin: 2px 0 6px; font: italic 14px var(--serif); color: #a39e96; }
.op-here { padding: 10px 14px; font: 16px var(--serif); color: #cfc9bd; text-decoration: underline; text-decoration-color: rgba(236, 230, 217, 0.3); text-underline-offset: 4px; }
.op-here:hover { color: #ece6d9; text-decoration-color: currentColor; }
.op-here--solid {
  align-self: flex-start; margin-top: 6px; padding: 12px 22px; border-radius: 999px;
  border: 1px solid rgba(236, 230, 217, 0.4); text-decoration: none;
}
/* The install view: the book on the left, the ways to get the app on the right. */
.op--choice .op-card--install { max-width: 820px; width: calc(100vw - 48px); flex-direction: row; align-items: flex-start; gap: 40px; text-align: left; }
.op-card--install .op-book { flex: 0 0 220px; }
.op-install { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; color: #d4cfc4; }
.op-install .rd-app-qr { margin: 0 0 18px; }
.op-install .rd-app-qr p { font: 15px/1.5 var(--serif); color: #a39e96; }
.op-install .rd-send { margin-bottom: 10px; }
.op-install h3 { margin: 10px 0 8px; font: 11px var(--serif); letter-spacing: 1.5px; text-transform: uppercase; color: #7a756e; font-weight: 400; }
.op-install .rd-app-list { font: 14px/1.45 var(--serif); margin-bottom: 12px; columns: 2 13rem; column-gap: 1.5rem; }
.op-install .rd-app-list li { break-inside: avoid; }
.op-install .op-lede { margin: 0 0 8px; font: 17px/1.5 var(--serif); }
.op-install a { color: #d4a857; }
@media (max-width: 700px) {
  .op--choice .op-card--install { flex-direction: column; align-items: center; gap: 22px; width: auto; }
  .op-card--install .op-book { flex: none; }
  .op-card--install .op-cover { width: 110px; }
  .op-install .rd-app-list { columns: 1; }
}

/* The install view's heading: for screen readers (focus lands here when the
   view opens); visually the QR and its sentence already say it. */
.op-install-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
.op-install h3 { color: #a39e96; }                      /* 11px label: needs AA contrast on the dark blur */
.op-here { min-height: 44px; }
/* Over the palest spines (Madame Bovary's cream) the default 62% dim left
   the card's small grey text near 2:1. 86%, with no small text darker than
   #a39e96, keeps every line at AA: worst case 5.5:1, computed over each
   light spine colour. */
.op--choice { background: rgba(10, 10, 12, 0.86); }
.op--choice .rd-send label { color: #a39e96; }

/* ---------- the install view, set to be read ----------
   Two faces only: Adobe Caslon (the page's) for the heading, the list's
   label and the buttons; Georgia for everything else, the email field
   included. 16-17px throughout, no italics, no small capitals, and no text
   darker than #bdb6a9 on the dark: thin grey serif at 14px is what strained. */
.op-install .op-install-head {
  position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal;
  margin: 0 0 20px; font-family: var(--text, 'Libre Caslon Text', Georgia, serif); font-weight: 600;
  font-size: 28px; line-height: 1.15; color: #f1ece2;
}
.op-install .op-install-head:focus { outline: none; }
.op-install .rd-app-qr { gap: 20px; }
.op-install .rd-app-qr p { font: 17px/1.5 var(--serif); color: #d8d2c6; }
.op-install .rd-send label { font: 16px/1.4 var(--serif); color: #d8d2c6; margin-bottom: 10px; }
.op-install .rd-send input[type="email"] { font: 17px var(--serif); height: 48px; background: #1c1b19; border-color: rgba(236, 230, 217, 0.22); color: #f1ece2; }
.op-install .rd-send input[type="email"]::placeholder { color: #8f897f; }
.op-install .rd-send button { height: 48px; font-family: var(--text, 'Libre Caslon Text', Georgia, serif); font-weight: 600; font-size: 17px; }
.op-install h3 {
  margin: 22px 0 10px; font-family: var(--text, 'Libre Caslon Text', Georgia, serif); font-weight: 600;
  font-size: 18px; letter-spacing: 0; text-transform: none; color: #f1ece2;
}
.op-install .rd-app-list { font: 16px/1.5 var(--serif); color: #e3ddd1; columns: 2 15rem; column-gap: 2rem; }
.op-install .rd-app-list li { padding: 3px 0 3px 18px; }
.op-install .op-here--solid { margin-top: 18px; font-size: 17px; color: #f1ece2; border-color: rgba(236, 230, 217, 0.45); }
.op--choice .op-card--install .op-title { font-size: 22px; color: #f1ece2; }
.op--choice .op-card--install .op-author { font-style: normal; font-size: 16px; color: #bdb6a9; }
@media (max-width: 700px) {
  .op-install .op-install-head { font-size: 24px; text-align: center; }
  .op-install .rd-app-list { columns: 1; }
}

/* ---------- the home page's install card ----------
   "Start reading free" on a desktop (reader.js openInstall): a card of its
   own on the dark blur — kicker and close, the sentence, the QR code, the
   send-me-the-link form, four lines on what only the app has, and the way
   back to the pile. Set left, like the reader's own Get-the-app sheet. */
.op--home .op-card {
  max-width: 420px; width: calc(100vw - 48px); box-sizing: border-box;
  align-items: stretch; gap: 0; padding: 10px 14px 22px 26px; text-align: left;
  border-radius: 18px; background: #1c1b19;
  border: 1px solid rgba(236, 230, 217, 0.1);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.op-home-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.op-kicker { margin: 0; font: 11px var(--serif); letter-spacing: 1.5px; text-transform: uppercase; color: #a39e96; }
.op-x { display: grid; place-items: center; width: 44px; height: 44px; color: #a39e96; }
.op-x svg { width: 13px; height: 13px; }
.op-x:hover { color: #ece6d9; }
.op--home .op-install { padding-right: 12px; }
.op--home .op-install .op-lede { margin: 0 0 16px; font: 20px/1.35 var(--serif); color: #ece6d9; }
.op--home .op-install .rd-app-qr { margin-bottom: 16px; }
.op--home .op-install .rd-app-list { columns: 1; margin-bottom: 4px; }
.op--home .op-here { align-self: flex-start; margin: 6px 0 0 -14px; }
@media (max-width: 480px) {
  .op--home .op-card { padding-left: 20px; }
  .op--home .rd-app-qr img { width: 120px; height: 120px; }
}
