:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1b1b1b;
  --muted: #6b6b66;
  --line: #e2e0d9;
  --accent: #0b4d35;
  --accent-ink: #ffffff;
  --error: #a3271d;
  --warning: #9c5607;
  --info: #2c5f8a;
  --ok: #2d6a4f;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --ai: #6f5aa8; /* reserved: only ever means a model or AI, never a category */
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
button, a.button { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
a.button { display: inline-block; text-decoration: none; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--panel); color: var(--ink); width: 100%; }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 2px; }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; letter-spacing: 0.02em; }
.work { color: var(--muted); flex: 1; }
.chips { display: flex; gap: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); }
.chip.error { color: var(--error); border-color: var(--error); }
.chip.warning { color: var(--warning); border-color: var(--warning); }
.chip.ok { color: var(--ok); border-color: var(--ok); }
.shell { display: grid; grid-template-columns: 200px 1fr; min-height: calc(100vh - 49px); }
.nav { border-right: 1px solid var(--line); padding: 12px 0; background: var(--panel); }
.nav a { display: block; padding: 8px 16px; color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--bg); border-left: 3px solid var(--accent); padding-left: 13px; font-weight: 600; }
.main { padding: 20px 24px 60px; max-width: 1400px; min-width: 0; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 15px; margin: 18px 0 8px; }
h3 { font-size: 13px; margin: 12px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr.sel td { background: #eef3ef; }
.finding { display: grid; grid-template-columns: 76px 210px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.finding .sev { font-weight: 700; font-size: 11px; text-transform: uppercase; }
.finding.error .sev { color: var(--error); }
.finding.warning .sev { color: var(--warning); }
.finding.info .sev { color: var(--info); }
.finding .code { font-family: var(--mono); font-size: 12px; }
.finding .sugg { color: var(--muted); display: block; margin-top: 2px; }
.preview { background: #d9d7d0; padding: 12px; border-radius: 8px; display: flex; gap: 12px; justify-content: center; align-items: flex-start; overflow: auto; }
.preview svg { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.25); max-width: 100%; height: auto; }
.preview .page { text-align: center; }
.preview .page .cap { font-size: 11px; color: #444; margin-top: 4px; }
.spread { display: flex; gap: 0; }
.spread img { width: 48%; background: #fff; border: 1px solid #bbb; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { width: 120px; text-align: center; }
.thumb img { width: 100%; background: #fff; border: 1px solid var(--line); }
.thumb.sel img { outline: 3px solid var(--accent); }
.thumb .cap { font-size: 11px; }
.status { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); }
.status.approved { color: var(--ok); border-color: var(--ok); }
.status.review { color: var(--warning); border-color: var(--warning); }
.status.live { color: var(--ok); border-color: var(--ok); }
.status.pending, .status.broken { color: var(--error); border-color: var(--error); }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 420px; z-index: 10; }
.toast.err { background: var(--error); }
.unavailable { border: 1px dashed var(--warning); color: var(--warning); padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.leaf { display: inline-block; margin: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-size: 12px; min-width: 150px; }
.leaf .back { color: var(--muted); }
.leaf.blankback { border-color: var(--ok); }
.leaf.warn { border-color: var(--warning); }
.balloon-row { border-top: 1px solid var(--line); padding: 8px 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
progress { width: 100%; }

/* ---- library ---------------------------------------------------------------------------------------------------- */
.brand { color: var(--ink); text-decoration: none; }
.nav-group { margin: 14px 16px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
body.in-library .nav > a:not([data-view="library"]), body.in-library .nav > .nav-group { opacity: 0.55; }
/* draft comparison (B52) */
.cmp-better td:last-child { color: #1f6f4a; }
.cmp-worse td:last-child { color: #a3261a; }
/* passages behind contract questions and findings (B51) */
.passages { list-style: none; margin: 6px 0 2px; padding: 0; }
.passages li { margin: 6px 0; padding-left: 10px; border-left: 2px solid var(--line); font-size: 13px; }
.passages .pquote { color: var(--ink); margin-top: 2px; font-family: Georgia, serif; }
.passages mark { background: #fde7a8; padding: 0 1px; }
.pkind { font: 600 10px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; background: #eef0f4; color: #4a5160; }
.pkind.k-contradicts, .pkind.k-too-early { background: #fbe3dd; color: #8a2a12; }
.pkind.k-cited { background: #e6f2ea; color: #1f6f4a; }
.pkind.k-related { background: #f4f4f6; color: #667085; }
.ms .para.focus { background: #fff3cf; box-shadow: 0 0 0 4px #fff3cf; border-radius: 4px; }
/* a book's rail (B50) replaces the coloring-volume menu while the book is open */
body.with-rail .nav > a:not([data-view="library"]), body.with-rail .nav > .nav-group { display: none; }
.book-rail .rail-title { margin: 12px 16px 2px; font-weight: 700; font-size: 15px; line-height: 1.25; }
.book-rail .rail-link { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 16px; color: var(--ink); text-decoration: none; }
.book-rail .rail-link.active { background: var(--bg); border-left: 3px solid var(--accent); padding-left: 13px; font-weight: 600; }
.book-rail .rail-badge { font: 600 11px system-ui, sans-serif; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.book-rail .rail-badge.warn { background: #fde7c4; color: #8a5300; }
.book-rail .rail-badge.info { background: #eef0f4; color: #4a5160; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badges.filter { display: inline-flex; margin: 6px 0; }
.badge { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
button.badge { cursor: pointer; }
.badge.big { font-size: 13px; padding: 5px 12px; }
.badge.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.badge.kind { background: #ece9e1; font-weight: 600; }
.badge.g-literary { border-color: #6d597a; } .badge.g-romance, .badge.g-romantasy { border-color: #c2185b; } .badge.g-science-fiction { border-color: #1565c0; }
.badge.g-fantasy { border-color: #6a1b9a; } .badge.g-mystery, .badge.g-thriller { border-color: #37474f; } .badge.g-horror { border-color: #8e0000; }
.badge.g-historical { border-color: #8d6e63; } .badge.g-young-adult, .badge.g-middle-grade { border-color: #00897b; } .badge.g-technical { border-color: #455a64; }
.abar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #eee; margin: 4px 0; }
.abar.thin { height: 6px; }
.abar .seg { display: block; height: 100%; }
.alegend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; margin: 4px 0 8px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.seg.o-human, .sw.o-human { background: #1f6f4a; } .seg.o-human-over-ai, .sw.o-human-over-ai { background: #6aa84f; }
.seg.o-import-declared, .sw.o-import-declared { background: #3d6fb6; } .seg.o-import-ai-assisted, .sw.o-import-ai-assisted { background: #d29a2b; } .seg.o-import-undeclared, .sw.o-import-undeclared { background: #9aa5b1; }
.seg.o-ai, .sw.o-ai { background: #c0612b; } .seg.empty { background: #e6e3db; }
.steps { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.steps .on { color: var(--accent); font-weight: 700; } .steps .done { color: var(--ink); }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.type { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; }
.type.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
label.radio { display: block; color: var(--ink); font-size: 13px; margin: 6px 0; }
label.radio input, label.row input[type=checkbox] { width: auto; }
.decl { margin-top: 12px; background: #fbfaf6; }
/* a book has many tabs: the row scrolls on its own rather than widening the page */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 8px 0 16px; overflow-x: auto; scrollbar-width: thin; }
.tabs a { flex: none; white-space: nowrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.msgrid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.toc { position: sticky; top: 64px; max-height: calc(100vh - 90px); overflow: auto; font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 0; }
.toc a { display: block; padding: 4px 12px; text-decoration: none; color: var(--ink); }
.toc a.on { background: var(--bg); border-left: 3px solid var(--accent); padding-left: 9px; font-weight: 600; }
.toc-part { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 10px 12px 2px; }
.ms { background: #fffdf8; border: 1px solid var(--line); border-radius: 8px; padding: 28px 40px; font: 16px/1.65 Georgia, "Iowan Old Style", serif; max-width: 760px; }
.ms .para { margin: 0 0 0.9em; cursor: text; border-radius: 4px; padding: 2px 4px; margin-left: -4px; }
.ms .para:hover { background: #f4efe2; }
.ms .o-human { background: rgba(31,111,74,0.16); } .ms .o-human-over-ai { background: rgba(106,168,79,0.22); }
.ms .o-ai { background: rgba(192,97,43,0.2); } .ms .o-import-undeclared { background: rgba(154,165,177,0.22); }
.ms.plain span[class^="o-"] { background: none; }
.ms .scene-break { text-align: center; color: var(--muted); margin: 1.2em 0; letter-spacing: 0.4em; }
.ms .scene-title { font: 12px Inter, system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.edit-para { width: 100%; min-height: 140px; font: 16px/1.6 Georgia, serif; }
.ok-line { color: var(--ok); margin-bottom: 8px; }
iframe.report { width: 100%; height: calc(100vh - 260px); min-height: 600px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; }
@media (max-width: 900px) { .msgrid { grid-template-columns: 1fr; } .toc { position: static; max-height: 240px; } .ms { padding: 18px 16px; } }
.badges { align-items: center; }
.badge { white-space: nowrap; line-height: 18px; }
.ms .para.display { text-align: center; font-size: 13px; font-style: italic; color: #555; letter-spacing: 0.02em; }

/* ---- stories (the guided path) ------------------------------------------------------------------------------- */
.checklist { list-style: none; padding: 0; margin: 10px 0 0; }
.checklist .step { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; }
.checklist .step.ok .tick { background: var(--ok); border-color: var(--ok); }
img.mini { height: 64px; width: auto; border: 1px solid var(--line); background: #fff; border-radius: 4px; }
button.cand { padding: 2px; }
.story-new textarea { min-height: 70px; }

/* ---- My Books: books on a shelf ------------------------------------------------------------------------------ */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 34px 26px; margin: 18px 0 8px; padding: 6px 4px 0; }
.book { display: flex; flex-direction: column; gap: 14px; color: var(--ink); text-decoration: none; perspective: 900px; outline: none; }
.book .tome { position: relative; aspect-ratio: 2 / 3; transform-origin: left center; transform: rotateY(-4deg); transition: transform .35s cubic-bezier(.2,.7,.2,1), filter .35s; filter: drop-shadow(0 10px 10px rgba(30,20,10,.22)); }
.book:hover .tome, .book:focus-visible .tome { transform: translateY(-6px) rotateY(-16deg); filter: drop-shadow(0 18px 16px rgba(30,20,10,.28)); }
.book:focus-visible .face { outline: 3px solid var(--accent); outline-offset: 3px; }
/* the page block, seen past the fore-edge when the cover swings */
.tome .pages { position: absolute; inset: 4px -7px 4px 8px; border-radius: 2px 5px 5px 2px; background: repeating-linear-gradient(90deg, #fffdf6 0 2px, #e9e1cf 2px 3px); box-shadow: inset 0 0 0 1px #d8ccb0; }
.tome .face { position: absolute; inset: 0; border-radius: 3px 9px 9px 3px; overflow: hidden; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18% 12% 12% 18%;
  background:
    linear-gradient(90deg, rgba(0,0,0,.42) 0, rgba(0,0,0,.18) 5%, rgba(255,255,255,.10) 7.5%, rgba(0,0,0,.10) 9.5%, transparent 13%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.035) 0 2px, rgba(0,0,0,.035) 2px 4px),
    linear-gradient(160deg, var(--c1), var(--c2));
  color: #ecd9a8; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), inset -2px 0 3px rgba(0,0,0,.25); }
.tome .hinge { position: absolute; left: 9%; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,.35); box-shadow: 1px 0 0 rgba(255,255,255,.12); }
.tome .cover-kicker { font: 600 10px/1.2 Inter, system-ui, sans-serif; letter-spacing: .18em; text-transform: uppercase; opacity: .8; }
.tome .cover-title { margin-top: auto; font: 700 21px/1.12 Georgia, "Iowan Old Style", "Times New Roman", serif; letter-spacing: .01em; text-shadow: 0 1px 0 rgba(0,0,0,.35); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tome .cover-sub { margin-top: 6px; font: italic 12px/1.3 Georgia, serif; opacity: .85; }
.tome .cover-rule { width: 38%; height: 0; margin: 12px 0 10px; border-top: 1px solid currentColor; opacity: .55; }
.tome .cover-author { margin-bottom: auto; font: 500 11px/1.3 Inter, system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; opacity: .9; }
.tome .ribbon { position: absolute; top: 0; right: 16%; width: 10px; height: 22%; background: linear-gradient(#b8323a, #8c1f27); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
/* coloring volumes: a cream board cover with an ink doodle and the Pocket Tails orange spine */
.tome.coloring .face { color: #2a2118;
  background:
    linear-gradient(90deg, #c0612b 0, #a64f20 7%, rgba(0,0,0,.12) 7.5%, transparent 10%),
    url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%20fill%3D%22none%22%20stroke%3D%22%232a2118%22%20stroke-width%3D%224%22%20stroke-linecap%3D%22round%22%3E%3Cellipse%20cx%3D%2250%22%20cy%3D%2266%22%20rx%3D%2220%22%20ry%3D%2216%22%2F%3E%3Cellipse%20cx%3D%2224%22%20cy%3D%2242%22%20rx%3D%228%22%20ry%3D%2210%22%2F%3E%3Cellipse%20cx%3D%2241%22%20cy%3D%2228%22%20rx%3D%228%22%20ry%3D%2210%22%2F%3E%3Cellipse%20cx%3D%2259%22%20cy%3D%2228%22%20rx%3D%228%22%20ry%3D%2210%22%2F%3E%3Cellipse%20cx%3D%2276%22%20cy%3D%2242%22%20rx%3D%228%22%20ry%3D%2210%22%2F%3E%3C%2Fsvg%3E") no-repeat right 11% bottom 8% / 24% auto,
    linear-gradient(160deg, var(--c1), var(--c2)); }
.tome.coloring .cover-title { text-shadow: none; }
.tome.coloring .doodle { position: absolute; inset: 7% 7% 7% 14%; border: 1.5px dashed rgba(42,33,24,.35); border-radius: 6px; pointer-events: none; }
.tome.coloring .ribbon { background: linear-gradient(#2a7a52, #12432b); }
/* a blank book to start a new one */
.tome.blank { transform: none; filter: none; }
.tome.blank .face { background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(11,77,53,.06) 22px 23px), #fbfaf6; color: var(--accent); border: 2px dashed #b9c9bf; box-shadow: none; justify-content: center; padding: 12%; }
.tome.blank .plus { font: 300 54px/1 Georgia, serif; }
.tome.blank .cover-title { margin-top: 8px; font-size: 15px; text-shadow: none; }
.book:hover .tome.blank { transform: translateY(-4px); }
/* the label on the shelf below each book */
.book .plate { display: flex; flex-direction: column; gap: 5px; padding: 0 2px; min-width: 0; }
.book .plate .badges { gap: 3px; }
@media (prefers-reduced-motion: reduce) { .book .tome, .book:hover .tome { transition: none; transform: none; } }
@media (max-width: 640px) { .books { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 26px 16px; } .tome .cover-title { font-size: 17px; } }
.tome.coloring .face { padding-bottom: 28%; }
/* phones: the menu becomes a scrolling strip above the page instead of a 200 px column */
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .nav { display: flex; overflow-x: auto; white-space: nowrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 4px 6px; }
  .nav a { padding: 8px 12px; flex: none; }
  .nav a.active { border-left: 0; border-bottom: 3px solid var(--accent); padding-left: 12px; }
  .nav-group { display: none; }
  #book-rail, .book-rail, .book-rail .rail-group { display: contents; }
  .book-rail .rail-title { display: none; }
  .book-rail .rail-link { flex: none; padding: 8px 12px; }
  .book-rail .rail-link.active { border-left: 0; border-bottom: 3px solid var(--accent); padding-left: 12px; }
  .main { padding: 16px; }
  .top { flex-wrap: wrap; gap: 8px; }
  .grid2, .grid3, .msgrid { grid-template-columns: 1fr; }
}
/* a cover with its own art: the picture sits between the title and the author, like the printed front */
.tome .cover-art { width: 78%; max-height: 42%; object-fit: contain; margin: 8px auto 6px; background: #fff; border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.tome.has-art .cover-title { margin-top: 0; font-size: 18px; }
.tome.has-art .face { padding-top: 12%; }
.tome.coloring.has-art .face { background: linear-gradient(90deg, #c0612b 0, #a64f20 7%, rgba(0,0,0,.12) 7.5%, transparent 10%), linear-gradient(160deg, var(--c1), var(--c2)); padding-bottom: 12%; }
.tome.coloring.has-art .doodle { display: none; }
.cover-card { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; }
.cover-card .cover-thumb { width: 120px; aspect-ratio: 8.5 / 11; background: #fbf6ea; border: 1px solid var(--line); border-radius: 3px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cover-card .cover-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
/* ---- Listen ------------------------------------------------------------------------------------------------- */
table.cast { margin: 8px 0; max-width: 640px; }
table.cast select { max-width: 280px; }
details.clone-box { margin: 10px 0; padding: 8px 12px; border: 1px dashed var(--line, #ccc); border-radius: 8px; }
details.clone-box summary { cursor: pointer; font-weight: 600; }
details.clone-box .row { margin: 6px 0; flex-wrap: wrap; }
.listen-bar { position: sticky; top: 56px; z-index: 3; }
.ms.listen .para { cursor: pointer; transition: background .2s; }
.ms.listen .para.reading { background: #fff2c9; box-shadow: -6px 0 0 #e0b84a; }
.ms.listen .spoken { color: #2d4a7a; }
.listen-tools { display: none; align-items: center; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px; font: 13px Inter, system-ui, sans-serif; }
.listen-tools.on { display: flex; }
.listen-who { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-weight: normal; }
.listen-who select { width: auto; max-width: 180px; padding: 2px 4px; font-size: 13px; }
.edit-note { position: relative; margin: 0 0 14px; padding: 8px 34px 8px 12px; background: #fff8e6; border: 1px solid #e3c766; border-radius: 6px; font: 13px/1.45 Inter, system-ui, sans-serif; }
.edit-note ul { margin: 2px 0 6px; padding-left: 18px; }
.edit-note code { font: 12px var(--mono); }
.edit-note-bad b { color: var(--error); }
.edit-note-close { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; background: none; border: 0; border-radius: 4px; font-size: 16px; line-height: 1; cursor: pointer; }
.edit-note-close:hover { background: rgba(0, 0, 0, .06); }
.sales-chart svg { width: 100%; height: auto; display: block; }

/* story contract */
.canon-row { border: 1px solid var(--line); border-left: 4px solid #9aa5b1; border-radius: 6px; padding: 8px 10px; margin: 8px 0; background: var(--panel); }
.canon-row.s-accepted, .canon-row.s-answered { border-left-color: #2e8b57; }
.canon-row.s-rejected { opacity: 0.6; }
.canon-row.s-candidate, .canon-row.s-open { border-left-color: #d29a2b; }
.canon-row.locked { border-left-color: #3d6fb6; background: #f4f7fc; }
.cchip { font: 600 0.7rem system-ui, sans-serif; padding: 2px 8px; border-radius: 999px; background: #eee; white-space: nowrap; }
.c-accepted, .c-answered { background: #d9eadf; color: #1f6f4a; }
.c-candidate, .c-open, .c-proposed { background: #fbe3c8; color: #8a4b00; }
.c-rejected { background: #eee; color: #777; }

/* the revision queue (B53) */
.rq-filters { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.rq-chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; margin: 0 4px 4px 0; }
.rq-chip.on { border-color: var(--accent); background: #e7f0eb; font-weight: 600; }
.rq-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.rq-card { border-left: 4px solid var(--line); }
.rq-card.b-high { border-left-color: var(--error); }
.rq-card.b-medium { border-left-color: var(--warning); }
.rq-band { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; background: var(--bg); text-transform: uppercase; letter-spacing: 0.03em; }
.rq-band.b-high { color: var(--error); }
.rq-band.b-medium { color: var(--warning); }
.rq-text { font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.6; margin: 10px 0; }
.rq-text mark { border-radius: 2px; padding: 0 1px; }
.rq-flag { border-top: 1px solid var(--line); padding: 8px 0 4px; }
.rq-flag.answered { opacity: 0.6; }
.rq-why { color: var(--muted); margin: 2px 0; }
.rq-basis { font-size: 11px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.rq-basis.model { border-color: var(--info); color: var(--info); }
.rq-form { background: var(--bg); border-radius: 6px; padding: 8px; margin: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.rq-rule { display: flex; flex-direction: column; gap: 6px; }
.rq-pass { margin-top: 10px; }
.rq-progress { height: 8px; border-radius: 4px; background: var(--line); display: flex; overflow: hidden; margin-top: 4px; }
.rq-progress span { background: var(--ok); }
.rq-progress span.ans { background: #9cc5b0; }
.rq-schart { display: grid; gap: 3px; }
.rq-srow { display: grid; grid-template-columns: 160px 1fr; gap: 8px; align-items: center; }
.rq-srow a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rq-sbar { display: flex; height: 12px; }
.rq-sbar span { display: block; height: 100%; }
mark.rq-intimacy, .rq-dot.rq-intimacy { background: #f6d5e3; } .rq-dot.rq-intimacy { background: #b0306a; }
mark.rq-swearing { background: #f7e1c8; } .rq-dot.rq-swearing { background: #9c5607; }
mark.rq-cliche { background: #e6def3; } .rq-dot.rq-cliche { background: #6b4fa0; }
mark.rq-purple { background: #efdcf0; } .rq-dot.rq-purple { background: #8a3f8e; }
mark.rq-exposition { background: #d9e6f2; } .rq-dot.rq-exposition { background: #2c5f8a; }
mark.rq-detail { background: #d8ebe0; } .rq-dot.rq-detail { background: #2d6a4f; }
mark.rq-ai { background: #f5d9d6; } .rq-dot.rq-ai { background: #a3271d; }
mark.rq-pov { background: #e4e4e0; } .rq-dot.rq-pov { background: #555; }
mark.rq-shape { background: #f1ecc4; } .rq-dot.rq-shape { background: #7a6a00; }
@media (max-width: 700px) { .rq-srow { grid-template-columns: 90px 1fr; } }

/* a mark's own page (the view contract, B59) */
.mk-basis { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.mk-ev { padding-left: 18px; } .mk-ev li { margin: 6px 0; font-family: Georgia, serif; }
.mk-a { border-top: 1px solid var(--line); padding: 6px 0; } .mk-a summary { font-weight: 600; cursor: pointer; } .mk-a p { margin: 4px 0; }
.mk-cite { font-family: var(--mono); font-size: 11px; margin-right: 8px; }
/* a view's summary and callouts (B60) */
.vn { margin: 8px 0 4px; } .vn-sum { margin: 0 0 6px; padding-left: 18px; font-size: 13px; } .vn-sum li { margin: 2px 0; }
.vn-call { border: 1px solid #f0d39b; border-left: 4px solid #d29a2b; background: #fff8ec; border-radius: 6px; padding: 7px 10px; margin: 6px 0; font-size: 13px; }
.vn-why { font-size: 12px; color: #6b5a3a; margin-top: 2px; } .vn-none { font-size: 12px; color: var(--muted); margin: 4px 0; }
.mk-ai { border-left: 3px solid var(--info); padding: 4px 10px; margin-top: 8px; background: #f4f8fb; border-radius: 4px; }

/* a character's own contract (B67) */
.cc textarea, .cc input:not([type=checkbox]), .cc select { width: 100%; box-sizing: border-box; margin: 4px 0; }
.cc .row { display: flex; gap: 8px; flex-wrap: wrap; }
.cc .row > * { flex: 1 1 200px; }
.cc ul { padding-left: 18px; }
.cc-r { margin: 6px 0; }
.cc-r.rejected { opacity: .5; text-decoration: line-through; }
.cc-r.proposed, .cc-r.candidate, .cc-r.unverified { border-left: 3px solid #c9a227; padding-left: 8px; }
.cc-act button { font-size: 12px; padding: 1px 8px; margin-left: 6px; }
.cc-q { border-left: 3px solid var(--accent); padding-left: 8px; margin: 3px 0; font-style: italic; }
.cc-arc ol { margin: 2px 0 8px; }
.cc li > label { display: flex; gap: 6px; align-items: baseline; text-align: left; color: var(--ink); font-size: 13px; margin: 2px 0; }
.cc input[type=checkbox] { width: auto; margin: 0; flex: none; }
mark.rq-character { background: #f3d3c4; } .rq-dot.rq-character { background: #a3271d; }
mark.rq-voicing { background: #cfe9ea; } .rq-dot.rq-voicing { background: #00707a; }

/* ---- Margin: a chapter with its flags beside the words ---------------------------------------------------------- */
.mg { --mg-margin: 340px; --mg-gap: 56px; }
.mg-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.mg-eyebrow { font-size: 12px; color: var(--muted); }
.mg-title { font: 400 30px/1.2 var(--serif); margin: 2px 0 4px; }
.mg-hint { margin: 0; }
.mg-nav { display: flex; gap: 16px; font-size: 14px; padding-top: 6px; }
.mg-strip { display: flex; align-items: flex-end; gap: 2px; height: 36px; padding: 4px 0; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.mg-strip a { flex: 1; min-width: 3px; height: 100%; display: flex; align-items: flex-end; border-radius: 2px; }
.mg-strip a:hover { background: var(--line); }
.mg-strip a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mg-strip span { display: block; width: 100%; background: #b9c8bf; border-radius: 2px 2px 0 0; }
.mg-strip a.on span { background: var(--accent); }
.mg-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 18px; }
.mg-chips .rq-chip:not(.on) { opacity: .6; }
.mg-body { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) var(--mg-margin); column-gap: var(--mg-gap); align-items: start; }
.mg-text { background: #fffdf8; border: 1px solid var(--line); border-radius: 10px; padding: 40px 48px; font: 18px/1.7 var(--serif); max-width: 760px; width: 100%; justify-self: end; }
.mg-para { margin: 0 0 .9em; }
.mg-para.mg-saving { opacity: .6; }
.mg-para.display { text-align: center; font-size: 14px; font-style: italic; color: var(--muted); }
.mg-text .scene-title { font: 12px Inter, system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.mg-text .scene-break { text-align: center; color: var(--muted); margin: 1.2em 0; letter-spacing: .4em; }
.mg-text mark { --mg-c: var(--muted); background: transparent; color: inherit; border-bottom: 2px solid var(--mg-c); cursor: pointer; border-radius: 0; transition: background .12s; }
.mg-text mark.rq-intimacy { --mg-c: #b0306a; } .mg-text mark.rq-swearing { --mg-c: #9c5607; } .mg-text mark.rq-cliche { --mg-c: #6b4fa0; } .mg-text mark.rq-purple { --mg-c: #8a3f8e; }
.mg-text mark.rq-exposition { --mg-c: #2c5f8a; } .mg-text mark.rq-detail { --mg-c: #2d6a4f; } .mg-text mark.rq-ai { --mg-c: #a3271d; } .mg-text mark.rq-pov { --mg-c: #555; }
.mg-text mark.rq-shape { --mg-c: #7a6a00; } .mg-text mark.rq-character { --mg-c: #a3271d; } .mg-text mark.rq-voicing { --mg-c: #00707a; }
.mg-text mark.model { --mg-c: var(--ai); border-bottom-style: dashed; }
.mg-text mark.mg-broad { border-bottom-color: transparent; cursor: inherit; }
.mg-text mark.on { background: #fff0c2; border-bottom-color: var(--mg-c); }
.mg-margin { position: relative; min-width: 0; }
.mg-card { position: absolute; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; transition: top .16s ease, box-shadow .16s; }
.mg-card.open { border-color: var(--accent); box-shadow: 0 4px 16px rgba(11, 77, 53, .14); z-index: 2; }
.mg-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; background: none; border: 0; border-radius: 8px; padding: 6px 10px; text-align: left; font-size: 14px; }
.mg-head:hover { background: var(--bg); }
.mg-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mg-label { flex: 1; min-width: 0; }
.mg-card.open .mg-label { font-weight: 600; }
.mg-head .rq-dot { flex: none; margin: 0; }
.mg-head .rq-dot.model { background: var(--ai); }
.mg-model { font-size: 12px; color: var(--ai); }
.mg-detail { padding: 2px 12px 12px; font-size: 14px; line-height: 1.5; }
.mg-detail[hidden] { display: none; }
.mg-detail p { margin: 0 0 8px; }
.mg-actions { gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mg-edit-actions { gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-family: Inter, system-ui, sans-serif; }
.mg-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.mg-line path { fill: none; stroke: var(--accent); stroke-width: 1.25; }
@media (max-width: 999px) {
  .mg-body { display: block; }
  .mg-text { padding: 22px 18px; font-size: 17px; max-width: none; }
  .mg-margin { margin-top: 16px; display: grid; gap: 6px; }
  .mg-card { position: static; }
  /* notes sit below the chapter here, so the open one comes up over the text; its heading closes it, as does Escape */
  .mg-card.open { position: fixed; left: 8px; right: 8px; bottom: 8px; max-height: 60vh; overflow: auto; z-index: 20; }
  .mg-line { display: none; }
}
.mg-source-chip { position: absolute; z-index: 5; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 5px 10px; font: 13px Inter, system-ui, sans-serif; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.mg-source-chip[hidden] { display: none; }
.mg-source-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::highlight(mg-source) { background-color: #fff0c2; }
.mg-source { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 30; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(0, 0, 0, .12); padding: 18px 20px 28px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.mg-source:focus { outline: none; }
.mg-source-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mg-source-top h2 { margin: 0; font: 400 20px/1.25 var(--serif); }
.mg-source-close { flex: none; width: 34px; height: 34px; background: none; border: 1px solid var(--line); border-radius: 6px; font-size: 18px; line-height: 1; cursor: pointer; }
.mg-source-close:hover { background: var(--bg); }
.mg-source-quote { margin: 12px 0 4px; padding: 8px 12px; background: #fffdf8; border-left: 3px solid #e3c766; font: 15px/1.55 var(--serif); }
.mg-source h3 { margin: 18px 0 6px; font: 600 12px Inter, system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.mg-source p { margin: 0 0 6px; }
.mg-source code { font: 12px var(--mono); color: var(--muted); }
.mg-source-id { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font: 12px var(--mono); color: var(--muted); }
.mg-source-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mg-source-versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mg-source-versions > li > details { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.mg-source-versions > li.seen > details { border-color: #e3c766; }
.mg-source-versions summary { cursor: pointer; }
.mg-source-match { padding: 6px 10px; margin: 4px 0 !important; background: var(--bg); border-radius: 6px; font-size: 13px; }
.mg-source-diff { margin: 8px 0 4px !important; font: 15px/1.55 var(--serif); }
.mg-source-diff ins { background: #d9efe2; text-decoration: none; border-radius: 2px; }
.mg-source-diff del { color: var(--error); text-decoration: line-through; }
.mg-source-foot { margin-top: 18px !important; padding-top: 10px; border-top: 1px solid var(--line); }
@media (max-width: 999px) { .mg-source { top: auto; left: 0; width: auto; max-height: 75vh; border-left: 0; border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(0, 0, 0, .14); } }
@media (prefers-reduced-motion: reduce) { .mg-card, .mg-text mark { transition: none; } }
