/* Revision — Reedsy-style continuous-prose center.
   Loads on top of draft-v2.css (shell is reused). */

.rv-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 80px 60px 160px;
  background: var(--surface);
  min-height: 100%;
}

.rv-masthead {
  text-align: center;
  margin-bottom: 64px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.rv-masthead-number {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 300;
  color: var(--ink-4);
  letter-spacing: 0.02em;
  margin-bottom: 28px;
  line-height: 1;
}

.rv-masthead-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  text-align: center;
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  padding: 0;
  margin: 0;
}

.rv-masthead-title::placeholder {
  color: var(--ink-5);
  font-weight: 300;
}

.rv-masthead-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-top: 14px;
}

.rv-prose {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 72ch;
  margin: 0 auto;
  outline: none;
  background: transparent;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.rv-prose:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-5);
  font-style: italic;
  pointer-events: none;
}

.rv-prose p {
  margin: 0 0 1.1em 0;
}

.rv-prose p:last-child {
  margin-bottom: 0;
}

.rv-end-marker {
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-4);
  margin-top: 64px;
  letter-spacing: 0.02em;
}

.rv-hint {
  max-width: 72ch;
  margin: 24px auto 0;
  padding: 12px 16px;
  background: rgba(108,93,168,0.06);
  border: 1px solid rgba(108,93,168,0.20);
  border-left: 3px solid var(--violet);
  border-radius: 0 6px 6px 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
}

.rv-hint[hidden] { display: none; }

.rv-topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rv-chapter-select {
  padding: 6px 10px;
  font-family: var(--sans);
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  max-width: 280px;
}

.rv-btn {
  padding: 6px 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.rv-btn.primary {
  background: var(--violet);
  color: #fff;
  border-color: var(--violet);
}

.rv-btn:hover { background: var(--paper-2); }
.rv-btn.primary:hover { filter: brightness(0.95); }

/* ── Phase 4: Drafted-only rail ──────────────────────────────── */

.rv-rail {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rv-rail-header {
  padding: 20px 16px 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
  flex-shrink: 0;
}

.rv-rail-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.rv-rail-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 16px;
  text-decoration: none;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.1s;
}

.rv-rail-item:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.rv-rail-item.active {
  background: rgba(108,93,168,0.08);
  color: var(--violet);
  font-weight: 500;
}

.rv-rail-item-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  flex-shrink: 0;
  min-width: 18px;
}

.rv-rail-item.active .rv-rail-item-num {
  color: var(--violet);
}

.rv-rail-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-rail-footer {
  padding: 10px 16px 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  flex-shrink: 0;
  border-top: 1px solid var(--line);
}

.rv-rail-empty {
  padding: 16px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-4);
  font-style: italic;
  line-height: 1.5;
}

/* B1: grouped manuscript rail (Front / Body / Back) -- house tokens only */
.rv-rail { overflow-y: auto; }

.rv-group { border-bottom: 1px solid var(--line-soft); }
.rv-group:last-of-type { border-bottom: none; }

.rv-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 16px 6px;
}
.rv-group-title {
  flex: 1;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.rv-group-expander {
  width: 18px; height: 18px;
  padding: 0;
  display: grid; place-items: center;
  border: none; background: transparent;
  color: var(--ink-4); cursor: pointer;
}
.rv-chevron {
  width: 0; height: 0;
  border-left: 4px solid currentColor;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transition: transform 0.12s;
}
.rv-group:not(.rv-group--collapsed) .rv-chevron { transform: rotate(90deg); }
.rv-group-edit {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.rv-group-list { padding: 2px 0 6px; }
.rv-group--collapsed .rv-group-list { display: none; }

/* Section items (front/back): a small mark in place of the chapter number */
.rv-rail-item--section { align-items: center; }
.rv-rail-item-mark {
  flex-shrink: 0;
  min-width: 18px;
  display: flex; align-items: center;
}
.rv-rail-item-mark::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink-4);
  opacity: 0.5;
}
.rv-rail-item--section.active .rv-rail-item-mark::before { background: var(--violet); opacity: 1; }

/* Off (not included) sections: hidden in normal mode, dimmed in edit mode */
.rv-group:not(.rv-group--editing) .rv-rail-item.is-off { display: none; }
.rv-group--editing .rv-rail-item.is-off { opacity: 0.5; }

/* COVER & MARKETING is a fixed pair (cover + description) with no Edit mode, so its items AND
   their include toggles are ALWAYS visible -- never hidden when not yet included -- keeping the
   group manageable in place. */
.rv-group[data-group="cover_marketing"] .rv-rail-item.is-off { display: flex; opacity: 1; }
.rv-group[data-group="cover_marketing"]:not(.rv-group--editing) .rv-sec-toggle { display: inline-block; }

/* Include toggle: only visible in the group's edit mode */
.rv-sec-toggle {
  margin-left: auto;
  flex-shrink: 0;
  width: 14px; height: 14px;
  accent-color: var(--violet);
  cursor: pointer;
}
.rv-group:not(.rv-group--editing) .rv-sec-toggle { display: none; }

/* B4: drag-reorder affordances -- grip + dragging row (house tokens). The grip (a 2x3 dot
   grid) and grab cursor appear only on movable items while the group is in Edit mode; pinned
   legal pages and chapters get neither. */
.rv-rail-grip {
  flex-shrink: 0;
  width: 8px;
  height: 12px;
  margin-right: 2px;
  color: var(--ink-4);
  background-image: radial-gradient(currentColor 1px, transparent 1.2px);
  background-size: 4px 4px;
  background-position: 0 1px;
  opacity: 0.55;
  display: none;
}
.rv-group--editing .rv-rail-item--movable .rv-rail-grip { display: block; }
.rv-group--editing .rv-rail-item--movable { cursor: grab; }
.rv-group--editing .rv-rail-item--movable:active { cursor: grabbing; }
.rv-rail-item--dragging {
  opacity: 0.55;
  background: var(--paper-2);
  outline: 1px dashed var(--violet);
  outline-offset: -1px;
}

/* B1 section stub center pane (real editors land in B2/B3) */
.rv-section-stub { padding: 48px 32px; text-align: center; }
.rv-stub-title {
  font-family: var(--serif);
  font-size: var(--text-2xl);
  color: var(--ink);
  margin: 8px 0 12px;
}
.rv-stub-note { color: var(--ink-4); font-size: var(--text-base); }

/* B2.7: the section editor IS the book page -- formatted on the chapter page shell.
   No card, no header block; the include toggle lives in the rail's edit mode. */
.rv-section-page { position: relative; }

/* prose surface: a borderless textarea that reads like the printed page body */
.rv-section-prose {
  display: block;
  width: 100%;
  max-width: 72ch;
  margin: 0 auto;
  min-height: 60vh;
  resize: none;
  border: none;
  outline: none;
  padding: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
}
.rv-section-prose::placeholder { color: var(--ink-5); font-style: italic; }

/* page heading for prose sections (foreword, preface, ...) */
.rv-section-page-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 28px;
  color: var(--ink);
  text-align: center;
  margin: 0 auto 40px;
  max-width: 72ch;
}

/* unobtrusive save status: editor-pane corner (outside the paper sheet), fades after ~2s */
.dm-editor[data-center="section"] { position: relative; }
.rv-section-savestate {
  position: absolute;
  top: 14px;
  right: 20px;
  z-index: 2;
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--ink-4);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.rv-section-savestate.rv-section-status--ok { color: var(--ok); }
.rv-section-savestate.rv-section-status--err { color: var(--bad); }

/* dedication: centered italic, in the upper-middle of the page */
.rv-section-page--dedication { display: flex; flex-direction: column; }
.rv-dedication-field {
  margin-top: 18vh;
  text-align: center;
  font-style: italic;
  font-size: 18px;
  max-width: 46ch;
}

/* epigraph: quote + attribution, right-aligned in the upper area */
.rv-section-page--epigraph .rv-epigraph-block {
  max-width: 56ch;
  margin: 8vh 0 0 auto;
}
.rv-epigraph-quote {
  text-align: right;
  font-style: italic;
  font-size: 18px;
  min-height: 8em;
}
.rv-epigraph-attr {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: none;
  outline: none;
  background: transparent;
  text-align: right;
  font-family: var(--serif);
  font-size: var(--text-md);
  color: var(--ink-3);
}
.rv-epigraph-attr::placeholder { color: var(--ink-5); font-style: italic; }

/* also_by: centered list */
.rv-section-page--list .rv-section-list {
  text-align: center;
  max-width: 46ch;
  min-height: 40vh;
}

/* render-only book pages (half title / title page / TOC) on the page shell */
.rv-bookpage-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: 0.01em;
  line-height: 1.25;
  text-align: center;
}
.rv-section-page--halftitle { display: flex; flex-direction: column; align-items: center; }
.rv-section-page--halftitle .rv-bookpage-title { margin-top: 24vh; }

.rv-section-page--titlepage {
  display: flex;
  flex-direction: column;
  text-align: center;
  min-height: 70vh;
}
.rv-section-page--titlepage .rv-tp-top { margin-top: 14vh; }
.rv-section-page--titlepage .rv-bookpage-title { font-size: 34px; }
.rv-tp-subtitle { font-size: var(--text-lg); font-style: italic; color: var(--ink-3); margin-top: 12px; }
.rv-tp-mid { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; }
.rv-tp-byline { font-size: var(--text-lg); color: var(--ink-2); }
.rv-tp-foot { flex: 0 0 auto; }
.rv-tp-publisher {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
}

/* contents */
.rv-section-page--toc .rv-toc-head {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  text-align: center;
  letter-spacing: 0.02em;
  margin: 0 auto 32px;
}
.rv-toc-list { list-style: none; margin: 0 auto; padding: 0; max-width: 60ch; }
.rv-toc-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0;
  font-family: var(--serif);
  font-size: var(--text-md);
  color: var(--ink-2);
}
.rv-toc-entry-title { flex: 0 1 auto; }
.rv-toc-leader { flex: 1 1 auto; border-bottom: 1px dotted var(--line-2); transform: translateY(-4px); }
.rv-preview-toc-empty {
  font-style: italic; color: var(--ink-4); font-size: var(--text-base);
  text-align: center; padding: 16px 0; max-width: 60ch; margin: 0 auto;
}

/* B3: Copyright editor (form) + live copyright page -- house tokens */
.rv-copyright-split {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 40px 96px;
}
.rv-copyright-form-pane { flex: 1 1 380px; min-width: 0; }
.rv-copyright-page-pane { flex: 1 1 380px; min-width: 0; }

.rv-cr-heading { font-family: var(--serif); font-weight: 600; font-size: var(--text-2xl); margin: 0 0 20px; }
.rv-cr-field { display: block; margin-bottom: 14px; }
.rv-cr-field > span {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 4px;
}
.rv-cr-field input[type="text"],
.rv-cr-field input[type="number"],
.rv-cr-field input[type="date"],
.rv-cr-field select,
.rv-cr-field textarea,
.rv-cr-inline input[type="text"],
.rv-cr-inline input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--rad-sm);
}
.rv-cr-field input:focus, .rv-cr-field textarea:focus, .rv-cr-inline input:focus {
  outline: none;
  border-color: var(--violet);
}
.rv-cr-inline { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.rv-cr-inline-toggle {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px;
  font-size: var(--text-sm); color: var(--ink-3); white-space: nowrap;
}
.rv-cr-inline-toggle input { accent-color: var(--violet); }

.rv-cr-group { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.rv-cr-group-head {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 10px;
}
.rv-cr-clause-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: var(--text-sm); color: var(--ink-2); margin-bottom: 8px;
}
.rv-cr-clause-row input { margin-top: 2px; accent-color: var(--violet); }

.rv-cr-collab-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.rv-cr-collab-row input {
  flex: 1 1 auto; padding: 7px 9px;
  font-family: var(--sans); font-size: var(--text-sm);
  border: 1px solid var(--line); border-radius: var(--rad-sm);
  background: var(--surface); color: var(--ink);
}
.rv-cr-collab-del {
  flex: 0 0 auto; width: 26px; height: 26px;
  border: 1px solid var(--line); border-radius: var(--rad-sm);
  background: transparent; color: var(--ink-4); font-size: 16px; cursor: pointer;
}
.rv-cr-collab-del:hover { color: var(--bad); border-color: var(--bad); }
.rv-cr-logo { max-width: 160px; display: block; margin-bottom: 8px; border: 1px solid var(--line-soft); border-radius: var(--rad-sm); }

/* the live copyright PAGE: a real book sheet (6x9 portrait proportions, Reedsy-style)
   with centered serif copyright typography, vertically centered on the page. Shares the
   .rv-page shell; these rules set the sheet + type. House tokens only. */
.rv-copyright-page {
  max-width: 400px;
  margin: 0 auto;
  /* book-sheet proportions as a MINIMUM (~6x9 of the 400px width): short content centers
     vertically; long content grows the sheet instead of overflowing its border. */
  min-height: 600px;
  height: auto;
  padding: 64px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  font-family: var(--serif);
  color: var(--ink-2);
  font-size: var(--text-xs);
  line-height: 1.75;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--rad-sm);
  box-shadow: var(--shadow-sm);
}
.rv-cr-line { margin-bottom: 16px; }
.rv-cr-notice { color: var(--ink); font-size: var(--text-sm); letter-spacing: 0.01em; }
.rv-cr-clause { margin: 0 auto 12px; max-width: 42ch; }
.rv-cr-meta { font-size: var(--text-xs); color: var(--ink-4); margin-bottom: 4px; }
.rv-cr-collab-block { margin-top: 14px; }
.rv-cr-page-logo { max-width: 110px; margin: 14px auto 0; display: block; }
.rv-cr-placeholder { color: var(--ink-4); font-style: italic; }

/* S2: Quill editor chrome on screen (book typography lives in the shared book.css). */
/* A4: Find & Replace bar -- floats at the top of the editor pane (which is position:relative). */
.rv-find-bar {
  position: absolute; top: 10px; right: 18px; z-index: 30;
  display: flex; align-items: center; gap: 6px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--rad-sm); padding: 6px 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}
.rv-find-input {
  font-family: var(--mono); font-size: var(--text-xs);
  padding: 4px 8px; width: 130px;
  border: 1px solid var(--line); border-radius: var(--rad-sm);
  background: var(--paper-2); color: var(--ink);
}
.rv-find-count { font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-3); min-width: 30px; text-align: center; }
.rv-find-btn {
  font-family: var(--mono); font-size: var(--text-xs);
  padding: 4px 8px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--rad-sm);
  background: var(--paper-2); color: var(--ink-2);
}
.rv-find-btn:hover { color: var(--ink); border-color: var(--violet); }
.rv-find-x { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 14px; padding: 0 4px; }
.rv-find-x:hover { color: var(--ink); }

/* Export popover (revision topbar, right): Format (EPUB / Print PDF) + a trim picker for PDF. */
.rv-export-wrap { margin-left: auto; position: relative; }
/* Desktop: keep the Export button clear of the fixed Clerk avatar (#clerk-user-btn, right:12px,
   ~32px wide). The mobile clearance is premise.css's max-width:899 padding-right; desktop had none,
   so the flush-right button collided with the avatar. min-width:900 is the complement of that mobile
   block, so it never stacks with the mobile padding. */
@media (min-width: 900px) {
  .rv-export-wrap { margin-right: 52px; }
}
.rv-export-btn {
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: 0.06em;
  color: var(--ink-2); background: var(--paper-2);
  border: 1px solid var(--line); border-radius: var(--rad-sm);
  padding: 6px 14px; cursor: pointer;
}
.rv-export-btn:hover:not(:disabled) { color: var(--ink); border-color: var(--violet); }
.rv-export-btn:disabled { opacity: 0.55; cursor: default; }

.rv-export-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  display: flex; flex-direction: column; gap: 10px;
  min-width: 200px; padding: 12px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--rad-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.rv-export-pop[hidden] { display: none; }
.rv-export-fmt { display: flex; flex-direction: column; gap: 6px; }
.rv-export-fmt label,
.rv-export-trim { font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-2); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.rv-export-trim { flex-direction: column; align-items: stretch; gap: 4px; }
.rv-export-trim[hidden] { display: none; }
.rv-export-trim select {
  font-family: var(--mono); font-size: var(--text-xs);
  padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--rad-sm);
  background: var(--paper-2); color: var(--ink);
}
.rv-export-go {
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: 0.06em;
  color: #fff; background: var(--violet); border: 1px solid var(--violet);
  border-radius: var(--rad-sm); padding: 7px 14px; cursor: pointer;
}
.rv-export-go:hover:not(:disabled) { filter: brightness(1.06); }
.rv-export-go:disabled { opacity: 0.6; cursor: default; }

/* Scene-break control: lives in the right AI-assist drawer (not on the book page). */
.rv-sb-action {
  width: 100%;
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: 0.06em;
  color: var(--ink-2); background: var(--paper-2);
  border: 1px solid var(--line); border-radius: var(--rad-sm);
  padding: 7px 10px; cursor: pointer;
}
.rv-sb-action:hover { color: var(--ink); border-color: var(--violet); }
.rv-prose-host { min-height: 50vh; }
.rv-prose-host .ql-container { border: none; font-size: inherit; font-family: inherit; }
.rv-prose-host .ql-editor { padding: 0; min-height: 40vh; }
.rv-prose-host .ql-editor.ql-blank::before {
  left: 0; right: 0; color: var(--ink-4); font-style: italic; content: attr(data-placeholder);
}

/* B4.1: Cover section -- front-cover preview (image only; no title/author overlay) */
.rv-cover-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  min-height: 480px;
}
.rv-cover-img {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  box-shadow: var(--shadow-sm);
  border-radius: var(--rad-sm);
}
.rv-cover-empty { color: var(--ink-4); font-style: italic; font-family: var(--serif); }

/* per-format cover readiness panel (Step 4): compact status list, violet-tinted like .rv-hint */
.rv-cover-readiness {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(108,93,168,0.18);
  border-radius: 6px;
  background: rgba(108,93,168,0.04);
  font-family: var(--sans);
  font-size: 12.5px;
}
.rv-cov-dims { font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.rv-cov-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; }
.rv-cov-fmt { flex: 0 0 70px; color: var(--ink); font-weight: 600; }
.rv-cov-badge { flex: 0 0 auto; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.rv-cov-ok { color: var(--ok); }
.rv-cov-info { color: var(--violet); }
.rv-cov-warn { color: var(--warn); }
.rv-cov-note { flex: 1 1 auto; color: var(--ink-2); }

@media (max-width: 1000px) {
  .rv-copyright-split { flex-direction: column; }
}

/* ── Phase 4: Empty state ────────────────────────────────────── */

.dm-stage.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
}

.rv-empty {
  text-align: center;
  max-width: 480px;
  padding: 40px 24px;
}

.rv-empty .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 20px;
}

.rv-empty h1 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 300;
  color: var(--ink);
  margin: 0 0 16px;
  line-height: 1.2;
}

.rv-empty .lede {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink-3);
  font-style: italic;
  line-height: 1.6;
  margin: 0 0 32px;
}

.rv-empty .pb-empty-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ── Phase 6: Right rail collapse mechanism — targets .dm-overview directly ── */

/* Ensure .dm-overview is a positioning context for the injected toggle button */
.dm-overview {
  position: relative;
}

.rv-rail-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink-4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  padding: 0;
  transition: color 0.1s, border-color 0.1s, background 0.1s, transform 0.18s ease;
}
.rv-rail-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-4);
}

/* Collapsed state — .dm-stage controls the grid columns; .dm-overview just hides its content */
.dm-stage.rv-rail-minimized {
  grid-template-columns: 360px 1fr 32px;
}

.dm-overview.rv-rail-collapsed {
  cursor: pointer;
  overflow: hidden;
}

.dm-overview.rv-rail-collapsed > *:not(.rv-rail-toggle) {
  display: none !important;
}

.dm-overview.rv-rail-collapsed .rv-rail-toggle {
  position: static;
  margin: 12px auto 0;
  display: flex;
  transform: rotate(180deg);
}

.dm-overview.rv-rail-collapsed:hover {
  background: var(--paper-2, #F5F2EA);
}

/* ── Inline prose-area loader — shown between page-spinner clearing and chapter prose arriving ── */

.rv-prose.rv-prose-loading {
  cursor: default;
  caret-color: transparent;
}

.rv-prose.rv-prose-loading::before {
  content: none !important;
}

.rv-prose-inline-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  user-select: none;
  pointer-events: none;
}

/* ── Loading state — mirrors .pa-loading from plot-architect.css ── */

.dm-stage.is-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  grid-template-columns: none;
}

/* <=768: inner reader layout (the outer shell is single-column via
   premise.css + draft-v2's <=1360 drawer block). Full-width prose, clamped
   masthead numeral/title, and the rail relics dropped: the minimized-rail
   grid (360px 1fr 32px) and the rail toggle paddle have no meaning when the
   overview is an off-canvas drawer. */
@media (max-width: 768px) {
  .rv-page { padding: 28px 16px 96px; }
  .rv-masthead { margin-bottom: 36px; }
  .rv-masthead-number { font-size: 24px; margin-bottom: 14px; }
  .rv-masthead-title { font-size: clamp(1.35rem, 6.5vw, 1.9rem); line-height: 1.2; overflow-wrap: anywhere; }
  .rv-prose { font-size: 16px; }
  .dm-stage.rv-rail-minimized { grid-template-columns: minmax(0, 1fr); }
  .rv-rail-toggle { display: none; }
  /* Find & Replace bar: reflow so inputs aren't pushed off-screen. Span the pane
     (no right-anchored content-width overflow) and wrap -- inputs full-width
     above the buttons: [find] / [replace] / [Next Replace All Book x]. */
  .rv-find-bar { left: 8px; right: 8px; flex-wrap: wrap; }
  .rv-find-input { flex: 1 1 100%; width: auto; }
  .rv-find-btn { flex: 1 1 auto; }
}
