/* Showstarter — writers'-room binder.
   Palette: slate desk, white page, blue-pencil actions, and the script-revision page colours
   (blue, pink, yellow, green, goldenrod, buff, salmon, cherry) for chapter tabs. */

@font-face { font-family: "Public Sans"; src: url(fonts/public-sans-latin-wght-normal.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Literata"; src: url(fonts/literata-latin-opsz-normal.woff2) format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Literata"; src: url(fonts/literata-latin-opsz-italic.woff2) format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url(fonts/courier-prime-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url(fonts/courier-prime-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --slate: #28323e;
  --slate-2: #323d4b;
  --slate-3: #3e4a5a;
  --slate-ink: #c9d1db;
  --slate-dim: #8d98a6;
  --desk: #dfe3e8;
  --paper: #ffffff;
  --ink: #1f2630;
  --ink-2: #4b5563;
  --ink-3: #7b8594;
  --rule: #d3d8df;
  --pencil: #2e5aac;
  --pencil-dark: #224786;
  --pencil-soft: #e6edf8;
  --danger: #b3261e;

  --rev-blue: #b9d3f0;
  --rev-pink: #f4c4d2;
  --rev-yellow: #f5e488;
  --rev-green: #c3e2b9;
  --rev-goldenrod: #edc356;
  --rev-buff: #e6d5b5;
  --rev-salmon: #f3b19b;
  --rev-cherry: #dc7183;
  --rev-white: #f6f7f9;

  --ui: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: "Literata", Georgia, "Times New Roman", serif;
  --script: "Courier Prime", "Courier New", Courier, monospace;

  --panel-w: 288px;
  --radius-s: 4px;
  --radius-m: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--ui); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--desk); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--pencil); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .fill { fill: currentColor; stroke: none; }
svg .tiny { font: 600 5.4px var(--ui); fill: currentColor; stroke: none; }
:focus-visible { outline: 2px solid var(--pencil); outline-offset: 2px; }

/* ------------------------------------------------------------------ buttons & fields */
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--paper); cursor: pointer; font-weight: 550; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--pencil); border-color: var(--pencil); color: #fff; }
.btn.primary:hover { background: var(--pencil-dark); border-color: var(--pencil-dark); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }

.field { display: grid; gap: 5px; margin: 0 0 14px; }
.field > span { font-weight: 600; font-size: 14px; }
.field small { color: var(--ink-3); font-size: 13px; }
.input, .field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid #b9c1cc; border-radius: var(--radius-s); background: #fff; }
.field textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--pencil); outline-offset: -1px; border-color: var(--pencil); }
.form-error { color: var(--danger); font-size: 14px; margin: 0 0 12px; min-height: 0; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.choice label { flex: 1 1 140px; display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius-s); cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--pencil); box-shadow: inset 0 0 0 1px var(--pencil); background: var(--pencil-soft); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice b { font-weight: 650; }
.choice small { color: var(--ink-2); font-size: 13px; }
.check { display: flex; gap: 8px; align-items: center; margin: 0 0 14px; }

/* ------------------------------------------------------------------ library */
.library { min-height: 100%; }
.lib-top { display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(16px, 4vw, 40px); background: var(--slate); color: #fff; }
.wordmark { font-family: var(--script); font-weight: 700; font-size: 19px; letter-spacing: .02em; color: #fff; text-decoration: none; }
.account-btn { color: var(--slate-ink); }
.account-btn:hover { background: rgba(255,255,255,.08); }
.lib-main { max-width: 1180px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 64px; }
.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.lib-head h1 { font-family: var(--text); font-weight: 600; font-size: 30px; margin: 0; letter-spacing: -.01em; }
.lib-empty { max-width: 46ch; margin: 40px auto; text-align: center; font-family: var(--text); font-size: 18px; line-height: 1.6; color: var(--ink-2); }

/* Each bible is a script title page; its chapters show as coloured page edges down the right side. */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 34px 30px; }
.binder { position: relative; display: block; aspect-ratio: 8.5 / 11; text-decoration: none; color: var(--ink); }
.binder-edges { position: absolute; inset: 6px -10px 6px 30px; display: flex; flex-direction: column; border-radius: 2px; overflow: hidden; }
.binder-edges i { flex: 1; }
.binder-page { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 26% 9% 9% 15%; text-align: center;
  background: var(--paper); border-radius: 2px; box-shadow: 0 1px 2px rgba(31,38,48,.18), 0 6px 18px -8px rgba(31,38,48,.35);
  transition: transform .18s ease; }
.binder:hover .binder-page, .binder:focus-visible .binder-page { transform: translateX(-6px); }
.binder:focus-visible { outline: none; }
.binder:focus-visible .binder-page { outline: 2px solid var(--pencil); outline-offset: 3px; }
.binder-title { font-family: var(--script); font-weight: 700; font-size: 17px; line-height: 1.3; text-transform: uppercase; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.binder-kind { font-family: var(--script); font-size: 13px; margin-top: 12px; color: var(--ink-2); }
.binder-meta { margin-top: auto; align-self: stretch; text-align: left; font-family: var(--script); font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.binder-meta .shared { color: var(--pencil); }
.binder-holes { position: absolute; left: 4.5%; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: space-evenly; pointer-events: none; }
.binder-holes i { width: 11px; height: 11px; border-radius: 50%; background: var(--desk); box-shadow: inset 0 1px 2px rgba(0,0,0,.28); }

/* ------------------------------------------------------------------ workspace */
.workspace { display: flex; height: 100%; overflow: hidden; }
.panel { width: var(--panel-w); flex: none; display: flex; flex-direction: column; background: var(--slate); color: var(--slate-ink); transition: margin-left .22s ease; z-index: 30; }
.workspace.panel-hidden .panel { margin-left: calc(-1 * var(--panel-w)); }
.panel-head { padding: 12px 12px 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.panel-back { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: var(--radius-s); color: var(--slate-dim); font-size: 13px; text-decoration: none; }
.panel-back:hover { color: #fff; background: rgba(255,255,255,.06); }
.panel-back svg { width: 16px; height: 16px; }
.panel-bible { display: block; width: 100%; margin-top: 6px; padding: 6px 8px; border: 0; border-radius: var(--radius-s); background: none; text-align: left; cursor: pointer; color: #fff; }
.panel-bible:hover { background: rgba(255,255,255,.06); }
.panel-bible span { display: block; font-family: var(--script); font-weight: 700; font-size: 16px; line-height: 1.3; text-transform: uppercase; overflow-wrap: anywhere; }
.panel-bible small { display: block; margin-top: 2px; color: var(--slate-dim); font-size: 13px; }

.chapters { list-style: none; margin: 0; padding: 8px 8px 8px 0; overflow-y: auto; flex: 1; counter-reset: ch; }
.chapter { position: relative; display: flex; align-items: center; min-height: 42px; margin: 2px 0; border-radius: 0 var(--radius-s) var(--radius-s) 0; counter-increment: ch; }
.chapter:hover { background: var(--slate-2); }
.chapter.active { background: var(--slate-3); }
.chapter.active .chapter-name { color: #fff; font-weight: 600; }
.chapter-tab { align-self: stretch; width: 14px; margin-right: 10px; border: 0; border-radius: 0 3px 3px 0; padding: 0; cursor: pointer; background: var(--tab); }
.chapter-tab:hover { width: 18px; margin-right: 6px; }
.chapter-link { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; padding: 8px 0; border: 0; background: none; text-align: left; cursor: pointer; color: var(--slate-ink); }
.chapter-link::before { content: counter(ch); min-width: 1.4em; font-size: 12px; color: var(--slate-dim); font-variant-numeric: tabular-nums; }
.chapter-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-more, .chapter-grip { display: grid; place-items: center; width: 30px; height: 32px; border: 0; border-radius: var(--radius-s); background: none; color: var(--slate-dim); cursor: pointer; opacity: 0; }
.chapter-grip { cursor: grab; touch-action: none; }
.chapter:hover .chapter-more, .chapter:hover .chapter-grip, .chapter.active .chapter-more, .chapter.active .chapter-grip,
.chapter-more:focus-visible, .chapter-grip:focus-visible { opacity: 1; }
.chapter-more:hover, .chapter-grip:hover { color: #fff; background: rgba(255,255,255,.08); }
.chapter-grip svg, .chapter-more svg { width: 16px; height: 16px; }
.chapter.dragging { opacity: .35; }
.chapter-ghost { position: fixed; z-index: 100; pointer-events: none; background: var(--slate-3); color: #fff; box-shadow: 0 10px 24px rgba(0,0,0,.35); border-radius: var(--radius-s); }
.chapter-placeholder { height: 42px; margin: 2px 0 2px 14px; border: 1px dashed var(--slate-dim); border-radius: var(--radius-s); }
.read-only .chapter-grip, .read-only .chapter-more { display: none; }
@media (hover: none) { .chapter-more, .chapter-grip { opacity: 1; } }

.panel-foot { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 8px; }
.panel-row { display: flex; gap: 8px; }
.panel-row .panel-btn { flex: 1; }
.panel-btn { background: transparent; border-color: rgba(255,255,255,.16); color: var(--slate-ink); }
.panel-btn:hover { border-color: rgba(255,255,255,.4); color: #fff; }
.panel-btn svg { width: 16px; height: 16px; }
.read-only #addChapterBtn { display: none; }

.scrim { position: fixed; inset: 0; background: rgba(20,26,33,.45); z-index: 25; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* toolbar */
.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px; background: var(--paper); border-bottom: 1px solid var(--rule); position: relative; z-index: 5; }
.tb-group { display: flex; align-items: center; gap: 2px; padding-left: 6px; margin-left: 2px; border-left: 1px solid var(--rule); }
.tb { display: inline-flex; align-items: center; gap: 6px; min-width: 34px; height: 34px; padding: 0 8px; justify-content: center; border: 0; border-radius: var(--radius-s); background: none; cursor: pointer; color: var(--ink-2); font-size: 15px; }
.tb:hover { background: #eef1f4; color: var(--ink); }
.tb.on { background: var(--pencil-soft); color: var(--pencil); }
.tb .serif-i { font-family: var(--text); font-weight: 500; }
.tb-photo span { font-weight: 550; font-size: 14px; }
.tb-select { height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius-s); background: none; cursor: pointer; color: var(--ink-2); }
.tb-select:hover { background: #eef1f4; }
.tb-spacer { flex: 1; }
.save-state { font-size: 13px; color: var(--ink-3); padding: 0 6px; white-space: nowrap; }
.save-state.bad { color: var(--danger); }
.read-only-note { font-size: 13px; color: var(--ink-2); padding: 3px 8px; border: 1px solid var(--rule); border-radius: 999px; }
.read-only .edit-only { display: none; }

.conflict { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: #fff4d6; border-bottom: 1px solid #e8d59a; }
.conflict p { margin: 0; }
.conflict div { display: flex; gap: 8px; }

/* the page */
.desk { flex: 1; overflow-y: auto; padding: 32px clamp(10px, 4vw, 48px) 80px; }
.sheet { position: relative; max-width: 840px; min-height: calc(100% - 20px); margin: 0 auto; padding: 56px clamp(22px, 7vw, 88px) 96px; background: var(--paper);
  box-shadow: 0 1px 2px rgba(31,38,48,.12), 0 10px 30px -14px rgba(31,38,48,.3); border-radius: 2px; }
.sheet-tab { position: absolute; top: 40px; right: -12px; width: 12px; height: 64px; border-radius: 0 3px 3px 0; background: var(--tab, var(--rev-blue)); }
.chapter-title { display: block; width: 100%; margin: 0 0 22px; padding: 0; border: 0; background: none; font-family: var(--text); font-weight: 650; font-size: clamp(28px, 4.2vw, 38px); line-height: 1.15; letter-spacing: -.012em; color: var(--ink); }
.chapter-title:focus { outline: none; }
.chapter-title::placeholder { color: #b6bec9; }
.desk-foot { max-width: 840px; margin: 14px auto 0; font-size: 13px; color: var(--ink-3); text-align: right; }

.editor { font-family: var(--text); font-size: 18px; line-height: 1.68; color: var(--ink); min-height: 320px; outline: none; overflow-wrap: break-word; }
.editor::after { content: ""; display: block; clear: both; }
.editor p { margin: 0 0 .9em; }
.editor h1, .editor h2, .editor h3 { font-family: var(--text); line-height: 1.25; margin: 1.5em 0 .5em; }
.editor h1 { font-size: 1.6em; font-weight: 650; }
.editor h2 { font-size: 1.28em; font-weight: 650; }
.editor h3 { font-size: 1.05em; font-weight: 700; font-style: italic; }
.editor > :first-child { margin-top: 0; }
.editor ul, .editor ol { margin: 0 0 .9em; padding-left: 1.5em; }
.editor li { margin: .2em 0; }
.editor blockquote { margin: 0 0 1em; padding: .1em 0 .1em 1.1em; border-left: 3px solid var(--tab, var(--rev-blue)); color: var(--ink-2); font-style: italic; }
.editor hr { border: 0; border-top: 1px solid var(--rule); margin: 1.6em 0; clear: both; }
.editor a { color: var(--pencil); }
.editor.empty::before { content: attr(data-prompt); position: absolute; color: #a1aab6; font-style: italic; pointer-events: none; max-width: calc(100% - 2 * clamp(22px, 7vw, 88px)); }

/* photos */
.ss-figure { position: relative; margin: .3em auto 1.1em; padding: 0; max-width: 100%; user-select: none; }
.ss-figure[data-align="left"] { float: left; margin: .35em 1.5em .8em 0; }
.ss-figure[data-align="right"] { float: right; margin: .35em 0 .8em 1.5em; }
.ss-figure[data-align="center"] { clear: both; }
.ss-figure[data-align="full"] { clear: both; width: 100% !important; }
.ss-figure img { display: block; width: 100%; height: auto; border-radius: 2px; cursor: pointer; -webkit-user-drag: none; }
.ss-figure figcaption { font-family: var(--ui); font-size: 13.5px; line-height: 1.4; color: var(--ink-2); padding-top: 6px; outline: none; user-select: text; min-height: 1.4em; }
.editor[contenteditable="true"] .ss-figure figcaption:empty::before { content: "Add a caption"; color: #a8b0bb; }
.ss-figure.selected img { outline: 2px solid var(--pencil); outline-offset: 2px; }
.ss-figure.moving { opacity: .35; }
.ss-figure.uploading img { opacity: .5; }

.fig-controls { position: absolute; z-index: 6; pointer-events: none; }
.fig-bar { position: absolute; left: 0; bottom: calc(100% + 8px); display: flex; gap: 2px; padding: 3px; background: var(--slate); border-radius: var(--radius-m); box-shadow: 0 6px 18px rgba(0,0,0,.25); pointer-events: auto; white-space: nowrap; }
.fig-bar button { border: 0; background: none; color: var(--slate-ink); padding: 5px 9px; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: 550; }
.fig-bar button:hover { background: var(--slate-3); color: #fff; }
.fig-bar button.on { background: var(--pencil); color: #fff; }
.fig-bar button.danger { color: #f3a39c; }
.fig-move { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; display: grid; place-items: center; border-radius: 50%; background: rgba(40,50,62,.82); color: #fff; cursor: grab; pointer-events: auto; touch-action: none; }
.fig-move:active { cursor: grabbing; }
.fig-size { position: absolute; right: -9px; bottom: -9px; width: 20px; height: 20px; border-radius: 50%; background: var(--pencil); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: nwse-resize; pointer-events: auto; touch-action: none; }
.fig-size::after { content: ""; position: absolute; inset: -12px; }
.fig-ghost { position: fixed; z-index: 100; pointer-events: none; opacity: .75; box-shadow: 0 10px 30px rgba(0,0,0,.3); border-radius: 2px; }
.drop-line { position: absolute; height: 3px; background: var(--pencil); border-radius: 2px; pointer-events: none; z-index: 7; }
.drop-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--pencil); }
.desk.file-over .sheet { outline: 2px dashed var(--pencil); outline-offset: 6px; }
.size-readout { position: absolute; right: 16px; bottom: 16px; padding: 2px 7px; border-radius: 4px; background: rgba(40,50,62,.82); color: #fff; font-size: 12px; pointer-events: none; }

/* ------------------------------------------------------------------ dialogs, menus, toast */
.dialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); overflow: auto; overscroll-behavior: contain; padding: 0; border: 0; border-radius: var(--radius-m); box-shadow: 0 24px 60px rgba(20,26,33,.35); color: var(--ink); }
.dialog::backdrop { background: rgba(20,26,33,.5); }
.dialog > form, .dialog .dlg-body { padding: 22px 24px 20px; }
.dialog h2 { margin: 0 0 16px; font-family: var(--text); font-size: 23px; font-weight: 650; }
.dialog h3 { margin: 22px 0 10px; font-size: 15px; font-weight: 650; }
.dialog p { margin: 0 0 14px; color: var(--ink-2); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.dlg-actions .left { margin-right: auto; }
.member-list { list-style: none; margin: 0 0 14px; padding: 0; border-top: 1px solid var(--rule); }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.member-list li .who { flex: 1; min-width: 0; }
.member-list li small { display: block; color: var(--ink-3); }
.member-list .role { font-size: 13px; color: var(--ink-2); }
.member-list select.input { width: auto; flex: none; min-height: 34px; padding: 4px 8px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form .input { flex: 1 1 160px; width: auto; }
.inline-form select.input { flex: 0 0 auto; }
.code { font-family: var(--script); font-size: 20px; font-weight: 700; letter-spacing: .04em; padding: 10px 12px; background: #f3f5f8; border-radius: var(--radius-s); user-select: all; }

.menu { position: fixed; z-index: 90; min-width: 200px; padding: 5px; background: #fff; border-radius: var(--radius-m); box-shadow: 0 12px 32px rgba(20,26,33,.28), 0 0 0 1px rgba(20,26,33,.06); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 5px; text-align: left; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: #eef1f4; outline: none; }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--rule); margin: 5px 0; }
.menu .swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; }
.menu .swatch { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 6px; font-size: 12.5px; }
.menu .swatch i { width: 100%; height: 18px; border-radius: 3px; background: var(--tab); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.menu .swatch.on i { box-shadow: inset 0 0 0 2px var(--ink); }
.menu-label { padding: 6px 10px 2px; font-size: 12.5px; color: var(--ink-3); }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 120; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: var(--radius-m); background: var(--slate); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.toast.bad { background: var(--danger); }

/* ------------------------------------------------------------------ print view */
.print-view { background: var(--desk); min-height: 100%; }
.print-bar { position: sticky; top: 0; z-index: 3; display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: var(--slate); color: #fff; }
.print-bar .btn.ghost { color: var(--slate-ink); }
.print-bar .btn.ghost:hover { background: rgba(255,255,255,.08); }
.print-bar span { flex: 1; color: var(--slate-dim); font-size: 14px; }
.print-doc { max-width: 816px; margin: 24px auto 60px; }
.print-page { background: #fff; padding: 72px 84px; margin-bottom: 24px; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.print-title { min-height: 900px; display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 260px; font-family: var(--script); }
.print-title h1 { font-family: var(--script); font-weight: 700; font-size: 24px; text-transform: uppercase; text-decoration: underline; text-underline-offset: 4px; margin: 0; }
.print-title .kind { margin-top: 18px; font-size: 16px; }
.print-title .logline { margin-top: 48px; max-width: 46ch; font-size: 15px; line-height: 1.6; }
.print-title .by { margin-top: auto; align-self: flex-start; text-align: left; font-size: 14px; line-height: 1.6; }
.print-toc h2 { font-family: var(--text); font-size: 26px; margin: 0 0 22px; }
.print-toc ol { margin: 0; padding-left: 1.4em; font-family: var(--text); font-size: 17px; line-height: 2; }
.print-chapter .editor { min-height: 0; }
.print-chapter h2.ch-title { font-family: var(--text); font-weight: 650; font-size: 32px; line-height: 1.15; margin: 0 0 24px; padding-left: 14px; border-left: 8px solid var(--tab); }

@media print {
  @page { size: letter; margin: 0.8in 0.85in; }
  body { background: #fff; }
  .print-bar { display: none; }
  .print-doc { max-width: none; margin: 0; }
  .print-page { box-shadow: none; padding: 0; margin: 0; break-after: page; }
  .print-title { min-height: 9in; padding-top: 2.6in; }
  .ss-figure, .ss-figure img { break-inside: avoid; }
  .editor h1, .editor h2, .editor h3 { break-after: avoid; }
}

/* ------------------------------------------------------------------ small screens */
@media (max-width: 820px) {
  .panel { position: fixed; top: 0; bottom: 0; left: 0; width: min(86vw, var(--panel-w)); box-shadow: 8px 0 30px rgba(0,0,0,.3); transition: transform .22s ease; }
  .workspace.panel-hidden .panel { margin-left: 0; transform: translateX(-105%); box-shadow: none; }
  .toolbar { gap: 2px; padding: 6px 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tb-group { padding-left: 4px; }
  .tb-photo span { display: none; }
  .tb[data-cmd="strikeThrough"], .tb[data-cmd="hr"], .tb[data-cmd="underline"] { display: none; }
  .tb-select { padding: 0 2px; max-width: 108px; }
  .desk { padding: 12px 8px 60px; }
  .sheet { padding: 30px 20px 70px; }
  .sheet-tab { right: auto; left: 0; top: 0; width: 56px; height: 6px; border-radius: 0 0 3px 3px; }
  .editor { font-size: 17px; }
  .ss-figure[data-align="left"], .ss-figure[data-align="right"] { margin-left: 0; margin-right: 1em; }
  .ss-figure[data-align="right"] { margin-left: 1em; margin-right: 0; }
  .print-page { padding: 40px 28px; }
  .print-title { min-height: 600px; padding-top: 140px; }
}
@media (max-width: 520px) {
  .shelf { grid-template-columns: repeat(2, 1fr); gap: 24px 22px; }
  .binder-title { font-size: 14px; }
  .binder-kind, .binder-meta { font-size: 11px; }
  .binder-holes i { width: 8px; height: 8px; }
  .lib-head h1 { font-size: 24px; }
  .ss-figure[data-align="left"], .ss-figure[data-align="right"] { float: none; margin: .3em auto 1.1em; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
