/* fonts that ship with Unwip (SIL Open Font Licence, see fonts/) */
@font-face{font-family:"EB Garamond";src:url("fonts/EBGaramond-Regular.woff") format("woff");font-weight:100 599;font-style:normal;font-display:swap}
@font-face{font-family:"EB Garamond";src:url("fonts/EBGaramond-Bold.woff") format("woff");font-weight:600 900;font-style:normal;font-display:swap}
@font-face{font-family:"EB Garamond";src:url("fonts/EBGaramond-Italic-Regular.woff") format("woff");font-weight:100 599;font-style:italic;font-display:swap}
@font-face{font-family:"EB Garamond";src:url("fonts/EBGaramond-Italic-Bold.woff") format("woff");font-weight:600 900;font-style:italic;font-display:swap}
@font-face{font-family:"Bookhaven";src:url("fonts/Bookhaven-Regular.woff") format("woff");font-weight:100 599;font-style:normal;font-display:swap}
@font-face{font-family:"Bookhaven";src:url("fonts/Bookhaven-Bold.woff") format("woff");font-weight:600 900;font-style:normal;font-display:swap}
@font-face{font-family:"Bookhaven";src:url("fonts/Bookhaven-Italic-Regular.woff") format("woff");font-weight:100 599;font-style:italic;font-display:swap}
@font-face{font-family:"Bookhaven";src:url("fonts/Bookhaven-Italic-Bold.woff") format("woff");font-weight:600 900;font-style:italic;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url("fonts/IBMPlexMono-Regular.woff") format("woff");font-weight:100 599;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url("fonts/IBMPlexMono-Bold.woff") format("woff");font-weight:600 900;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url("fonts/IBMPlexMono-Italic-Regular.woff") format("woff");font-weight:100 599;font-style:italic;font-display:swap}
@font-face{font-family:"Crimson Pro";src:url("fonts/CrimsonPro-Regular.woff") format("woff");font-weight:100 599;font-style:normal;font-display:swap}
@font-face{font-family:"Crimson Pro";src:url("fonts/CrimsonPro-Bold.woff") format("woff");font-weight:600 900;font-style:normal;font-display:swap}
@font-face{font-family:"Crimson Pro";src:url("fonts/CrimsonPro-Italic-Regular.woff") format("woff");font-weight:100 599;font-style:italic;font-display:swap}
@font-face{font-family:"Crimson Pro";src:url("fonts/CrimsonPro-Italic-Bold.woff") format("woff");font-weight:600 900;font-style:italic;font-display:swap}
@font-face{font-family:"Larkspur";src:url("fonts/Larkspur-Regular.woff") format("woff");font-weight:100 599;font-style:normal;font-display:swap}
@font-face{font-family:"Larkspur";src:url("fonts/Larkspur-Bold.woff") format("woff");font-weight:600 900;font-style:normal;font-display:swap}
@font-face{font-family:"Larkspur";src:url("fonts/Larkspur-Italic-Regular.woff") format("woff");font-weight:100 599;font-style:italic;font-display:swap}
@font-face{font-family:"Larkspur";src:url("fonts/Larkspur-Italic-Bold.woff") format("woff");font-weight:600 900;font-style:italic;font-display:swap}
@font-face{font-family:"Cinzel";src:url("fonts/Cinzel-Regular.woff") format("woff");font-weight:100 599;font-style:normal;font-display:swap}
@font-face{font-family:"Cinzel";src:url("fonts/Cinzel-Bold.woff") format("woff");font-weight:600 900;font-style:normal;font-display:swap}
@font-face{font-family:"Oswald";src:url("fonts/Oswald-Regular.woff") format("woff");font-weight:100 599;font-style:normal;font-display:swap}
@font-face{font-family:"Oswald";src:url("fonts/Oswald-Bold.woff") format("woff");font-weight:600 900;font-style:normal;font-display:swap}
/* Folio - interface styles */
:root {
  --ui: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --bg: #f4f2ed;
  --panel: #ecE9e2;
  --panel-2: #e4e0d7;
  --paper: #fffefb;
  --text: #25231f;
  --muted: #77726a;
  --faint: #a8a299;
  --line: #dcd7cd;
  --accent: #34528a;
  --accent-soft: #dfe5f1;
  --accent-text: #ffffff;
  --sel: #d7deec;
  --danger: #b4423a;
  --shadow: 0 1px 2px rgba(40, 35, 25, .06), 0 8px 30px rgba(40, 35, 25, .07);
  --radius: 8px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1b1c1f;
  --panel: #212226;
  --panel-2: #2a2b30;
  --paper: #25262a;
  --text: #e7e4dd;
  --muted: #9b978f;
  --faint: #6d6a64;
  --line: #34353b;
  --accent: #8aa6dc;
  --accent-soft: #2c3548;
  --accent-text: #15171c;
  --sel: #33405a;
  --danger: #e07a70;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 var(--ui); overflow: hidden; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }
select, input { font: inherit; color: inherit; }
::selection { background: var(--sel); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--line); background: var(--paper); border-radius: 7px; padding: 6px 12px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.btn.accent:hover { filter: brightness(.97); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 4px 8px; font-size: 12.5px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; background: transparent; border-radius: 7px; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }

/* ---------- library ---------- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.lib-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 32px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 650; font-size: 17px; display: flex; align-items: center; gap: 10px; letter-spacing: .2px; }
.lib-total { color: var(--muted); }
.lib-total span { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.lib-body { flex: 1; overflow: auto; padding: 28px 32px 40px; max-width: 1200px; width: 100%; margin: 0 auto; }
.lib-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.lib-row h1 { font-size: 22px; font-weight: 600; margin: 0; }
.lib-actions { display: flex; gap: 8px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.project-card { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 18px 18px 16px; cursor: pointer; min-height: 150px; display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s, border-color .12s; }
.project-card:hover { box-shadow: var(--shadow); border-color: var(--faint); transform: translateY(-1px); }
.project-card .pc-spine { width: 34px; height: 4px; border-radius: 4px; background: var(--accent); margin-bottom: 14px; opacity: .8; }
.project-card h3 { margin: 0 0 6px; font: 600 18px/1.25 Georgia, "Times New Roman", serif; }
.project-card .pc-meta { color: var(--muted); font-size: 12.5px; margin-top: auto; }
.project-card .pc-more { position: absolute; top: 10px; right: 8px; opacity: 0; }
.project-card:hover .pc-more { opacity: 1; }
.lib-empty { color: var(--muted); padding: 50px 0; text-align: center; grid-column: 1 / -1; }

/* ---------- workspace ---------- */
.topbar { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--bg); flex-shrink: 0; }
.tb-left { display: flex; align-items: center; gap: 6px; min-width: 180px; max-width: 260px; flex-shrink: 1; }
.project-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar { flex: 1; display: flex; align-items: center; justify-content: center; gap: 3px; min-width: 0; overflow: hidden; }
.toolbar select { height: 30px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 0 6px; cursor: pointer; outline: none; }
.toolbar select:hover, .toolbar select:focus { background: var(--panel-2); }
.toolbar select option, .toolbar select optgroup { background: var(--paper); color: var(--text); }
#sel-block { width: 104px; }
.sel-font { width: 170px; }
.sel-size { width: 64px; }
.tb-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: var(--text); font-size: 15px; font-family: Georgia, serif; }
.tb-btn:hover { background: var(--panel-2); }
.tb-btn.on { background: var(--accent-soft); color: var(--accent); }
.tb-btn svg { width: 17px; height: 17px; }
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; }
.tb-right { display: flex; align-items: center; gap: 4px; }

.main { flex: 1; display: flex; min-height: 0; }

/* binder */
.binder { width: 270px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.binder-scroll { flex: 1; overflow: auto; padding: 10px 6px 20px; }
.binder-foot { display: flex; align-items: center; gap: 4px; padding: 8px; border-top: 1px solid var(--line); }
.tree-row { display: flex; align-items: center; gap: 6px; height: 30px; padding-right: 8px; border-radius: 6px; cursor: default; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; position: relative; color: var(--text); }
.tree-row:hover { background: var(--panel-2); }
.tree-row.selected { background: var(--accent-soft); color: var(--accent); }
.tree-row.selected .tr-icon { color: var(--accent); }
.tree-row.no-book .tr-title { opacity: .5; font-style: italic; }
.tree-row.no-book .tr-count::before { content: 'left out · '; font-style: italic; }   /* says why it's faded: touch screens never see the tooltip */
.tree-row .tr-chev { width: 16px; height: 16px; display: inline-grid; place-items: center; color: var(--faint); flex-shrink: 0; transition: transform .12s; }
.tree-row .tr-chev svg { width: 13px; height: 13px; }
.tree-row .tr-chev.open { transform: rotate(90deg); }
.tree-row .tr-chev.none { visibility: hidden; }
.tree-row .tr-icon { color: var(--muted); display: inline-grid; place-items: center; flex-shrink: 0; }
.tree-row .tr-icon svg { width: 16px; height: 16px; }
.tree-row .tr-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-row .tr-count { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tree-row.root { font-weight: 600; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.tree-row.root .tr-icon svg { width: 15px; height: 15px; }
.tree-row input.rename { flex: 1; min-width: 0; border: 1px solid var(--accent); border-radius: 4px; padding: 2px 4px; background: var(--paper); outline: none; }
.tree-row.drop-before::before, .tree-row.drop-after::after { content: ""; position: absolute; left: 8px; right: 8px; height: 2px; background: var(--accent); border-radius: 2px; }
.tree-row.drop-before::before { top: -1px; }
.tree-row.drop-after::after { bottom: -1px; }
.tree-row.drop-inside { outline: 2px solid var(--accent); outline-offset: -2px; }
.tree-row.dragging { opacity: .4; }

/* editor */
.editor-wrap { flex: 1; overflow: auto; position: relative; scroll-behavior: auto; }
.page { --page-width: 760px; width: min(var(--page-width), calc(100% - 48px)); margin: 32px auto 50vh; background: var(--paper); box-shadow: var(--shadow); border-radius: 4px; padding: 64px 80px 90px; min-height: calc(100vh - 160px); }
.doc-title { width: 100%; border: 0; background: transparent; outline: none; font: var(--t-style, normal) var(--t-weight, 700) var(--t-size, 18pt)/1.3 var(--t-font, Georgia), serif; text-align: var(--t-align, center); color: var(--text); padding: 0; margin-bottom: 28px; border-radius: 4px; }
.doc-title:focus { box-shadow: 0 0 0 1px var(--line); }
.doc-title::placeholder { color: var(--faint); }
.empty-state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

.editor {
  outline: none; min-height: 60vh; caret-color: var(--accent);
  font-family: var(--doc-font, 'Times New Roman'), serif;
  font-size: var(--doc-size, 12pt);
  line-height: var(--doc-lh, 1.5);
  text-align: var(--doc-align, left);
  color: var(--text);
  word-wrap: break-word;
}
.editor p { margin: 0 0 var(--doc-pspace, 0pt); text-indent: var(--doc-indent, 0.5in); }
.editor.no-first-indent > p:first-child,
.editor.no-first-indent > :is(h1, h2, h3, .scene) + p { text-indent: 0; }
.editor p.scene { text-align: center; text-indent: 0; margin: 1em 0; }
.editor h1 { font: var(--h1-weight, 700) var(--h1-style, normal) var(--h1-size, 20pt)/1.2 var(--h1-font, Georgia), serif; text-align: var(--h1-align, center); margin: var(--h1-before, 24pt) 0 var(--h1-after, 18pt); text-indent: 0; }
.editor h2 { font: var(--h2-weight, 700) var(--h2-style, normal) var(--h2-size, 16pt)/1.2 var(--h2-font, Georgia), serif; text-align: var(--h2-align, left); margin: var(--h2-before, 18pt) 0 var(--h2-after, 10pt); text-indent: 0; }
.editor h3 { font: var(--h3-weight, 700) var(--h3-style, normal) var(--h3-size, 13pt)/1.2 var(--h3-font, Georgia), serif; text-align: var(--h3-align, left); margin: var(--h3-before, 14pt) 0 var(--h3-after, 6pt); text-indent: 0; }
.editor blockquote { margin: 0 0.5in var(--doc-pspace, 0); font-style: normal; }
.editor blockquote p { text-indent: 0; }
.editor:empty::before { content: "Start writing…"; color: var(--faint); font-style: italic; }

/* writer mode */
body.writer .topbar, body.writer .binder { display: none; }
body.writer .page { box-shadow: none; margin-top: 12vh; }
body.writer .statusbar { position: fixed; left: 0; right: 0; bottom: 0; opacity: 0; transition: opacity .3s; background: var(--paper); }
body.writer .statusbar:hover { opacity: 1; }
body.writer .doc-title { opacity: .55; }
.writer-exit { position: fixed; top: 14px; right: 18px; opacity: 0; transition: opacity .3s; z-index: 5; }
body.writer .writer-exit:hover { opacity: 1; }
body:not(.writer) .writer-exit { display: none; }
/* the left panel tucked away (button, Ctrl+Shift+[, or while a right panel is open) */
body.binder-off #workspace .binder { display: none; }
#btn-binder.on { color: var(--accent); }
/* writer mode with a panel open: one way out, at the page's corner, clear of the panel (the panel's own ✕ is back
   once you leave writer mode) */
body.writer.side-open .writer-exit { right: calc(var(--side-w, 290px) + 18px); }
/* one way out of writer mode with a mouse too (owner, 29 Oct): the bottom strip's Exit, with page size, typewriter and
   fade; the top button is for touch screens, which have no strip */
@media (pointer: fine) { body.writer .writer-exit { display: none; } }
body.writer .side-x, body.writer #rp-close { display: none !important; }

/* status bar */
.statusbar { display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; flex-shrink: 0; background: var(--bg); }
.st-spacer { flex: 1; }
.st-save.saving { color: var(--accent); }

/* find bar */
.findbar { position: fixed; top: 60px; right: 20px; display: flex; align-items: center; gap: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 5px 6px 5px 10px; box-shadow: var(--shadow); z-index: 30; }
.findbar input { border: 0; outline: none; background: transparent; width: 200px; }
.findbar #find-count { color: var(--muted); font-size: 12px; min-width: 52px; text-align: right; }

/* context menu */
.ctx-menu { position: fixed; z-index: 120; min-width: 190px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); padding: 5px; }
.ctx-menu button { display: flex; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 6px; cursor: pointer; gap: 10px; }
.ctx-menu button:hover { background: var(--panel-2); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button:disabled { color: var(--faint); cursor: default; background: transparent; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.ctx-menu .hint { margin-left: auto; color: var(--faint); font-size: 12px; }

/* modals */
.modal-back { position: fixed; inset: 0; background: rgba(20, 18, 14, .35); display: grid; place-items: center; z-index: 60; animation: fade .12s ease-out; }
.modal { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: min(460px, calc(100vw - 40px)); max-height: calc(100vh - 60px); display: flex; flex-direction: column; }
.modal.wide { width: min(720px, calc(100vw - 40px)); }
.modal h2 { margin: 0; padding: 20px 22px 4px; font-size: 17px; font-weight: 600; }
.modal .m-body { padding: 10px 22px 6px; overflow: auto; }
.modal .m-body p { margin: 6px 0 12px; color: var(--muted); }
.modal .m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; }
.modal input[type=text], .modal select, .modal input[type=number] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); outline: none; }
.modal input:focus, .modal select:focus { border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); }
/* section headings in Settings and the other setting windows (owner, 3 Nov: easier to spot): bold dark capitals with a
   short bar in the accent colour under them. Only the heading itself changes size, so nothing else moves on a phone. */
.section-label { grid-column: 1 / -1; font-size: 13px; letter-spacing: .8px; text-transform: uppercase; color: var(--text); font-weight: 700; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.section-label::after { content: ""; display: block; width: 28px; height: 3px; border-radius: 2px; background: var(--accent); margin-top: 5px; }
.section-label:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.section-label .sl-now { display: inline-block; vertical-align: 1px; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .3px; text-transform: none; color: var(--good); background: rgba(60, 160, 100, .14); background: color-mix(in srgb, var(--good) 14%, transparent); }
/* tips in Settings: small and grey, all alike */
.set-grid .hint { font-size: 12.5px; line-height: 1.45; color: var(--muted); margin-top: 6px; }
.set-row { display: flex; flex-wrap: wrap; gap: 8px; }
.set-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.set-jump .chip { font-size: 12.5px; padding: 3px 10px; }
.choice { display: flex; gap: 12px; align-items: flex-start; text-align: left; border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; background: var(--bg); cursor: pointer; }
.choice:hover { border-color: var(--accent); }
.choice b { display: block; margin-bottom: 2px; }
.choice span { color: var(--muted); font-size: 12.5px; }

/* toasts */
.toasts { position: fixed; bottom: 44px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 70; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 9px; box-shadow: var(--shadow); max-width: 560px; animation: rise .18s ease-out; pointer-events: auto; line-height: 1.45; }
.toast.warn { background: #7a4a12; color: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* character / place / item sheets and notes: block paragraphs, no first-line indent */
.editor.sheet p { text-indent: 0 !important; margin-bottom: 6pt; }
.editor.sheet h2 { font-size: 13pt; text-align: left; margin: 18pt 0 6pt; }

/* toasts with a button */
.toast.with-action { display: flex; align-items: center; gap: 12px; }
.toast-btn { border: 0; border-radius: 6px; padding: 5px 10px; background: var(--accent); color: var(--accent-text); cursor: pointer; font-weight: 600; white-space: nowrap; }
.toast-x { border: 0; background: transparent; color: inherit; opacity: .6; cursor: pointer; padding: 2px 4px; }
.toast-x:hover { opacity: 1; }
@media (max-width: 560px) { .toasts { width: calc(100vw - 24px); } .toast { max-width: 100%; } .toast.with-action { flex-wrap: wrap; row-gap: 8px; } .toast.with-action > span { flex: 1 1 100%; } .toast.with-action .toast-btn { margin-left: auto; } }

/* "Move to" destination list */
.dest-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: var(--bg); }
.dest { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; text-align: left; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.dest svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.dest:hover { background: var(--panel-2); }
.dest.on { background: var(--accent-soft); color: var(--accent); }
.dest.root { font-weight: 600; }

/* drop indicators line up with the level the item will land at */
.tree-row.drop-before::before, .tree-row.drop-after::after { left: var(--drop-left, 8px); }
.binder-scroll.drop-end { box-shadow: inset 0 -3px 0 var(--accent); }

/* ---------- revision mode ---------- */
.btn.toggle.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.revise-panel { width: 290px; flex-shrink: 0; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rp-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 16px; }
.rp-title { font-weight: 650; font-size: 14px; }
.rp-scroll { flex: 1; overflow: auto; padding: 0 12px 20px; }
.rp-grade { display: flex; gap: 12px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.rp-grade-num { font: 600 30px/1 Georgia, serif; min-width: 44px; text-align: center; color: var(--accent); }
.rp-grade-label { font-weight: 600; }
.rp-grade-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.rp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 14px; }
.rp-stat { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.rp-stat b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.rp-stat span { color: var(--muted); font-size: 11.5px; }
.rp-cats { display: flex; flex-direction: column; gap: 2px; }
.rp-cat { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 7px; cursor: pointer; user-select: none; }
.rp-cat:hover { background: var(--panel-2); }
.rp-cat.off { opacity: .45; }
.rp-cat .sw { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.rp-cat .nm { flex: 1; }
.rp-cat .ct { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 22px; text-align: right; }
.rp-cat input { margin: 0; cursor: pointer; }
.rp-cat.zero .ct { color: var(--faint); }
.rp-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 14px 4px 0; }
.sw.veryhard { background: rgba(232, 92, 92, .42); }
.sw.hard { background: rgba(240, 200, 40, .45); }
.sw.adverb { background: rgba(70, 150, 230, .38); }
.sw.passive { background: rgba(100, 190, 80, .40); }
.sw.simpler { background: rgba(170, 100, 210, .38); }
.sw.filler { border-bottom: 3px solid #e08a2c; border-radius: 2px; }
.sw.echo { border-bottom: 3px dotted #13a1a1; border-radius: 2px; }
.sw.starts { border-bottom: 3px solid #8f8a80; border-radius: 2px; }
.sw.doubled { background: rgba(230, 60, 60, .55); }
.sw.comma { border-bottom: 3px dashed #3b6fd6; border-radius: 2px; }
.sw.typo { border-bottom: 3px double #d04040; border-radius: 2px; }
.sw.grammar { border-bottom: 3px solid #c2410c; border-radius: 2px; background: rgba(194, 65, 12, .12); }
.sw.confused { border-bottom: 3px solid #9333ea; border-radius: 2px; background: rgba(147, 51, 234, .12); }
.sw.more { border-bottom: 3px dotted #0d9488; border-radius: 2px; background: rgba(13, 148, 136, .12); }
.sw.spelling { border-bottom: 3px dotted #b45309; border-radius: 2px; }

::highlight(rv-veryhard) { background-color: rgba(232, 92, 92, .30); }
::highlight(rv-hard) { background-color: rgba(240, 200, 40, .32); }
::highlight(rv-adverb) { background-color: rgba(70, 150, 230, .30); }
::highlight(rv-passive) { background-color: rgba(100, 190, 80, .32); }
::highlight(rv-simpler) { background-color: rgba(170, 100, 210, .30); }
::highlight(rv-doubled) { background-color: rgba(230, 60, 60, .45); }
::highlight(rv-filler) { text-decoration: underline 2px #e08a2c; }
::highlight(rv-echo) { text-decoration: underline dotted 2px #13a1a1; }
::highlight(rv-starts) { text-decoration: underline 2px #8f8a80; }
::highlight(rv-comma) { text-decoration: underline dashed 2px #3b6fd6; }
::highlight(rv-typo) { text-decoration: underline wavy 1.5px #d04040; }
::highlight(rv-grammar) { text-decoration: underline wavy 1.5px #c2410c; background-color: rgba(194, 65, 12, .08); }
::highlight(rv-confused) { text-decoration: underline wavy 1.5px #9333ea; background-color: rgba(147, 51, 234, .08); }
::highlight(rv-more) { text-decoration: underline dotted 2px #0d9488; background-color: rgba(13, 148, 136, .07); }
.rp-busy { opacity: .6; margin-right: 4px; animation: rpblink 1s infinite alternate; }
@keyframes rpblink { to { opacity: .2; } }
::highlight(rv-spelling) { text-decoration: underline dotted 2px #b45309; }
::highlight(rv-focus) { background-color: rgba(52, 82, 138, .35); color: inherit; }

.rv-tip { position: fixed; z-index: 55; max-width: 320px; background: var(--text); color: var(--bg); font-size: 12.5px; line-height: 1.45; padding: 7px 10px; border-radius: 7px; pointer-events: none; box-shadow: var(--shadow); }

/* ---------- name autocomplete ---------- */
.ac-pop { position: fixed; z-index: 56; min-width: 220px; max-width: 360px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); padding: 4px; font-family: var(--ui); }
.ac-item { display: flex; align-items: center; gap: 10px; padding: 6px 9px; border-radius: 6px; cursor: pointer; }
.ac-item.on { background: var(--accent-soft); color: var(--accent); }
.ac-item .ac-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-item .ac-kind { font-size: 11px; color: var(--muted); }
.ac-item .ac-of { font-size: 11px; color: var(--faint); }
.ac-hint { font-size: 11px; color: var(--faint); padding: 3px 9px 2px; border-top: 1px solid var(--line); margin-top: 3px; }

/* ---------- status bar buttons, sprints, goals ---------- */
.st-btn { border: 0; background: transparent; color: inherit; font: inherit; padding: 2px 6px; margin: 0 -6px; border-radius: 5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.st-btn:hover { background: var(--panel-2); color: var(--text); }
.st-btn:empty { display: none; }
.goal-bar { display: inline-block; width: 46px; height: 5px; border-radius: 3px; background: var(--line); vertical-align: middle; margin-left: 6px; overflow: hidden; }
.goal-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.goal-bar.done i { background: #3f9a5a; }
body.sprinting.writer .statusbar { opacity: .8; }
.sprint-result { text-align: center; padding: 6px 0 4px; }
.sprint-result .big { font: 600 44px/1.1 Georgia, serif; color: var(--accent); }
.sprint-result .lbl { color: var(--muted); }
.sprint-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.sprint-grid div { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.sprint-grid b { display: block; font-size: 17px; }
.sprint-grid span { color: var(--muted); font-size: 12px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.history { display: flex; align-items: flex-end; gap: 4px; height: 90px; padding: 8px 2px 0; }
.history .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.history .bar i { display: block; width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.history .bar.met i { background: #3f9a5a; }
.history .bar span { font-size: 10px; color: var(--faint); }

/* revision hover card */
.rv-tip { white-space: pre-line; }
.rv-card { white-space: normal; pointer-events: auto; background: var(--paper); color: var(--text); border: 1px solid var(--line); padding: 4px; max-width: 400px; width: max-content; font-size: 13px; }
.rv-card .rc { padding: 8px 10px; }
.rv-card .rc + .rc { border-top: 1px solid var(--line); }
.rc-cat { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.rc-cat .sw { width: 11px; height: 11px; border-radius: 3px; }
.rc-msg { line-height: 1.45; }
.rc-prev { margin-top: 7px; padding: 7px 9px; background: var(--bg); border-radius: 6px; font-family: Georgia, 'Times New Roman', serif; font-size: 13.5px; line-height: 1.5; }
.rc-prev del { color: #c0392b; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.rc-prev ins { color: #2e8b57; text-decoration: none; font-weight: 600; background: rgba(46, 139, 87, .12); border-radius: 3px; }
.rc-ex { margin-top: 7px; color: var(--muted); font-size: 12.5px; line-height: 1.5; font-style: italic; }
.rc-ex span { font-style: normal; font-weight: 600; color: var(--faint); margin-right: 3px; }
.rc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.rv-card .rc-off { display: flex; justify-content: space-between; gap: 8px; width: 100%; margin-top: 2px; padding: 8px 10px 6px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--accent); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.rv-card .rc-off span { color: var(--muted); }
.rp-cards { display: flex; flex-direction: column; gap: 7px; margin: 12px 0 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.rp-cards-h { font-size: 13px; font-weight: 600; }
.rp-cards-sub { font-size: 12px; color: var(--muted); line-height: 1.45; }
.rp-cards-mode button { flex: 1; }
.rc-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 4px 9px; cursor: pointer; font-size: 12.5px; }
.rc-btn:hover { border-color: var(--faint); }
.rc-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.rc-btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.rc-btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.dict-list { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.dict-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--line); }
.dict-row:last-child { border-bottom: 0; }

/* ---------- preview ---------- */
.pv-back { position: fixed; inset: 0; z-index: 58; background: rgba(20, 18, 14, .45); display: grid; place-items: stretch; padding: 18px; animation: fade .12s ease-out; }
.pv { background: var(--bg); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.pv-head { display: flex; align-items: center; gap: 16px; padding: 10px 14px 10px 20px; border-bottom: 1px solid var(--line); }
.pv-title { font-weight: 650; font-size: 15px; }
.pv-tabs { flex: 1; display: flex; justify-content: center; gap: 4px; }
.pv-tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.pv-tabs button:hover { background: var(--panel-2); color: var(--text); }
.pv-tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pv-body { flex: 1; display: flex; min-height: 0; }
.pv-side { width: 300px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--panel); padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.pv-side select { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.pv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pv-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pv-count { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 9px; padding: 9px 10px; cursor: pointer; }
.pv-count:hover { border-color: var(--faint); }
.pv-count.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pv-count.static { cursor: default; }
.pv-count b { display: block; font: 600 22px/1.15 Georgia, serif; color: var(--accent); font-variant-numeric: tabular-nums; }
.pv-count span { color: var(--muted); font-size: 11.5px; line-height: 1.35; display: block; margin-top: 2px; }
.pv-actions { display: flex; flex-direction: column; gap: 7px; }
.pv-actions .btn { width: 100%; padding: 8px 12px; }
.pv-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.pv-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #8b8780; min-width: 0; overflow: hidden; }
:root[data-theme="dark"] .pv-stage { background: #111214; }
.pv-viewport { overflow: hidden; position: relative; filter: drop-shadow(0 6px 18px rgba(0,0,0,.28)); }
.pv-scale { transform-origin: 0 0; }
#pv-flow { transition: transform .18s ease; }
#pv-flow p, #pv-flow h1, #pv-flow h2, #pv-flow h3 { orphans: 2; widows: 2; }
.pv-viewport[data-format="ebook"] { border-radius: 14px; }
.pv-nav { display: flex; align-items: center; gap: 10px; background: var(--paper); padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow); }
.pv-nav input[type=range] { width: min(380px, 40vw); accent-color: var(--accent); }
@media (max-width: 640px) { .pv-nav { max-width: calc(100vw - 24px); gap: 6px; } .pv-nav input[type=range] { width: auto; flex: 1; min-width: 0; } #pv-pageinfo { white-space: nowrap; font-size: 13px; } }
#pv-pageinfo { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 150px; text-align: right; font-size: 13px; }

/* ---------- sprint button (top bar) ---------- */
:root { --good: #3f9a5a; --dial-track: rgba(120, 112, 100, .16); --sprint: #e0a200; }
:root[data-theme="dark"] { --good: #5cc07a; --dial-track: rgba(255, 255, 255, .09); --sprint: #f2c14e; }
.sprint-top { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; border-color: transparent; background: rgba(224, 162, 0, .14); color: #8a6200; }
:root[data-theme="dark"] .sprint-top { color: var(--sprint); background: rgba(242, 193, 78, .14); }
.sprint-top:hover { background: rgba(224, 162, 0, .22); border-color: transparent; }
.sprint-top .bolt { display: inline-grid; color: var(--sprint); }
.sprint-top.running { background: var(--sprint); color: #2a1f00; font-variant-numeric: tabular-nums; }
.sprint-top.running .bolt { color: #2a1f00; animation: pulse 1.6s ease-in-out infinite; }
.sprint-progress { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: rgba(0, 0, 0, .35); transition: width .5s linear; }
@keyframes pulse { 50% { opacity: .45; } }
.sprint-float { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--sprint); color: #2a1f00; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); opacity: .85; }
.sprint-float svg { width: 14px; height: 14px; }
.sprint-float.goal { background: #4caf6e; color: #06210f; }
.sprint-float.done { background: #4caf6e; color: #06210f; cursor: pointer; opacity: 1; pointer-events: auto; }
.sprint-float.done:hover { filter: brightness(1.06); }
#btn-sprint.goal { color: #2f8a4f; }
.sprint-float b { font-size: 15px; }

/* ---------- revision re-check ---------- */
.rp-title { flex: 1; }
.rp-checked { font-weight: 400; color: var(--faint); font-size: 12px; }
.rp-refresh { display: inline-flex; align-items: center; gap: 5px; margin-right: 4px; }
.rp-refresh svg { width: 14px; height: 14px; }
.rp-refresh.spin svg { animation: spin .5s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
.rp-note a { color: var(--accent); }

/* ---------- settings gear ---------- */
.lib-head-right { display: flex; align-items: center; gap: 12px; }
.date-input { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }

/* ---------- dials & charts ---------- */
.dial { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dial svg { display: block; }
.dial-arc { transition: stroke-dashoffset .9s cubic-bezier(.2, .8, .2, 1); }
.dial-centre { position: absolute; top: 0; left: 0; width: var(--dial-size); height: var(--dial-size); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.1; }
.dial-centre b { font: 600 calc(var(--dial-size) * .19) / 1.1 Georgia, serif; font-variant-numeric: tabular-nums; }
.dial-centre span { font-size: 11.5px; color: var(--muted); margin-top: 3px; max-width: 80%; }
.dial.done .dial-centre b { color: var(--good); }
.dial-label { font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.dial-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.stat-stack { display: flex; flex-direction: column; gap: 10px; min-width: 190px; }
.stat-card { display: flex; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.stat-card .ic { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.stat-card.flame .ic { background: rgba(230, 110, 40, .14); color: #e06a28; }
.stat-card.bolt .ic { background: rgba(224, 162, 0, .16); color: var(--sprint); }
.stat-card b { font: 600 24px/1 Georgia, serif; font-variant-numeric: tabular-nums; }
.stat-card > span:last-child { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.stat-card small { color: var(--faint); }
.pace { margin-top: 14px; padding: 9px 14px; border-radius: 9px; background: rgba(194, 122, 44, .12); color: #9a5a14; font-weight: 600; text-align: center; }
:root[data-theme="dark"] .pace { color: #e3a35f; }
.chart-wrap { margin-top: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 8px; }
.chart-cap { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.chart { position: relative; display: flex; align-items: flex-end; gap: 5px; height: 120px; padding-top: 16px; }
.chart-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.chart-bar i { position: relative; display: block; width: 100%; max-width: 34px; background: var(--accent); opacity: .8; border-radius: 4px 4px 1px 1px; transition: height .6s ease; }
.chart-bar.met i { background: var(--good); opacity: .9; }
.chart-bar.today i { opacity: 1; }
.chart-bar i em { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.chart-bar span { font-size: 10px; color: var(--faint); height: 12px; }
.chart-bar.today span { color: var(--accent); font-weight: 700; }
.chart-goal { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--good); margin-bottom: 16px; pointer-events: none; z-index: 1; }
.chart-keyrow { display: flex; justify-content: flex-end; margin: 2px 0 0; }   /* outside the bars and their numbers */
.chart-key { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--good); }
.chart-key i { display: inline-block; width: 16px; border-top: 1.5px dashed var(--good); }

/* ---------- library dashboard ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-bottom: 28px; }
.dash:empty { display: none; }
.dash-card { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.dash-card.dials { display: flex; align-items: center; justify-content: space-around; gap: 16px; flex-wrap: wrap; }
.dash-card .chart { height: 140px; }

.dash-setgoal { position: absolute; top: 8px; right: 8px; }
@media (max-width: 1000px) { .dash { grid-template-columns: 1fr; } }
.pc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pc-top .dial-centre b { font-size: 13px; }
.pc-pace { font-size: 12px; color: #9a5a14; margin: 4px 0 8px; font-weight: 600; }
:root[data-theme="dark"] .pc-pace { color: #e3a35f; }
.project-card .pc-more { top: auto; bottom: 10px; }

/* publishing standards in preview */
.pv-std { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.pv-std-head { font-size: 11.5px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin: 0 2px 6px; }
.pv-stdbtn { display: flex; gap: 9px; width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 7px 8px; cursor: pointer; }
.pv-stdbtn:hover { background: var(--panel-2); }
.pv-stdbtn .star { color: var(--faint); font-size: 14px; line-height: 1.2; }
.pv-stdbtn b { display: block; font-size: 13px; }
.pv-stdbtn small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 1px; }
.pv-stdbtn.on { border-color: var(--good); background: rgba(63, 154, 90, .10); }
.pv-stdbtn.on .star { color: #d9a400; }
.pv-std-status { font-size: 12px; margin: 6px 4px 0; line-height: 1.4; }
.pv-std-status .ok { color: var(--good); font-weight: 600; }
.pv-std-status .custom { color: var(--muted); }
.pv-smf { flex-wrap: wrap; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; }
.pv-smf .star { color: #d9a400; }
.pv-smf small { flex-basis: 100%; color: var(--muted); font-size: 11.5px; padding-left: 22px; }

/* ---------- modes ---------- */
.binder-head { padding: 10px 10px 4px; }
.mode-switch { display: flex; background: var(--panel-2); border-radius: 8px; padding: 3px; }
.mode-switch button { flex: 1; border: 0; background: transparent; padding: 5px 8px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 12.5px; }
.mode-switch button.on { background: var(--paper); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.plan-nav { display: none; padding: 6px 8px 4px; gap: 2px; flex-direction: column; border-bottom: 1px solid var(--line); }
body.detailed .plan-nav { display: flex; }
body.detailed .plan-lore { display: none; }
body.lore .plan-lore { display: flex; }
.plan-lore .pn-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); font-weight: 600; padding: 4px 8px 2px; }
html.m-phone .plan-lore { display: none !important; }
.plan-nav button { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; cursor: pointer; text-align: left; color: var(--text); }
.plan-nav button span[data-icon] { display: inline-grid; color: var(--muted); }
.plan-nav button svg { width: 16px; height: 16px; }
.plan-nav button:hover { background: var(--panel-2); }
.plan-nav button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.plan-nav button.on span[data-icon] { color: var(--accent); }
.plan-nav button.soon { color: var(--faint); }
.plan-nav button small { margin-left: auto; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--faint); }
.doc-synopsis { display: none; width: 100%; resize: none; border: 0; outline: none; background: transparent; color: var(--muted); font: italic 14px/1.5 var(--ui); margin: -16px 0 22px; padding: 4px 0; text-align: center; border-bottom: 1px dashed transparent; }
.doc-synopsis:hover, .doc-synopsis:focus { border-bottom-color: var(--line); }
body.detailed .doc-synopsis { display: block; }
.st-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.st-dot { background: var(--st); }

/* outline */
.outline-view { max-width: 1180px; margin: 24px auto 80px; padding: 0 28px; }
.ol-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.ol-head h2 { margin: 0; font: 600 24px Georgia, serif; }
.ol-head span { color: var(--muted); }
.ol-status-bar { display: flex; width: 260px; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; }
.ol-status-bar i { background: var(--st); }
.ol-table { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ol-row { display: grid; grid-template-columns: 34px minmax(160px, 1.1fr) minmax(220px, 2.4fr) 120px 120px 70px; gap: 10px; align-items: start; padding: 8px 12px; border-top: 1px solid var(--line); }
.ol-th { border-top: 0; background: var(--panel); font-size: 11.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); align-items: center; }
.ol-row.folder { background: var(--bg); }
.ol-row.folder .ol-open { font-weight: 700; }
.ol-no { color: var(--faint); font-variant-numeric: tabular-nums; padding-top: 4px; }
.ol-title { display: flex; align-items: flex-start; gap: 6px; padding-top: 3px; }
.ol-title svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; margin-top: 2px; }
.ol-open { border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; font: 600 14px/1.35 Georgia, serif; color: var(--text); }
.ol-open:hover { color: var(--accent); text-decoration: underline; }
.ol-syn { width: 100%; resize: none; border: 1px solid transparent; border-radius: 6px; background: transparent; padding: 3px 6px; font: 13.5px/1.45 var(--ui); color: var(--text); outline: none; overflow: hidden; }
.ol-syn:hover { border-color: var(--line); }
.ol-syn:focus { border-color: var(--accent); background: var(--bg); }
.ol-pov { width: 100%; border: 1px solid transparent; border-radius: 6px; background: transparent; padding: 3px 6px; outline: none; }
.ol-pov:hover, .ol-pov:focus { border-color: var(--line); background: var(--bg); }
.ol-status { width: 100%; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; background: var(--bg); border-left: 8px solid var(--st); font-size: 12.5px; }
.ol-row .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); padding-top: 4px; }
.ol-tip { color: var(--muted); font-size: 12.5px; margin-top: 12px; }
body.in-outline .toolbar { visibility: hidden; }

/* ---------- search & analysis ---------- */
.modal.xwide { width: min(1080px, calc(100vw - 40px)); height: min(760px, calc(100vh - 60px)); }
.modal.xwide .m-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.srch { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.srch-tabs { display: flex; gap: 4px; align-items: center; margin-bottom: 12px; }
.srch-tabs button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.srch-tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.srch-tabs select { margin-left: auto; width: auto !important; }
@media (max-width: 640px) { .srch-row { flex-wrap: wrap; } .srch-row #sr-q { flex: 1 1 100%; } .srch-tabs { flex-wrap: wrap; } .srch-tabs select { margin-left: 0; width: 100% !important; min-width: 0; } }
.srch-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 8px; }
.srch-row { display: flex; gap: 10px; align-items: center; }
.srch-row input[type=text] { flex: 1; }
.srch-results { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); padding: 8px; }
.srch-empty { color: var(--muted); text-align: center; padding: 30px 10px; margin: 0; }
.sr-total { color: var(--muted); font-size: 12.5px; margin: 2px 4px 8px; }
.sr-total.warn { color: #b06a10; font-weight: 600; } .sr-total.ok { color: var(--good); font-weight: 600; }
.sr-doc { margin-bottom: 10px; }
.sr-doc-title { font-weight: 600; padding: 4px 6px; display: flex; justify-content: space-between; }
.sr-doc-title span { color: var(--muted); font-weight: 400; font-size: 12px; }
.sr-hit { display: block; width: 100%; text-align: left; border: 0; background: var(--paper); border-radius: 6px; padding: 6px 10px; margin: 3px 0; cursor: pointer; font: 13.5px/1.45 Georgia, serif; color: var(--text); }
.sr-hit:hover { background: var(--accent-soft); }
.sr-hit mark { background: rgba(240, 200, 40, .55); color: inherit; border-radius: 2px; padding: 0 1px; }
.sr-more { color: var(--faint); font-size: 12px; padding: 2px 10px; }
.fq-list { display: flex; flex-direction: column; gap: 1px; }
.fq-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 60px 70px; gap: 12px; align-items: center; border: 0; background: transparent; padding: 5px 8px; border-radius: 6px; cursor: pointer; text-align: left; }
.fq-row:hover { background: var(--paper); }
.fq-word em { font-style: normal; font-size: 10.5px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.fq-bar { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; }
.fq-bar i { display: block; height: 100%; background: var(--accent); opacity: .75; }
.fq-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.fq-r { text-align: right; color: var(--faint); font-size: 12px; }
#ph-results .fq-row, #nm-results .fq-row { grid-template-columns: 1fr 70px; }
.nm-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--paper); border-radius: 7px; padding: 8px 10px; margin-bottom: 5px; }
.nm-row small { display: block; color: var(--faint); font-size: 11.5px; }
.nm-acts { display: flex; gap: 6px; }
.rp-analysis { width: 100%; margin-top: 14px; }

/* ---------- snapshots ---------- */
.page { position: relative; }
.page-snap { position: absolute; top: 16px; right: 16px; display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--faint); border-radius: 7px; padding: 5px 7px; cursor: pointer; font-size: 12px; }
.page-snap:hover { background: var(--panel-2); color: var(--text); }
.page-snap svg { width: 16px; height: 16px; }
.snaps { display: flex; gap: 14px; flex: 1; min-height: 0; }
.snap-side { width: 290px; display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.snap-take { display: flex; flex-direction: column; gap: 6px; }
.snap-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.snap-item { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.snap-item:hover { border-color: var(--faint); }
.snap-item.on { border-color: var(--accent); background: var(--accent-soft); }
.snap-item b { display: block; font-size: 13px; }
.snap-item span { color: var(--muted); font-size: 11.5px; }
.snap-main { flex: 1; display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); overflow: hidden; }
.snap-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--paper); }
.snap-head b { display: block; } .snap-head span { color: var(--muted); font-size: 12px; }
.snap-acts { display: flex; gap: 6px; flex-shrink: 0; }
.snap-legend { padding: 6px 12px; font-size: 12px; display: flex; gap: 14px; }
.snap-diff { flex: 1; overflow: auto; padding: 4px 18px 18px; font: 14px/1.6 Georgia, serif; }
.snap-diff p { margin: 0 0 6px; }
.snap-diff p.same { color: var(--muted); }
.snap-diff del, .snap-legend del, .snap-head del { color: #c0392b; background: rgba(192, 57, 43, .10); text-decoration: line-through; }
.snap-diff ins, .snap-legend ins, .snap-head ins { color: #2e8b57; background: rgba(46, 139, 87, .12); text-decoration: none; }
.import-report ul { padding-left: 20px; color: var(--muted); line-height: 1.55; }
.import-report p { color: var(--text) !important; }
.tree-row .tr-add { display: none; width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; margin-left: 2px; }
.tree-row.root:hover .tr-add { display: inline-grid; place-items: center; }
.tree-row .tr-add:hover { background: var(--accent-soft); color: var(--accent); }
.tree-unsorted { margin: 14px 8px 4px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--faint); }

/* ---------- corkboard ---------- */
.cork-view { min-height: 100%; padding: 22px 28px 60px; background:
  radial-gradient(rgba(120, 80, 30, .10) 1px, transparent 1.4px) 0 0 / 7px 7px,
  radial-gradient(rgba(90, 60, 20, .07) 1px, transparent 1.6px) 3px 4px / 11px 11px,
  #d9b98c; }
:root[data-theme="dark"] .cork-view { background:
  radial-gradient(rgba(0, 0, 0, .25) 1px, transparent 1.4px) 0 0 / 7px 7px, #4a3a28; }
.ck-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.ck-crumbs { display: flex; align-items: center; gap: 6px; background: var(--paper); border-radius: 9px; padding: 4px 8px; box-shadow: var(--shadow); }
.ck-root { border: 0; background: transparent; font-weight: 650; font-size: 14px; cursor: pointer; outline: none; }
.ck-crumb { border: 0; background: transparent; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.ck-crumb:hover, .ck-crumb.drop, .ck-root.drop { background: var(--accent-soft); color: var(--accent); }
.ck-sep { color: var(--faint); }
.ck-tools { display: flex; gap: 8px; align-items: center; }
.seg { display: flex; background: var(--paper); border-radius: 8px; padding: 3px; box-shadow: var(--shadow); }
.seg button { border: 0; background: transparent; border-radius: 6px; padding: 3px 9px; cursor: pointer; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.ck-tools .btn { box-shadow: var(--shadow); }
.ck-grid { display: grid; gap: 22px; align-items: start; }
.ck-grid.size-s { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.ck-grid.size-m { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.ck-grid.size-l { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.ck-card { position: relative; background: #fffdf6; color: #26231e; border-radius: 3px; box-shadow: 0 2px 4px rgba(60, 40, 10, .25), 0 8px 18px rgba(60, 40, 10, .12);
  padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 6px; border-top: 7px solid var(--st); transition: transform .12s, box-shadow .12s; cursor: grab;
  background-image: repeating-linear-gradient(to bottom, transparent 0 25px, rgba(80, 120, 200, .16) 25px 26px); background-position: 0 38px; }
.ck-card:nth-child(3n+1) { transform: rotate(-.6deg); } .ck-card:nth-child(3n+2) { transform: rotate(.5deg); }
.ck-card:hover { transform: rotate(0) translateY(-2px); box-shadow: 0 4px 8px rgba(60, 40, 10, .28), 0 14px 28px rgba(60, 40, 10, .16); }
.ck-card.dragging { opacity: .4; }
.ck-card.ck-before { box-shadow: -6px 0 0 -1px var(--accent), 0 2px 4px rgba(60, 40, 10, .25); }
.ck-card.ck-after { box-shadow: 6px 0 0 -1px var(--accent), 0 2px 4px rgba(60, 40, 10, .25); }
.ck-card.folder { background-color: #f3ead7; }
.ck-card.folder::after { content: ""; position: absolute; inset: 5px -5px -5px 5px; background: #ece0c6; border-radius: 3px; z-index: -1; box-shadow: 0 2px 4px rgba(60, 40, 10, .2); }
.ck-pin { position: absolute; top: -12px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8a7a, #c0392b 60%, #7d1f15); box-shadow: 0 2px 3px rgba(0,0,0,.35); }
.ck-top { display: flex; align-items: center; gap: 6px; }
.ck-num { font-size: 11px; color: #9a9182; font-variant-numeric: tabular-nums; }
.ck-title { flex: 1; min-width: 0; border: 0; background: transparent; font: 600 15px/1.3 Georgia, serif; color: #1f1c17; outline: none; padding: 2px 0; border-bottom: 1px solid transparent; }
.ck-title:focus { border-bottom-color: var(--accent); }
.ck-syn { resize: none; border: 0; background: transparent; outline: none; font: 13.5px/26px Georgia, serif; color: #3a352d; min-height: 104px; padding: 0; overflow: hidden; }
.size-s .ck-syn { min-height: 78px; font-size: 12.5px; } .size-l .ck-syn { min-height: 156px; }
.ck-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; }
.ck-chip { border: 0; border-radius: 999px; padding: 2px 8px; background: rgba(0, 0, 0, .06); color: #4f4a40; font-size: 11px; }
.ck-status { cursor: pointer; background: color-mix(in srgb, var(--st) 22%, transparent); }
.ck-status:hover { background: color-mix(in srgb, var(--st) 38%, transparent); }
.ck-chip.pov { background: rgba(52, 82, 138, .12); color: #34528a; }
.ck-words { margin-left: auto; color: #9a9182; font-variant-numeric: tabular-nums; }
.ck-open { border: 0; background: transparent; color: #34528a; font-weight: 600; cursor: pointer; font-size: 12px; opacity: 0; }
.ck-card:hover .ck-open { opacity: 1; }
.ck-new { min-height: 170px; border: 2px dashed rgba(60, 40, 10, .35); border-radius: 6px; background: rgba(255, 255, 255, .18); color: rgba(60, 40, 10, .7); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 600; }
.ck-new:hover { background: rgba(255, 255, 255, .35); }
:root[data-theme="dark"] .ck-new { color: rgba(255,255,255,.6); border-color: rgba(255,255,255,.25); }
.cork-view .ol-tip { color: rgba(50, 35, 15, .75); margin-top: 22px; }
:root[data-theme="dark"] .cork-view .ol-tip { color: rgba(255,255,255,.6); }

/* ---------- moodboard ---------- */
body.in-mood .editor-wrap { overflow: hidden; }
.mood-view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.mb-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); flex-wrap: wrap; }
.mb-head select { border: 1px solid var(--line); background: var(--paper); border-radius: 7px; padding: 5px 8px; font-weight: 600; }
.mb-head .btn { display: inline-flex; align-items: center; gap: 6px; }
.mb-head .btn svg { width: 15px; height: 15px; }
.mb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.mb-hint { color: var(--faint); font-size: 12px; }
.mb-zoom { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.mb-zoom input { width: 110px; accent-color: var(--accent); }
.mb-wrap { position: relative; flex: 1; overflow: auto; background: radial-gradient(circle, rgba(0,0,0,.09) 1px, transparent 1.3px) 0 0 / 22px 22px, var(--panel); }
.mb-wrap.drop { outline: 3px dashed var(--accent); outline-offset: -8px; }
.mb-canvas { position: relative; width: 4000px; height: 3000px; transform-origin: 0 0; }
.mb-empty { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); max-width: 420px; text-align: center; color: var(--muted); background: var(--paper); border: 1px dashed var(--line); border-radius: 12px; padding: 22px; pointer-events: none; }
.mb-empty b { display: block; color: var(--text); margin-bottom: 6px; }
.mb-item { position: absolute; border-radius: 4px; box-shadow: 0 3px 10px rgba(0,0,0,.18); background: var(--paper); cursor: grab; user-select: none; }
.mb-item.active { cursor: grabbing; box-shadow: 0 10px 28px rgba(0,0,0,.28); }
.mb-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; display: block; pointer-events: none; }
.mb-img-loading, .mb-missing { width: 100%; height: 100%; background: var(--panel-2); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.mb-note { padding: 14px 14px 18px; transform: rotate(-.6deg); }
.mb-note-text { width: 100%; height: 100%; outline: none; overflow: auto; font: italic 16px/1.4 Georgia, serif; color: #2c2416; cursor: text; user-select: text; }
.mb-note-text:empty::before { content: attr(data-placeholder); color: rgba(0,0,0,.35); }
.mb-colour { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.mb-swatch { flex: 1; border-radius: 3px; cursor: pointer; position: relative; }
.mb-swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.mb-colour-label { border: 0; background: transparent; text-align: center; font-size: 12px; outline: none; color: var(--text); font-family: ui-monospace, Consolas, monospace; }
.mb-del { position: absolute; top: -10px; right: -10px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); display: none; place-items: center; cursor: pointer; z-index: 2; }
.mb-del svg { width: 13px; height: 13px; }
.mb-item:hover .mb-del { display: grid; }
.mb-resize { position: absolute; right: -6px; bottom: -6px; width: 16px; height: 16px; border-radius: 4px; background: var(--accent); cursor: nwse-resize; display: none; border: 2px solid var(--paper); }
.mb-item:hover .mb-resize { display: block; }
.ck-card.sel { outline: 3px solid var(--accent); outline-offset: 3px; }
/* the selected folder is where + Document / + Folder will add */
.tree-row.selected:is(.root, [data-folder]) { box-shadow: inset 3px 0 0 var(--accent); }
.binder.has-target .binder-foot .btn.ghost:hover { color: var(--accent); }
/* empty margin around the binder rows: click there to deselect */
.binder-scroll { padding: 10px 8px 90px 22px; }
.tree-unsorted { margin-left: 0; }

/* ---------- timeline ---------- */
.timeline-view { padding: 18px 24px 40px; }
.tl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.tl-head select { border: 1px solid var(--line); background: var(--paper); border-radius: 7px; padding: 5px 8px; }
.tl-head .mb-zoom { margin-left: 0; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding-bottom: 8px; }
.tl-inner { position: relative; min-height: 220px; }
.tl-axis { position: relative; height: 34px; border-bottom: 1px solid var(--line); background: var(--bg); }
.tl-axis span { position: absolute; top: 9px; transform: translateX(2px); font-size: 11.5px; color: var(--muted); white-space: nowrap; padding-left: 6px; border-left: 1px solid var(--line); line-height: 16px; }
.tl-lane { position: relative; border-bottom: 1px dashed var(--line); }
.tl-lane-label { position: absolute; left: 0; top: 0; bottom: 0; width: 140px; padding: 12px; font-weight: 600; font-size: 13px; background: var(--bg); border-right: 1px solid var(--line); z-index: 1; }
.tl-track { position: relative; height: 100%; background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-repeat: repeat-x; opacity: 1; }
.tl-ev { position: absolute; height: 48px; background: var(--bg); border: 1px solid var(--line); border-left: 5px solid var(--ev); border-radius: 7px; padding: 5px 9px; cursor: grab; box-shadow: 0 1px 3px rgba(0,0,0,.08); overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.tl-ev:hover { box-shadow: 0 4px 12px rgba(0,0,0,.14); border-color: var(--ev); z-index: 2; }
.tl-ev.span { background: color-mix(in srgb, var(--ev) 13%, var(--paper)); }
.tl-ev.dragging { cursor: grabbing; opacity: .85; z-index: 3; }
.tl-ev b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-ev span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-empty { position: absolute; top: 70px; left: 20px; width: min(440px, calc(100vw - 120px)); max-width: 440px; text-align: left; color: var(--muted); }
.tl-empty b { display: block; color: var(--text); margin-bottom: 6px; }
.tl-unplaced { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.tl-unplaced .hint { color: var(--faint); font-size: 12px; }
.tl-chip { border: 1px dashed var(--faint); background: var(--paper); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.ev-colours { display: flex; gap: 6px; padding-top: 4px; }
.ev-c { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.ev-c.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--paper) inset; }
.ev-note { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); resize: vertical; font: inherit; }
.btn.danger-text { color: var(--danger); margin-right: auto; }

/* ---------- slogan & quotes ---------- */
.brand-slogan { font: italic 400 14px Georgia, serif; color: var(--muted); margin-left: 4px; letter-spacing: .2px; }
.quote-card { position: relative; margin-bottom: 18px; padding: 18px 56px 16px 24px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid #e0a200; }
.q-text { margin: 0; font: italic 19px/1.45 Georgia, serif; color: var(--text); }
.quote-card cite, .writer-quote cite, .sprint-quote cite { display: block; margin-top: 6px; font-style: normal; color: var(--muted); font-size: 13px; }
.quote-card cite::before, .writer-quote cite::before, .sprint-quote cite::before { content: "— "; }
.q-next { position: absolute; top: 12px; right: 12px; }
.writer-quote { position: fixed; top: 7vh; left: 50%; transform: translateX(-50%); width: min(620px, 80vw); text-align: center; z-index: 7; pointer-events: none; transition: opacity 1.1s ease; }
.writer-quote .q-text { font-size: 18px; color: var(--muted); }
.writer-quote.out { opacity: 0; }
.sprint-quote { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.sprint-quote .q-text { font-size: 15px; }
.toast.quote { max-width: 460px; text-align: center; }

/* ---------- split view ---------- */
.split-pane { width: 40%; min-width: 300px; max-width: 620px; flex-shrink: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--paper); }
.sp-head { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.sp-head select, .sp-pick { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); padding: 5px 8px; font-weight: 600; }
.sp-pick { display: flex; align-items: center; gap: 6px; text-align: left; cursor: pointer; font: 600 14px var(--ui); color: var(--text); }
.sp-pick .sp-pick-t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-head .sp-pick svg { transform: none; flex: none; color: var(--muted); }
.sp-menu { position: fixed; z-index: 400; max-height: min(70vh, 560px); display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; }
.sp-menu-q { border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; margin-bottom: 6px; background: var(--bg); outline: none; font: 14px var(--ui); }
.sp-menu-q:focus { border-color: var(--accent); }
.sp-menu-list { overflow: auto; }
.sp-mi { display: flex; align-items: center; gap: 4px; width: 100%; text-align: left; border: 0; background: none; padding: 5px 8px 5px calc(8px + var(--d) * 16px); border-radius: 6px; font: 14px var(--ui); color: var(--text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-mi:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.sp-mi.on { background: var(--accent); color: #fff; } .sp-mi.cur { opacity: .55; } .sp-mi small { color: inherit; opacity: .8; }
.sp-mi.folder, .sp-mi.root { color: var(--muted); } .sp-mi.root { margin-top: 4px; text-transform: uppercase; font-size: 12px; letter-spacing: .4px; }
.sp-mi.doc { padding-left: calc(30px + var(--d) * 16px); }
.sp-chev { display: inline-flex; width: 16px; height: 16px; transition: transform .12s; } .sp-chev svg { width: 14px; height: 14px; transform: none !important; } .sp-chev.open { transform: rotate(90deg); }
.sp-menu-none { color: var(--muted); padding: 8px; margin: 0; }
.sp-head svg { width: 16px; height: 16px; transform: rotate(-90deg); }
.sp-scroll { flex: 1; overflow: auto; padding: 22px 28px 60px; }
.sp-editor { outline: none; font: 15px/1.6 Georgia, 'Times New Roman', serif; color: var(--text); min-height: 60vh; }
.sp-editor p { margin: 0; text-indent: 1.5em; }
.sp-editor.sheet-like p { text-indent: 0; margin-bottom: 6px; }
.sp-editor h1, .sp-editor h2, .sp-editor h3 { font-family: Georgia, serif; margin: 14px 0 6px; font-size: 16px; }
.sp-foot { padding: 6px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
#btn-split.on { color: var(--accent); background: var(--accent-soft); }

/* favourites */
.fav-head { font-size: 11.5px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: #b8860b; padding: 6px 8px 2px; }
.fav-head span { font-size: 12px; }
.fav-row .tr-icon { color: #c99a10; }
.fav-row.current { background: var(--panel-2); }
.fav-row .tr-unfav { display: none; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 11px; }
.fav-row:hover .tr-unfav { display: inline; }
.fav-row:last-of-type { margin-bottom: 6px; }
.tr-fav { color: #d9a400; font-size: 12px; }
/* status label editor */
.stat-edit { display: flex; flex-direction: column; gap: 6px; }
.se-row { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.se-swatch { width: 26px; height: 26px; border-radius: 6px; position: relative; cursor: pointer; flex-shrink: 0; }
.se-swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.se-name { flex: 1; min-width: 120px; }
.se-presets { display: flex; gap: 3px; }
.se-p { width: 14px; height: 14px; border-radius: 50%; border: 0; cursor: pointer; }
.se-p:hover { transform: scale(1.25); }
.ol-status-wrap { display: flex; align-items: center; gap: 10px; }

/* custom icons & emoji */
.tr-emoji { font-size: 14px; line-height: 1; width: 16px; text-align: center; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.tree-row.root .tr-emoji { font-size: 13px; }
.ck-icon, .ol-title .tr-emoji { display: inline-grid; place-items: center; }
.ck-icon svg { width: 15px; height: 15px; color: #6a6355; }
.ck-icon .tr-emoji { font-size: 15px; }
.ip-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 6px 0; }
.ip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; margin-bottom: 10px; }
.ip-btn { height: 38px; border: 1px solid transparent; border-radius: 8px; background: var(--bg); cursor: pointer; display: grid; place-items: center; font-size: 19px; color: var(--muted); font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.ip-btn svg { width: 18px; height: 18px; }
.ip-btn:hover { background: var(--panel-2); }
.ip-btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.ip-grid.emoji { max-height: 210px; overflow: auto; }
.ip-own label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* ================= 0.10: themes, typing feel, comments & footnotes, Stuck? ================= */
/* page colours (Themes & colours) */
.page { background: var(--page-bg, var(--paper)); }
.editor, .doc-title { color: var(--page-ink, var(--text)); }
body.writer .editor-wrap { background: var(--room, var(--page-bg, var(--paper))); }
body.writer.writer-room .page { box-shadow: var(--shadow); }
body.page-flat .editor-wrap { background: var(--page-bg, var(--paper)); }
body.page-flat .page { box-shadow: none; background: transparent; }

.th-row { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.th-sys-pick { display: flex; gap: 12px; flex-wrap: wrap; }
.th-sys-pick.dim { opacity: .45; }
.th-sys-pick label { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.th-sys-pick select { width: auto !important; min-width: 130px; }
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 8px; }
.th-card { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; padding: 8px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; text-align: left; font-size: 12.5px; }
.th-card.sys { flex-direction: row; align-items: center; min-width: 210px; }
.th-card:hover { border-color: var(--faint); }
.th-card.on { border-color: var(--accent); }
.th-sw { position: relative; display: block; width: 100%; min-width: 60px; height: 40px; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); overflow: hidden; }
.th-card.sys .th-sw { width: 54px; }
.th-sw i { position: absolute; left: 22%; top: 22%; right: 10%; bottom: -2px; border-radius: 3px 3px 0 0; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.th-sw b { position: absolute; left: 6%; top: 18%; width: 9%; height: 52%; border-radius: 2px; }
.th-accents { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.th-acc { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; background: var(--a); cursor: pointer; box-shadow: inset 0 0 0 2px var(--paper); }
.th-acc.def { width: auto; padding: 0 10px; border-radius: 14px; background: var(--bg); border-color: var(--line); box-shadow: none; font-size: 12px; color: var(--muted); }
.th-acc.on { border-color: var(--text); }
.th-custom { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-left: 6px; cursor: pointer; }
.th-custom input { width: 30px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
.gc-pick { display: flex; flex-direction: column; gap: 10px; }
.gc-rings { display: flex; gap: 8px; flex-wrap: wrap; }
.gc-ring { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.gc-ring i { width: 16px; height: 16px; border-radius: 50%; border: 3.5px solid var(--c); box-sizing: border-box; }
.gc-ring.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* typing feel */
.ty-try { border: 1px solid var(--line); border-radius: 10px; background: var(--page-bg, var(--paper)); padding: 10px 16px 14px; margin-bottom: 10px; }
.ty-try-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); font-weight: 600; }
.ty-pad { outline: none; font: 15pt/1.6 Georgia, 'Times New Roman', serif; color: var(--page-ink, var(--text)); min-height: 52px; caret-color: var(--accent); }
.ty-pad p { margin: 4px 0 0; }
.ty-pad.no-caret, body.custom-caret .editor { caret-color: transparent; }
.tw-caret { position: fixed; left: 0; top: 0; z-index: 55; pointer-events: none; background: var(--accent); border-radius: 1px; animation: tw-blink 1.06s steps(1) infinite; will-change: transform; }
.tw-caret.ty-caret { z-index: 75; }
.tw-caret.glide { transition: transform .085s cubic-bezier(.2,.8,.3,1), height .085s; }
.tw-caret.block { opacity: .42; border-radius: 2px; }
.tw-caret.thick { border-radius: 2px; }
.tw-caret.still, .tw-caret.solid { animation: none; }
@keyframes tw-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.tw-caret.block.solid, .tw-caret.block.still { opacity: .42; }
::highlight(unwip-typed) { color: transparent; }
::highlight(unwip-dim) { color: var(--faint); }
.editor { transition: color .2s; }
.tw-layer { position: fixed; inset: 0; pointer-events: none; z-index: 54; }
.tw-ghost { position: fixed; white-space: pre; pointer-events: none; transform-origin: 50% 70%; }

/* comments & footnotes */
.editor span.cmt { background: rgba(245, 196, 66, .26); border-bottom: 2px solid rgba(214, 160, 30, .75); cursor: pointer; border-radius: 2px; }
:root[data-theme="dark"] .editor span.cmt { background: rgba(245, 196, 66, .16); }
::highlight(unwip-cmt-on) { background-color: rgba(245, 180, 40, .55); }
.editor { counter-reset: fn; }
.editor sup.fn, .sp-editor sup.fn { counter-increment: fn; color: var(--accent); font: 700 .68em var(--ui); cursor: pointer; padding: 0 2px; border-radius: 3px; vertical-align: super; line-height: 0; }
.sp-editor { counter-reset: fn; }
.editor sup.fn::after, .sp-editor sup.fn::after { content: counter(fn); }
.editor sup.fn:hover { background: var(--accent-soft); }
.editor sup.fn.flash { background: var(--accent-soft); outline: 2px solid var(--accent); }
.notes-btn { position: relative; }
.np-badge { position: absolute; top: 2px; right: 0; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--accent); color: var(--accent-text); font-size: 10px; line-height: 15px; font-weight: 700; }
.np-sec { display: flex; align-items: center; gap: 6px; margin: 14px 2px 6px; font-weight: 650; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.np-sec:first-child { margin-top: 2px; }
.np-sec b { background: var(--panel-2); border-radius: 8px; padding: 0 6px; font-size: 11px; color: var(--text); }
.np-sec .btn { margin-left: auto; text-transform: none; letter-spacing: 0; }
.np-card { background: var(--paper); border: 1px solid var(--line); border-left: 3px solid #e0b33a; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; transition: box-shadow .15s, border-color .15s; }
.np-card.fn { border-left-color: var(--accent); }
.np-card.on, .np-card:focus-within { box-shadow: 0 0 0 2px var(--accent-soft); }
.np-card.flash { animation: np-flash 1s ease-out; }
@keyframes np-flash { from { background: var(--accent-soft); } to { background: var(--paper); } }
.np-quote { font: italic 12.5px/1.35 Georgia, serif; color: var(--muted); margin-bottom: 6px; cursor: pointer; }
.np-num { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: var(--accent-text); font: 700 11px var(--ui); margin-right: 6px; font-style: normal; }
.np-card textarea { width: 100%; border: 1px solid transparent; background: var(--bg); border-radius: 6px; padding: 6px 8px; resize: none; font: 13px/1.4 var(--ui); color: var(--text); outline: none; overflow: hidden; }
.np-card textarea:focus { border-color: var(--accent); }
.np-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; font-size: 11.5px; color: var(--faint); }
.np-empty { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin: 4px 2px 10px; }
.np-tip { position: fixed; z-index: 58; max-width: 270px; background: var(--text); color: var(--bg); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; line-height: 1.4; pointer-events: none; box-shadow: var(--shadow); white-space: pre-wrap; }
.np-tip b { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; opacity: .7; margin-bottom: 2px; }

/* Stuck? */
.stuck-top { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.stuck-ic svg { width: 16px; height: 16px; display: block; }
.stuck-top.nudge { color: var(--accent); background: var(--accent-soft); animation: st-glow 2.4s ease-in-out infinite; }
@keyframes st-glow { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 5px var(--accent-soft); } }
.stuck h3.st-h { margin: 4px 0 6px; font-size: 16px; font-weight: 650; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 8px 0 4px; }
.st-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; transition: border-color .12s, transform .12s; }
.st-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.st-card b { font-size: 14px; }
.st-card span:last-child { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.st-ic { font-size: 22px; line-height: 1; margin-bottom: 4px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.st-quote { margin: 14px 2px 2px; font: italic 13px/1.45 Georgia, serif; color: var(--muted); }
.st-quote span { font-style: normal; font-family: var(--ui); font-size: 12px; }
.st-back { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 2px 0; font-size: 12.5px; }
.st-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.st-reasons { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.st-reason { text-align: left; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; font-size: 14px; }
.st-reason:hover { border-color: var(--accent); }
.st-prompt { display: flex; gap: 12px; align-items: flex-start; background: var(--accent-soft); border-radius: 12px; padding: 16px; font: 16px/1.45 Georgia, serif; margin: 8px 0 6px; }
.st-prompt span { flex: 1; }
.st-prompt .btn { font-family: var(--ui); flex-shrink: 0; }
.st-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.st-left blockquote { margin: 0 0 8px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 0 8px 8px 0; font: 14px/1.5 Georgia, serif; }
.st-sum { font-size: 14px; color: var(--text) !important; }
.st-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.st-bar { display: grid; grid-template-columns: 92px 1fr 52px; align-items: center; gap: 8px; font-size: 12.5px; margin: 3px 0; }
.st-bar i { display: block; height: 10px; border-radius: 5px; background: var(--accent); min-width: 2px; }
.st-bar b { text-align: right; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-stall div { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.st-stall span { flex: 1; font-weight: 600; }
.st-stall em { color: var(--muted); font-size: 12px; }
.sx-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 10px; }
.sx-row { display: flex; align-items: center; gap: 8px; }
.sx-row input[type=text] { flex: 1; }
.sx-row.done input[type=text] { text-decoration: line-through; color: var(--muted); }
.sx-add { display: flex; gap: 8px; margin-bottom: 8px; }
.sx-add input { flex: 1; }
/* messy draft */
.messy-pill { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 14px; border-radius: 20px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; color: var(--muted); }
.messy-pill b { color: var(--text); font-variant-numeric: tabular-nums; }
.messy-pill .mx-dot { width: 8px; height: 8px; border-radius: 50%; background: #d9822b; animation: st-pulse 1.6s ease-in-out infinite; }
@keyframes st-pulse { 50% { opacity: .35; } }
.messy-pill.bump { animation: mx-bump .35s; }
@keyframes mx-bump { 20%, 60% { transform: translateX(calc(-50% - 6px)); } 40%, 80% { transform: translateX(calc(-50% + 6px)); } }
.mx-tip { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; white-space: nowrap; background: var(--text); color: var(--bg); font-size: 12px; padding: 4px 9px; border-radius: 6px; }
body.messy .editor { caret-color: #d9822b; }
body:not(.writer) .messy-pill { top: 58px; }
/* steps beside the page */
.steps-float { position: fixed; z-index: 30; width: 250px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px 10px 10px; font-size: 13px; }
body.writer .steps-float { opacity: .45; transition: opacity .25s; }
body.writer .steps-float:hover { opacity: 1; }
.sf-head { display: flex; align-items: center; gap: 6px; }
.sf-head svg { width: 15px; height: 15px; color: var(--accent); display: block; }
.sf-head b { flex: 1; }
.sf-n { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 2px; }
.sf-bar { height: 4px; border-radius: 2px; background: var(--panel-2); margin: 6px 0 6px; overflow: hidden; }
.sf-bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.sf-list { display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow: auto; }
.steps-float.min .sf-list { display: none; }
.sf-row { display: flex; gap: 7px; align-items: flex-start; padding: 3px 2px; cursor: pointer; line-height: 1.35; border-radius: 5px; }
.sf-row:hover { background: var(--bg); }
.sf-row input { margin-top: 2px; accent-color: var(--accent); }
.sf-row.done span { text-decoration: line-through; color: var(--faint); }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--accent); }

/* ================= Play ================= */
.lib-tabs { display: flex; gap: 2px; background: var(--panel); border-radius: 9px; padding: 3px; margin-right: auto; margin-left: 28px; }
.lib-tabs button { white-space: nowrap; border: 0; background: none; padding: 5px 16px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; }
.lib-tabs button.on { background: var(--paper); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.pl-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.pl-head h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.pl-head p { margin: 0; color: var(--muted); max-width: 620px; }
.pl-stats { display: flex; gap: 8px; }
.pl-stats div { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; min-width: 92px; }
.pl-stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.pl-stats span { color: var(--muted); font-size: 12px; }
.pl-today { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 20px 24px; box-shadow: var(--shadow); }
.pl-today-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); }
.pl-today-text { font: 21px/1.4 Georgia, serif; margin: 8px 0 14px; }
.pl-today-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.pl-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 16px 0 26px; }
.pl-tool, .pl-ex { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; transition: border-color .12s, transform .12s; position: relative; }
.pl-tool:hover, .pl-ex:hover { border-color: var(--accent); transform: translateY(-1px); }
.pl-tool span, .pl-ex-ic { font-size: 24px; line-height: 1; margin-bottom: 4px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.pl-tool b, .pl-ex b { font-size: 14.5px; }
.pl-tool em, .pl-ex em { font-style: normal; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.pl-ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.pl-ex i { position: absolute; top: 12px; right: 12px; font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--panel-2); border-radius: 10px; padding: 1px 8px; }
.pl-ex.done i { background: #3f9a5a; color: #fff; }
.pl-journal { display: flex; flex-direction: column; gap: 6px; }
.pl-piece { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.pl-piece:hover { border-color: var(--faint); }
.pl-pk { font-size: 20px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.pl-pt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl-pt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.pl-pt span { color: var(--muted); font-size: 12.5px; }
.pl-piece .pl-del { opacity: 0; }
.pl-piece:hover .pl-del { opacity: 1; }
.pl-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; max-width: 680px; }
.pl-card textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font: 14px/1.5 Georgia, serif; resize: vertical; outline: none; }
.pl-card textarea:focus { border-color: var(--accent); }
.play-home .st-back { margin-bottom: 8px; display: inline-block; font-size: 13.5px; }
.pl-dice { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pl-die { position: relative; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: left; min-height: 120px; padding: 16px; border: 2px solid var(--line); border-radius: 16px; background: var(--paper); cursor: pointer; box-shadow: var(--shadow); }
.pl-die span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); }
.pl-die b { font: 19px/1.3 Georgia, serif; font-weight: 400; }
.pl-die i { display: none; position: absolute; top: 12px; right: 12px; font-style: normal; font-size: 11.5px; color: var(--muted); }
.pl-die.locked { border-color: var(--accent); background: var(--accent-soft); }
.pl-die.locked i { display: block; }
.pl-die.rolling { animation: pl-shake .45s ease-in-out; }
@keyframes pl-shake { 0%, 100% { transform: none; } 20% { transform: rotate(-3deg) translateY(-3px); } 40% { transform: rotate(3deg); } 60% { transform: rotate(-2deg) translateY(-2px); } 80% { transform: rotate(1deg); } }
.pl-dice-acts { display: flex; gap: 8px; margin-top: 16px; }
/* ---- Copy for Royal Road (royalroad.js) */
.rr-lead { margin: 0 0 12px; color: var(--muted); }
.rr-grid { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 18px; align-items: start; }
.rr-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rr-side .check { display: flex; gap: 8px; align-items: center; margin: 0; }
.rr-title-copy { font-size: 13px; color: var(--muted); } .rr-title-copy b { color: var(--text); }
.rr-stats { font-size: 13px; color: var(--muted); }
.rr-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.rr-how { font-size: 13px; } .rr-how ol { padding-left: 18px; margin: 6px 0 0; display: flex; flex-direction: column; gap: 6px; } .rr-how code { font-size: 12px; }
.rr-prev-wrap { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.rr-prev-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.rr-prev { background: #ffffff; color: #333333; border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; max-height: 46vh; overflow: auto; font: 15px/1.6 'Open Sans', system-ui, sans-serif; }
.modal .m-body .rr-prev p { margin: 0 0 1em; color: inherit; }   /* the dialog greys its paragraphs; the preview must not */
.rr-prev table { margin: 0 0 1em; }
.modal .m-body .rr-prev td p:last-child { margin-bottom: 0; }
.rr-prev.rr-own td { border: 1px solid #c9ced6; background: #f3f6fb; }   /* only a stand-in: Royal Road draws its own table look */
.rr-prev.rr-dark { background: #1b1d21; color: #d6d6d6; }
.rr-prev.rr-dark.rr-own td { border-color: #3c4250; background: #252a33; }
.rr-codebox { width: 100%; font: 12px/1.4 Consolas, Menlo, monospace; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--bg); color: var(--text); resize: vertical; }
@media (max-width: 720px) { .rr-grid { grid-template-columns: 1fr; } .rr-prev { max-height: 40vh; } }
/* ---- Play: word games (wordplay.js) */
.wd-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 18px; }
.wd-loading, .wd-help { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.wd-game { max-width: 520px; display: flex; flex-direction: column; gap: 12px; }
.wd-game.wide { max-width: 720px; }
.wd-score { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.wd-score b { color: var(--text); font-size: 15px; margin-left: 3px; }
.wd-score .check { display: inline-flex; gap: 6px; align-items: center; margin: 0; cursor: pointer; }
.wd-k { display: inline-block; padding: 0 6px; border-radius: 4px; color: #fff; font-weight: 600; font-size: 12px; }
.wd-k.g, .wd-tile.g, .wd-key.g { background: #3d9a5b; border-color: #3d9a5b; color: #fff; }
.wd-k.y, .wd-tile.y, .wd-key.y { background: #c49a1c; border-color: #c49a1c; color: #fff; }
.wd-k.x, .wd-tile.x, .wd-key.x { background: #7c7f86; border-color: #7c7f86; color: #fff; }
.wd-key.x { opacity: .55; }
.wd-board { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.wd-row { display: flex; gap: 6px; }
.wd-row.shake { animation: wd-shake .35s; }
@keyframes wd-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.wd-tile { width: 54px; height: 54px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 6px; font: 700 26px/1 system-ui, sans-serif; background: var(--paper); text-transform: uppercase; }
.wd-tile.typed { border-color: var(--muted); }
.wd-tile.g, .wd-tile.y, .wd-tile.x { animation: wd-flip .35s ease-out; }
@keyframes wd-flip { from { transform: rotateX(90deg); } to { transform: none; } }
.wd-under { display: flex; gap: 8px; justify-content: center; }
.wd-hinttext { text-align: center; font: 15px/1.45 Georgia, serif; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); }
.wd-hinttext i, .wd-means i, .wd-q i, .wd-item i, .wd-pos { font-style: italic; color: var(--muted); font-size: .88em; margin-right: 4px; }
.wd-kb { display: flex; flex-direction: column; gap: 6px; align-items: center; user-select: none; -webkit-user-select: none; }
.wd-kb > div { display: flex; gap: 5px; width: 100%; justify-content: center; }
.wd-key { flex: 0 1 40px; min-width: 0; height: 52px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font: 600 15px/1 system-ui, sans-serif; cursor: pointer; touch-action: manipulation; color: var(--text); }
.wd-key.wide { flex-basis: 62px; font-size: 12.5px; }
.wd-key:active { transform: translateY(1px); }
.wd-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.wd-result { font-weight: 600; color: var(--accent); }
.wd-word { margin: 0; font: 30px/1.15 Georgia, serif; }
.wd-word.small { font-size: 22px; }
.wd-means { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font: 15px/1.45 Georgia, serif; }
.wd-syn { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; font-family: system-ui, sans-serif; }
.wd-chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; color: var(--text); }
.wd-chip:hover { border-color: var(--accent); color: var(--accent); }
.wd-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.wd-q-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); }
.wd-q { margin: 0; font: 19px/1.4 Georgia, serif; }
.wd-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wd-opts.long { grid-template-columns: 1fr; }
.wd-opt { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); text-align: left; font-size: 15px; line-height: 1.35; cursor: pointer; color: var(--text); }
.wd-opt:hover:not([disabled]) { border-color: var(--accent); }
.wd-opt[disabled] { cursor: default; opacity: .6; }
.wd-opt.right { border-color: #3d9a5b; background: rgba(61,154,91,.14); opacity: 1; }
.wd-opt.wrong { border-color: #c4453c; background: rgba(196,69,60,.12); opacity: 1; }
.wd-after { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.wd-find { display: flex; gap: 8px; }
.wd-find input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 15px; color: var(--text); }
.wd-posh { margin: 6px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.wd-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.wd-item { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 13.5px; }
.wd-item:first-child { border-top: 0; }
.wd-item span { min-width: 0; color: var(--text); }
.wd-iw { border: 0; background: none; text-align: left; font: 600 15px Georgia, serif; color: var(--accent); cursor: pointer; padding: 0; }
@media (max-width: 720px) {
  #btn-binder { display: none !important; }
  .wd-tile { width: min(54px, calc((100vw - 64px) / 5)); height: min(54px, calc((100vw - 64px) / 5)); font-size: 22px; }
  .wd-kb > div { gap: 4px; }
  .wd-key { height: 48px; font-size: 14px; }
  .wd-key.wide { flex-basis: 54px; font-size: 11.5px; }
  .wd-opts { grid-template-columns: 1fr; }
  .wd-item { grid-template-columns: 1fr auto; } .wd-item span { grid-column: 1 / -1; grid-row: 2; }
}
/* play editor screen */
.pl-top .tb-left { gap: 10px; flex: 1; min-width: 0; }
.pl-kind { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; background: var(--panel-2); border-radius: 12px; padding: 3px 10px; }
.pl-title { flex: 1; min-width: 120px; max-width: 520px; border: 0; background: transparent; outline: none; font-weight: 600; font-size: 15px; color: var(--text); padding: 4px 6px; border-radius: 6px; }
.pl-title:focus { box-shadow: 0 0 0 1px var(--line); }
.pl-words { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; margin-right: 6px; }
.pl-timer { font: 600 15px var(--ui); font-variant-numeric: tabular-nums; background: var(--accent-soft); color: var(--accent); border-radius: 14px; padding: 3px 12px; margin-right: 8px; }
.pl-timer.over { background: #3f9a5a; color: #fff; }
.pl-timer.nudge { animation: st-glow 1.2s ease-in-out infinite; }
.pl-banner:empty { display: none; }
.pl-bprompt { font: italic 17px/1.45 Georgia, serif; color: var(--muted); border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; margin-bottom: 26px; }
.pl-bdice { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 26px; }
.pl-bdice div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.pl-bdice span { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); }
.pl-bdice b { font: 400 14px/1.3 Georgia, serif; }
.pl-editor { --doc-font: Georgia; --doc-size: 13pt; --doc-lh: 1.65; --doc-indent: 0; --doc-pspace: 10pt; min-height: 50vh; }
.pl-ex-desc { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 2px 12px; }
.pl-rules { display: flex; flex-direction: column; gap: 6px; }
.pl-rule { display: flex; gap: 10px; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
.pl-rule > span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--faint); border: 1.5px solid var(--line); flex-shrink: 0; font-size: 12px; }
.pl-rule.ok > span { background: #3f9a5a; border-color: #3f9a5a; color: #fff; }
.pl-rule b { display: block; font-weight: 600; font-size: 13px; }
.pl-rule em { font-style: normal; color: var(--muted); font-size: 12px; }
.pl-passed { margin-top: 12px; padding: 12px; border-radius: 10px; background: #e3f2e7; color: #23633a; font-weight: 600; text-align: center; }
:root[data-theme="dark"] .pl-passed { background: #213b2a; color: #9fd8b0; }
.mm-who { font-size: 11.5px; color: var(--muted); margin: 6px 0 3px; }
.mm-bars { display: flex; align-items: flex-end; gap: 3px; height: 60px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 6px; overflow-x: auto; }
.mm-bars i { flex: 0 0 9px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .85; }
.mm-bars span { color: var(--faint); font-size: 12px; margin: auto; }
.mm-table { width: 100%; border-collapse: collapse; margin: 14px 0 10px; font-size: 12.5px; }
.mm-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 4px; }
.mm-table td { padding: 6px 4px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.mm-table td em { display: block; font-style: normal; color: var(--faint); font-size: 11px; }
.mm-table tr.close td:last-child { color: #3f9a5a; font-weight: 700; }
.mm-model summary { cursor: pointer; color: var(--accent); font-size: 12.5px; }
.mm-model p { font: 13px/1.5 Georgia, serif; color: var(--muted); }
.up-notes { background: var(--bg); border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.5; max-height: 300px; overflow: auto; margin-bottom: 8px; }
/* release notes as a readable list (updates.js notesList) */
.up-notes.up-rich { font-size: 14.5px; line-height: 1.55; max-height: min(60vh, 520px); padding: 14px 18px; color: var(--text); }
.up-rich ul { margin: 0; padding-left: 20px; } .up-rich > ul > li { margin: 0 0 9px; } .up-rich ul ul { margin: 6px 0 2px; } .up-rich ul ul li { margin: 0 0 4px; color: var(--muted); }
.up-rich h4 { margin: 10px 0 6px; font-size: 14px; } .up-rich p { margin: 0 0 8px; }
/* Settings › What's new */
.up-news { display: flex; flex-direction: column; gap: 6px; }
.up-n { border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.up-n summary { cursor: pointer; padding: 9px 12px; font-size: 14px; list-style-position: inside; }
.up-n .up-notes { margin: 0 8px 8px; }
.up-n-now { font-size: 11.5px; color: var(--accent); margin-left: 6px; font-weight: 500; }
/* the notice when a new version is ready: big enough to read without squinting */
.up-card { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 900; width: min(420px, calc(100vw - 32px)); background: var(--panel); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.25); padding: 16px 18px 14px; animation: fade .2s ease-out; font-size: 15px; }
.up-c-head { display: flex; align-items: flex-start; gap: 10px; }
.up-c-head > div { flex: 1; min-width: 0; }
.up-c-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex-shrink: 0; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.up-c-title { font-size: 18px; font-weight: 650; line-height: 1.3; }
.up-c-ver { font-size: 13px; color: var(--muted); margin-top: 2px; }
.up-c-x { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 2px; cursor: pointer; }
.up-c-list { margin: 12px 0 4px; padding-left: 20px; font-size: 15px; line-height: 1.5; } .up-c-list li { margin-bottom: 6px; }
.up-c-p { margin: 10px 0 4px; }
.up-c-all { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 14px; padding: 2px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.up-c-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.up-c-foot .btn { font-size: 15px; padding: 8px 16px; }
@media (max-width: 720px) { .up-card { left: 16px; right: 16px; width: auto; bottom: max(16px, env(safe-area-inset-bottom)); } }
.pl-top .tb-right { margin-left: auto; }

/* 0.11.1: clearer letter effects, hover explanations, demo */
:root[data-theme="dark"] { --strike: #fff; }
.ui-tip { position: fixed; z-index: 200; max-width: 280px; background: #26231f; color: #f4f1ea; border-radius: 8px; padding: 7px 10px; font: 12.5px/1.45 var(--ui); pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
:root[data-theme="dark"] .ui-tip { background: #f1eee7; color: #1c1b19; }
.tip-q { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--panel-2); color: var(--muted); font: 700 10px var(--ui); cursor: help; vertical-align: 1px; margin-left: 4px; text-transform: none; letter-spacing: 0; }
.tip-q:hover { background: var(--accent); color: var(--accent-text); }
.ty-try-head { display: flex; align-items: center; justify-content: space-between; }
.ty-pad:has(> p:only-child > br:only-child)::before { content: attr(data-ph); position: absolute; color: var(--faint); font-style: italic; pointer-events: none; margin-top: 4px; }
.ty-pad { position: relative; }
.ty-demo-ctl { display: flex; align-items: center; gap: 12px; } .ty-demo-ctl .check { font-size: 12.5px; color: var(--muted); margin: 0; }

/* sync & backups */
.sy-cur { display: flex; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.sy-cur > div { flex: 1; min-width: 0; }
.sy-cur b { font-weight: 650; }
.sy-ic { font-size: 22px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.sy-path { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sy-badge { font-style: normal; font-size: 11px; font-weight: 700; background: #3f9a5a; color: #fff; border-radius: 9px; padding: 1px 7px; margin-left: 6px; }
.sy-moves { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sy-note { color: var(--muted); font-size: 12.5px; margin: 8px 0 0 !important; }
.sy-list { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; margin: 8px 0; }
.sy-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.sy-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sy-row span { color: var(--muted); font-size: 12.5px; }
.sy-row.done { opacity: .6; }
.sy-warn { background: #fff4d6; color: #6b4d00; border: 1px solid #f0d58a; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.sy-warn .btn { margin-left: auto; }
:root[data-theme="dark"] .sy-warn { background: #3a3218; color: #f0dca0; border-color: #5c4d1f; }
.modal input[type=password] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); outline: none; }
.pv-hint { font-size: 12px; color: #8a5a00; margin-top: 6px; line-height: 1.4; } .pv-hint:empty { display: none; } :root[data-theme="dark"] .pv-hint { color: #e0b85a; }
.brand-wordmark { height: 36px; width: auto; display: block; color: var(--text); }
:root[data-theme="light"] .brand-wordmark { color: #1F2A3C; }
.brand .brand-slogan { margin-left: 2px; align-self: flex-end; margin-bottom: 3px; }
.pv-tstyle select { width: 100%; }
.pv-trow { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.pv-trow select { flex: 1; min-width: 0; }
.pv-trow .tb-btn { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); cursor: pointer; }
.pv-trow .tb-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* pictures in chapters */
.editor img.doc-img { max-width: 100%; height: auto; border-radius: 3px; cursor: pointer; vertical-align: bottom; }
.editor p.img-p, .editor p:has(> img.doc-img:only-child) { text-indent: 0 !important; margin: 10pt 0; }
.img-ring { position: fixed; z-index: 30; border: 2px solid var(--accent); border-radius: 5px; pointer-events: none; }
.img-bar { position: fixed; z-index: 31; display: flex; align-items: center; gap: 2px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 4px; box-shadow: var(--shadow); }
.img-bar button { min-width: 30px; height: 28px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--muted); font: 600 12.5px var(--ui); padding: 0 6px; display: grid; place-items: center; }
.img-bar button:hover { background: var(--panel-2); color: var(--text); }
.img-bar button.on { background: var(--accent-soft); color: var(--accent); }
.img-bar button svg { width: 15px; height: 15px; }
.img-bar span { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }

/* changes from another computer */
/* words changed on another device: a green that stands out on every theme and page colour (beta, 29 Oct: it followed
   the theme, not the page, and was faint on a grey or dark page; tests/web/changedgreen.py measures every pairing) */
::highlight(unwip-changed) { background-color: rgba(80, 190, 110, .45); }
:root[data-page-tone="dark"] ::highlight(unwip-changed) { background-color: rgba(60, 200, 110, .30); }
.chg-bar { display: flex; align-items: center; gap: 10px; margin: -30px -40px 24px; padding: 10px 14px; border-radius: 10px; background: #e6f4ea; color: #1f4d2c; font-size: 13px; }
:root[data-theme="dark"] .chg-bar { background: #1d3325; color: #bfe4ca; }
:root[data-theme="light"][data-page-tone="dark"] .chg-bar { background: #1d3325; color: #bfe4ca; }
:root[data-theme="dark"][data-page-tone="light"] .chg-bar { background: #e6f4ea; color: #1f4d2c; }
.chg-bar > div { flex: 1; display: flex; flex-direction: column; }
.chg-bar span:not(.chg-sw) { opacity: .8; font-size: 12px; }
.chg-sw { width: 14px; height: 14px; border-radius: 3px; background: rgba(120, 200, 140, .7); flex-shrink: 0; }
.tr-new { width: 7px; height: 7px; border-radius: 50%; background: #3f9a5a; margin-left: 4px; flex-shrink: 0; }
.sy-wait { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.sy-wait > div { display: flex; flex-direction: column; } .sy-wait span:not(.sy-spin) { color: var(--muted); font-size: 12.5px; }
.sy-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: sy-rot .8s linear infinite; flex-shrink: 0; }
@keyframes sy-rot { to { transform: rotate(360deg); } }
.lib-recent { margin: 0 0 22px; }
.lr-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.lr-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.lr-item { flex: 0 0 220px; text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; }
.lr-item:hover { border-color: var(--accent); }
.lr-item b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.lr-item span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal .m-foot { flex-wrap: wrap; } .modal .m-foot .btn { white-space: normal; }

/* map maker */
.mp-view { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.mp-top { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mp-title { font-size: 15px; } .mp-saved { color: var(--faint); font-size: 12px; } .mp-sp { flex: 1; }
.mp-top select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.mp-top .btn.on { background: var(--accent-soft); color: var(--accent); }
.mp-top .mp-end { margin-left: auto; }   /* Add to book and Done stay together on the right, even when the bar wraps */
.mp-body { flex: 1; display: flex; min-height: 0; }
.mp-tools { width: 54px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; }
.mp-tool { width: 40px; height: 36px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 19px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.mp-tool:hover { background: var(--panel-2); } .mp-tool.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.mp-brush { margin-top: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; } .mp-brush.dim { opacity: .6; }
.mp-brush input { writing-mode: vertical-lr; direction: rtl; width: 22px; height: 96px; }
.mp-brush-ic { font-size: 18px; line-height: 1; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.mp-brush-n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mp-tool svg { display: block; margin: auto; }
.mp-tabs { display: flex; gap: 4px; padding: 6px 14px 0; border-bottom: 1px solid var(--line); background: var(--bg); overflow-x: auto; }
.mp-tab { border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 5px 14px; background: var(--panel); color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; }
.mp-tab.on { background: var(--paper); color: var(--text); font-weight: 600; }
.mp-tab.add { border-style: dashed; background: none; }
.mp-stage { flex: 1; position: relative; overflow: hidden; }
.mp-stage canvas { position: absolute; inset: 0; touch-action: none; }
.mp-hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 12px; pointer-events: none; opacity: .8; }

/* ================================================================== WELCOME SETUP & TOUR */
#intro { position: fixed; inset: 0; z-index: 900; background: color-mix(in srgb, var(--bg) 82%, #000 18%); display: flex; align-items: center; justify-content: center; padding: 24px; animation: inFade .25s ease; overflow: auto; }
#intro.out { opacity: 0; transition: opacity .25s; }
@keyframes inFade { from { opacity: 0; } to { opacity: 1; } }
.in-card { background: var(--paper); color: var(--text); width: min(880px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; border-radius: 16px; box-shadow: 0 24px 80px rgba(0,0,0,.28); border: 1px solid var(--line); }
.in-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 0; }
.in-dots { display: flex; gap: 6px; }
.in-dots i { width: 22px; height: 4px; border-radius: 3px; background: var(--line); }
.in-dots i.done { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.in-dots i.on { background: var(--accent); }
.in-skip { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; }
.in-skip:hover { color: var(--text); text-decoration: underline; }
.in-body { padding: 14px 34px 8px; overflow: auto; }
.in-body h2 { font-size: 24px; margin: 6px 0 6px; font-weight: 650; }
.in-h3 { font-size: 15px; margin: 18px 0 8px; }
.in-lead { color: var(--muted); margin: 0 0 18px; font-size: 15px; line-height: 1.5; }
.in-slogan { margin: 8px 0 0; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
.in-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.in-grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .in-grid.three { grid-template-columns: 1fr; } }
.in-choice { text-align: left; background: var(--panel); border: 2px solid transparent; border-radius: 12px; padding: 12px 14px; cursor: pointer; color: var(--text); font: inherit; display: flex; flex-direction: column; gap: 3px; transition: border-color .15s, transform .15s; }
.in-choice:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.in-choice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.in-choice em { font-style: normal; font-size: 22px; }
.in-choice b { font-size: 15px; }
.in-choice span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.in-choice .in-like { color: var(--accent); font-weight: 600; font-size: 12.5px; }
.in-choice.tall { padding: 14px; }
.in-map { margin-top: 16px; background: color-mix(in srgb, var(--accent) 6%, var(--paper)); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.in-map h3 { margin: 0 0 8px; font-size: 14px; }
.in-map table { border-collapse: collapse; font-size: 13.5px; }
.in-map td { padding: 3px 8px 3px 0; vertical-align: top; }
.in-map td:first-child { font-weight: 600; white-space: nowrap; }
.in-map td:nth-child(2) { color: var(--faint); }
.in-map p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.in-mini { height: 92px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); display: flex; gap: 5px; padding: 7px; margin-bottom: 8px; }
.in-mini i { display: block; border-radius: 4px; }
.in-mini .b { width: 22%; background: var(--panel-2); }
.in-mini .p { flex: 1; background: var(--paper); border: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent 0 9px, var(--line) 9px 10px); background-size: 70% 100%; background-repeat: no-repeat; background-position: 50% 10px; }
.in-mini .p.wide { margin: 0 18%; }
.in-mini .c { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.in-mini .c s { background: #f6efd2; border-radius: 3px; border: 1px solid #e3d9b4; }
.in-mini .n { width: 18%; background: var(--panel-2); }
.in-mini.dark { background: #1b1c1f; border-color: var(--line); }   /* (the Insights chart once shared this class name and squashed these pictures flat) */
.in-mini.dark .p { background-color: #25262a; border-color: #25262a; background-image: repeating-linear-gradient(to bottom, transparent 0 9px, #3a3b40 9px 10px); }
.in-tree { margin: 0 0 8px; height: 104px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: 12px/1.45 var(--ui-font, system-ui); color: var(--muted); white-space: pre; overflow: hidden; }
.in-row { margin: 14px 0; }
.in-row > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--muted); }
.in-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.in-chip, .in-sw { background: var(--panel); border: 2px solid transparent; border-radius: 999px; padding: 6px 13px; cursor: pointer; color: var(--text); font-size: 14px; }
.in-chips.big .in-chip { font-size: 15px; padding: 9px 16px; }
.in-chip.on, .in-sw.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.in-sw { display: inline-flex; align-items: center; gap: 7px; font-family: inherit; padding-left: 6px; }
.in-sw i { width: 22px; height: 22px; border-radius: 50%; position: relative; overflow: hidden; border: 1px solid rgba(0,0,0,.15); }
.in-sw s { position: absolute; right: 0; top: 0; bottom: 0; width: 50%; }
.in-sw u { position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px; border-radius: 50%; }
.in-sample { margin-top: 10px; background: var(--page-bg, var(--paper)); color: var(--page-ink, var(--text)); border: 1px solid var(--line); border-radius: 8px; padding: 16px 26px; font-size: 16px; line-height: 1.6; }
.in-sample p { margin: 0; }
.in-sample.book p + p { text-indent: 2em; }
.in-sample.blocks p + p { margin-top: .7em; }
.in-input { width: min(360px, 100%); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--text); font: inherit; }
.in-summary { list-style: none; padding: 0; margin: 4px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 14px; }
.in-summary b { color: var(--muted); font-weight: 600; margin-right: 6px; }
.in-foot { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px 18px; border-top: 1px solid var(--line); margin-top: 10px; }
.in-end { display: flex; gap: 8px; }
.in-foot .btn[disabled] { opacity: .45; pointer-events: none; }

.tour-spot { position: fixed; z-index: 950; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(10,10,14,.55), 0 0 0 3px var(--accent); pointer-events: none; transition: all .3s ease; }
.tour-card { position: fixed; z-index: 951; width: 320px; background: var(--paper); color: var(--text); border-radius: 12px; padding: 14px 16px 12px; box-shadow: 0 14px 40px rgba(0,0,0,.3); border: 1px solid var(--line); transition: left .3s ease, top .3s ease; }
.tour-card h3 { margin: 2px 0 6px; font-size: 16px; }
.tour-card p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.5; color: var(--text); }
.tour-card .tour-alt { color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); padding: 6px 9px; border-radius: 7px; font-size: 13px; }
.tour-n { font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.tour-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.tour-foot span { flex: 1; }
.in-choice > .in-mini, .in-choice > .in-tree { align-self: stretch; width: 100%; box-sizing: border-box; }
.in-mini i { height: auto; }

/* ================================================================== BOOK IMPORT */
#bi { position: fixed; inset: 0; z-index: 920; background: rgba(10,10,14,.45); display: flex; align-items: center; justify-content: center; padding: 24px; }
.bi-card { background: var(--paper); color: var(--text); width: min(860px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; border-radius: 14px; box-shadow: 0 24px 80px rgba(0,0,0,.3); border: 1px solid var(--line); }
.bi-card.small { width: min(620px, 100%); }
.bi-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px 4px; }
.bi-head h2 { margin: 0; font-size: 20px; }
.bi-body { padding: 6px 22px 10px; overflow: auto; display: flex; flex-direction: column; min-height: 0; }
.bi-found { margin: 4px 0 12px; font-size: 14.5px; }
.bi-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bi-row label { font-weight: 600; font-size: 13.5px; }
.bi-row select { padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--paper); color: var(--text); font: inherit; }
.bi-check, .bi-radio { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 4px 0; }
.bi-warn { background: color-mix(in srgb, #d39b2a 14%, var(--paper)); border: 1px solid color-mix(in srgb, #d39b2a 40%, var(--line)); border-radius: 9px; padding: 6px 12px; margin: 8px 0; font-size: 13px; }
.bi-warn p { margin: 4px 0; }
.bi-list-head { font-size: 12.5px; color: var(--muted); margin: 10px 0 6px; }
.bi-list { border: 1px solid var(--line); border-radius: 9px; overflow: auto; max-height: 42vh; min-height: 120px; }
.bi-item { display: grid; grid-template-columns: 22px minmax(140px, 260px) 64px 1fr; gap: 8px; align-items: center; padding: 5px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.bi-item:last-child { border-bottom: 0; }
.bi-item.part { background: color-mix(in srgb, var(--accent) 7%, transparent); font-weight: 600; }
.bi-item.off { opacity: .5; }
.bi-item.off .bi-title { text-decoration: line-through; }
.bi-title { border: 1px solid transparent; background: transparent; color: var(--text); font: inherit; padding: 3px 5px; border-radius: 5px; min-width: 0; }
.bi-title:hover, .bi-title:focus { border-color: var(--line); background: var(--paper); }
.bi-words { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.bi-snip { color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bi-tidy-h { margin: -2px 0 6px 24px; }
.bi-extra { margin-top: 12px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.bi-extra > .bi-small { line-height: 1.4; }
.bi-extra-row { display: flex; align-items: center; gap: 8px; width: 100%; background: color-mix(in srgb, var(--accent) 8%, var(--paper)); border-radius: 8px; padding: 6px 10px; box-sizing: border-box; font-size: 13.5px; }
.bi-extra-row > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bi-dest { margin-top: 12px; }
.bi-dest input[type=text], #bi-ptitle { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--text); font: inherit; width: 260px; }
.bi-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 22px 16px; border-top: 1px solid var(--line); }
.bi-tip, .bi-small { color: var(--muted); font-size: 12.5px; }
.bi-steps { margin: 4px 0 12px; padding-left: 20px; line-height: 1.8; font-size: 14px; }
.bi-steps kbd { background: var(--panel); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font: 12px var(--ui-font, system-ui); }
.bi-paste { min-height: 140px; border: 2px dashed var(--line); border-radius: 10px; padding: 14px; outline: none; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.bi-paste:empty::before { content: attr(data-ph); color: var(--faint); font-size: 18px; }
.bi-paste:focus { border-color: var(--accent); }
.bi-pasted { color: var(--text); font-size: 15px; display: flex; align-items: center; gap: 12px; }
.pv-fontrow { display: flex; gap: 6px; align-items: center; }
.pv-fontrow select { flex: 1; min-width: 0; }
.pv-fav { font-size: 16px; color: #d39b2a; min-width: 32px; }
.pv-dim { opacity: .45; }

/* ================================================================== BOOK DESIGN (paperback preview) */
.pv-themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pv-theme { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--text); cursor: pointer; }
.pv-theme:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pv-theme.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--paper)); }
.pv-th-a { font-size: 22px; line-height: 1.1; }
.pv-th-n { font-size: 11.5px; color: var(--muted); }
.pv-checks { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 8px; }
.pv-chk { font-size: 13px; }
.bm-grid textarea { width: 100%; resize: vertical; font: inherit; }
.bm-toggles { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; align-items: center; font-size: 13px; }
.bm-toggles b { width: 100%; }
#pv-flow .tsx-page { box-shadow: none; }
.bm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.bm-grid .field { margin: 0; }
.bm-grid .field.full { grid-column: 1 / -1; }
.bm-grid input, .bm-grid textarea { width: 100%; box-sizing: border-box; }

/* toolbar overflow on narrow windows */
.toolbar.tight { justify-content: flex-start; }
.toolbar.tight .tb-sep { display: none; }
/* short of room (an iPad, a narrow window): the font and paragraph boxes get narrower before any tool is tucked away,
   so B, I and U stay on the bar (beta, 27 Oct). The whole name shows when you open the box. */
.toolbar.tight .sel-font { width: 112px; }
.toolbar.tight #sel-block { width: 86px; }
/* an iPad with a keyboard attached shows its own floating bar at the bottom while you type and doesn't tell the page:
   the page ends above it (mobile.js m-padbar), so the bottom row and the last lines aren't hidden (beta, 27 Oct) */
html.m-padbar #workspace { bottom: var(--pad-kb, 76px); }
.tb-more { font-size: 18px; letter-spacing: 1px; flex-shrink: 0; }
.tb-pop { position: fixed; z-index: 700; display: flex; flex-wrap: wrap; gap: 3px; max-width: 320px; padding: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.18); }
.tb-pop select { height: 30px; border: 1px solid var(--line); background: var(--paper); color: var(--text); border-radius: 6px; padding: 0 6px; }
/* smaller windows: shorter labels on the right-hand buttons */
@media (max-width: 1250px) { .tb-left { min-width: 120px; } }
@media (max-width: 900px) { .tb-left { min-width: 72px; max-width: 160px; } .tb-left .project-title { min-width: 0; } }   /* iPad portrait: the left-panel button takes its room from the book title */
@media (max-width: 1080px) { #btn-stuck .tb-label { display: none; } .tb-right { gap: 2px; } }

/* ================================================================== + NEW, TEMPLATES, HELP */
.bf-sp { flex: 1; }
.help-btn { font-weight: 700; font-size: 15px; font-family: Georgia, serif; }
.new-btn { background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 6px 14px 6px 10px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.new-btn:hover { filter: brightness(1.08); }
.new-plus { font-size: 20px; line-height: 0.8; font-weight: 400; }
.new-pop { position: fixed; z-index: 750; display: flex; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 44px rgba(0,0,0,.22); overflow: hidden; width: min(560px, calc(100vw - 16px)); }
.np-list { width: 300px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.np-item { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; }
.np-item.on { background: color-mix(in srgb, var(--accent) 10%, var(--paper)); }
.np-ic { font-size: 20px; width: 26px; text-align: center; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.np-t { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.np-t b { font-size: 13.5px; } .np-t small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.np-item kbd { font-size: 10.5px; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.np-prev { flex: 1; background: var(--panel); border-left: 1px solid var(--line); display: grid; place-items: center; padding: 14px; min-height: 230px; contain: size; overflow: hidden; }   /* its size never moves the list */
.np-page { width: 120px; height: 160px; background: #fffefb; border-radius: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.15); padding: 16px 12px; display: flex; flex-direction: column; gap: 7px; }
.np-page i { display: block; height: 3px; background: #d8d4cc; border-radius: 2px; } .np-page i.s { width: 60%; }
.np-tree { font-size: 12.5px; line-height: 1.9; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.np-tree .in { padding-left: 16px; }
.np-map { width: 190px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.sp-sheet { width: 190px; background: #fffefb; color: #2a2620; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.15); padding: 12px 14px; font: 11px/1.45 Georgia, serif; }
.sp-h { font-size: 14px; font-weight: 700; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.sp-f { display: flex; gap: 6px; align-items: baseline; } .sp-f i { flex: 1; border-bottom: 1px dotted #bbb; }
.sp-s { font-weight: 700; margin-top: 7px; font-size: 11.5px; } .sp-l { height: 3px; width: 80%; background: #e2ded6; border-radius: 2px; margin-top: 4px; }
.tg-cols { display: flex; gap: 14px; margin-top: 10px; height: min(380px, 60vh); }   /* fixed, so the dialog never jumps as the preview changes */
.tg-list { width: 240px; max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.tg-item { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; display: flex; gap: 8px; align-items: center; }
.tg-item.on { background: color-mix(in srgb, var(--accent) 12%, var(--paper)); font-weight: 600; }
.tg-item small { color: var(--yes, #2f7a5b); }
.tg-ic { font-size: 18px; width: 24px; text-align: center; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.tg-prev { flex: 1; background: var(--panel); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 10px; padding: 16px; overflow: auto; }
.tg-prev .sp-sheet { width: 240px; font-size: 12px; }
.tg-cap { color: var(--muted); font-size: 12.5px; }
.help-back { position: fixed; inset: 0; z-index: 880; background: rgba(10,10,14,.4); display: flex; align-items: center; justify-content: center; padding: 24px; }
.help { width: min(980px, 100%); height: min(720px, 100%); background: var(--paper); color: var(--text); border-radius: 14px; box-shadow: 0 24px 80px rgba(0,0,0,.3); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); }
.help-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.help-head h2 { margin: 0; font-size: 20px; }
.help-head input { flex: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--text); font: inherit; }
.help-body { flex: 1; display: flex; min-height: 0; }
.help-nav { width: 200px; border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); overflow: auto; }
.help-nav a { color: var(--text); text-decoration: none; padding: 6px 8px; border-radius: 6px; font-size: 13.5px; }
.help-nav a:hover { background: var(--panel-2); }
.help-acts { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 12px; }
.help-main { flex: 1; overflow: auto; padding: 8px 24px 30px; }
.help-main h3 { font-size: 16px; margin: 20px 0 8px; position: sticky; top: 0; background: var(--paper); padding: 6px 0; }
.help-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.help-item b { font-size: 14px; } .help-item p { margin: 3px 0 4px; color: var(--text); font-size: 13.5px; line-height: 1.5; }
.help-where { font-size: 12px; color: var(--accent); }
.help-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px 24px; }
.hk-group h4 { margin: 6px 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hk { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.hk kbd { background: var(--panel); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font: 12px var(--ui-font, system-ui); white-space: nowrap; }
.help-none { color: var(--muted); padding: 30px 0; }
/* template sections: icon, live preview, your own templates */
.cs-cols { display: grid; grid-template-columns: 1fr 260px; gap: 18px; align-items: start; }
.cs-row { display: flex; gap: 8px; }
.cs-row input { flex: 1; }
.cs-icon { width: 40px; min-width: 40px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 20px; display: grid; place-items: center; cursor: pointer; }
.cs-icon:hover { border-color: var(--accent); }
.cs-icon svg { width: 20px; height: 20px; }
.cs-prev .sp-sheet { transform: none; }
.sp-ic svg { width: 14px; height: 14px; vertical-align: -2px; }
.tg-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.tg-item { position: relative; }
.tg-ic svg { width: 16px; height: 16px; vertical-align: -3px; }
.tg-del { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); opacity: 0; font-size: 12px; color: var(--muted); padding: 2px 5px; border-radius: 4px; }
.tg-item:hover .tg-del { opacity: 1; }
.tg-del:hover { background: rgba(200, 40, 40, .12); color: #b42318; }
.form-grid .check.full { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; font-size: 13px; }
@media (max-width: 760px) { .cs-cols { grid-template-columns: 1fr; } }
/* toolbar colours: Stuck is a soft red, Revise a soft purple (like Sprint's amber and Copy for Docs' blue) */
.btn.stuck-top { font-weight: 600; border-color: transparent; background: rgba(214, 69, 65, .12); color: #b3322e; }
.btn.stuck-top:hover { background: rgba(214, 69, 65, .2); border-color: transparent; }
.btn.stuck-top svg { color: inherit; }
:root[data-theme="dark"] .btn.stuck-top { background: rgba(240, 110, 100, .15); color: #f19a92; }
#btn-revise { font-weight: 600; border-color: transparent; background: rgba(124, 58, 237, .11); color: #6d28d9; }
#btn-revise:hover { background: rgba(124, 58, 237, .18); border-color: transparent; }
#btn-revise.on { background: #7c3aed; color: #fff; }
:root[data-theme="dark"] #btn-revise { background: rgba(167, 139, 250, .16); color: #c4b5fd; }
.rp-level { margin: 4px 0 8px; }
.rp-level button.on { color: #6d28d9; }
:root[data-theme="dark"] .rp-level button.on { color: #c4b5fd; }
/* Continue: back to where you last wrote */
.continue-card { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 18px; row-gap: 4px; align-items: center; text-align: left;
  padding: 16px 20px; border-radius: 14px; border: 1px solid transparent; background: var(--accent-soft); color: var(--text); cursor: pointer; font: inherit; }
.continue-card:hover { border-color: var(--accent); }
.continue-card .cc-go { grid-row: 1 / 3; background: var(--accent); color: #fff; font-weight: 700; font-size: 16px; padding: 12px 20px; border-radius: 10px; }
.continue-card .cc-where { font-size: 14px; }
.continue-card .cc-where small { color: var(--muted); margin-left: 6px; }
.continue-card .cc-snip { font-family: var(--serif, Georgia, serif); color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-card .cc-caret { display: inline-block; width: 2px; height: 1em; background: var(--accent); vertical-align: -2px; margin-left: 2px; animation: rpblink .9s infinite alternate; }
@media (max-width: 600px) { .continue-card { grid-template-columns: 1fr; } .continue-card .cc-go { grid-row: auto; text-align: center; } }

/* ================= PHONE & TABLET ================= */
.m-bhead, .m-phead, .m-pfoot, .m-fbar, .m-shade, .m-escape { display: none; }
.m-escape.show { display: grid; place-items: center; position: fixed; z-index: 2000; top: calc(env(safe-area-inset-top) + 10px); right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--text); box-shadow: 0 4px 16px rgba(0,0,0,.25); cursor: pointer; }
/* touch screens: bigger targets, and hover-only buttons always visible */
@media (pointer: coarse) {
  body.writer .writer-exit { opacity: 1; }
  .ck-open, .ol-open, .ck-card .ck-tools, .ol-row .ol-open { opacity: 1 !important; visibility: visible !important; }
  .tree-row { min-height: 40px; }
  .tree-row .tr-add { opacity: 1; }
  .tb-btn, .icon-btn { min-width: 36px; min-height: 36px; }
  .rp-cat { padding: 10px 8px; }
}
html.web body { overscroll-behavior: none; }
html.web .topbar { padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
html.web .statusbar { padding-bottom: env(safe-area-inset-bottom); height: calc(30px + env(safe-area-inset-bottom)); }

/* ---------- phone: three screens (chapters → page → typing) ---------- */
@media (max-width: 720px) {
  #workspace .topbar, #workspace .statusbar { display: none !important; }
  .m-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; background: transparent; color: var(--text); border-radius: 10px; cursor: pointer; }
  .m-icon:disabled { opacity: .3; }
  .m-icon:active { background: var(--panel-2); }

  /* screen 1: chapters */
  html.m-view-binder .binder { position: fixed; inset: 0; z-index: 40; width: auto; border: 0; background: var(--bg); padding-top: env(safe-area-inset-top); }
  html.m-view-binder .editor-wrap, html.m-view-binder .m-pfoot, html.m-view-binder .m-phead { display: none !important; }
  .m-bhead { display: flex; align-items: center; gap: 4px; padding: 6px 8px 2px; }
  .m-btitle { flex: 1; min-width: 0; font-weight: 700; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 2px; }
  .m-link { border: 0; background: var(--accent-soft); color: var(--accent); font: inherit; font-weight: 600; font-size: 14px; padding: 7px 12px; border-radius: 99px; cursor: pointer; max-width: 50vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.m-view-binder .binder-head { padding: 6px 14px 8px; }
  html.m-view-binder #binder-tree { padding: 0 6px; }
  html.m-view-binder .tree-row { min-height: 50px; font-size: 17px; border-bottom: 1px solid var(--line); border-radius: 0; }
  html.m-view-binder .tree-row.root { min-height: 44px; font-size: 13px; border-bottom: 0; margin-top: 10px; }
  html.m-view-binder .tree-row.selected { background: transparent; }
  html.m-view-binder .tree-row .tr-count { font-size: 13px; }
  html.m-view-binder .binder-foot { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); }
  html.m-view-binder .binder-foot .icon-btn, html.m-view-binder .binder-foot .btn { min-height: 42px; }

  /* screen 2: the page */
  html.m-view-page .binder { display: none; }
  .m-phead { display: block; position: relative; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); flex-shrink: 0; }
  .m-read, .m-edit { display: flex; align-items: center; gap: 2px; height: 52px; padding: 0 6px; }
  .m-edit { display: none; }
  .m-back { display: inline-flex; align-items: center; gap: 0; border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 16px; padding: 0 6px 0 0; height: 42px; cursor: pointer; max-width: 30vw; }
  .m-back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-ptitle { flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-pfoot { display: flex; align-items: center; gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); flex-shrink: 0; }
  .m-tab { border: 0; border-radius: 99px; font: inherit; font-weight: 600; font-size: 14px; padding: 9px 13px; cursor: pointer; white-space: nowrap; }
  .m-tab.revise, .m-tab.stuck { background: transparent; color: var(--text); font-weight: 500; }
  .m-tab.revise.on { background: rgba(124, 58, 237, .13); color: #6d28d9; font-weight: 600; }
  :root[data-theme="dark"] .m-tab.revise.on { background: rgba(167, 139, 250, .18); color: #c4b5fd; }
  .m-tab.stuck.nudge { background: rgba(13, 148, 136, .13); color: #0f766e; }
  :root[data-theme="dark"] .m-tab.stuck.nudge { background: rgba(45, 212, 191, .16); color: #5eead4; }
  .m-tab.sprint { background: rgba(224, 162, 0, .16); color: #8a6200; }
  .m-tab.sprint.on { background: var(--sprint); color: #2a1f00; font-variant-numeric: tabular-nums; }
  :root[data-theme="dark"] .m-tab.sprint { color: var(--sprint); background: rgba(242, 193, 78, .14); }
  .m-pfoot .m-icon:first-of-type { margin-left: auto; }
  .page { width: 100%; margin: 0 0 40vh; padding: 18px 20px 60px; border-radius: 0; box-shadow: none; min-height: calc(100vh - 140px); }
  .page .page-snap { display: none; }
  .editor-wrap { -webkit-overflow-scrolling: touch; background: var(--page-bg, var(--paper)); }

  /* screen 3: typing */
  html.m-editing .m-read { display: none; }
  html.m-editing .m-edit { display: flex; }
  html.m-editing .m-pfoot { display: none; }
  .m-wc { flex: 1; text-align: center; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
  .m-done { border: 0; background: transparent; color: var(--accent); font: inherit; font-weight: 700; font-size: 17px; padding: 0 8px; height: 42px; cursor: pointer; }
  .m-fbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; align-items: center; gap: 4px; padding: 6px 8px; overflow-x: auto; background: var(--panel); border-top: 1px solid var(--line); scrollbar-width: none; }
  html.m-editing .m-fbar { display: flex; }
  html.m-editing .page { margin-bottom: calc(var(--m-kb, 0px) + 60px); }
  .m-fbar button { flex-shrink: 0; min-width: 40px; height: 38px; border: 1px solid var(--line); background: var(--paper); color: var(--text); border-radius: 8px; font-size: 16px; font-family: Georgia, serif; display: inline-grid; place-items: center; cursor: pointer; }
  .m-fbar button.m-fwide { padding: 0 10px; font-family: var(--ui); font-size: 14px; }
  .m-fbar button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
  .m-fsep { width: 1px; height: 26px; background: var(--line); flex-shrink: 0; margin: 0 2px; }
  .m-fsheet { position: fixed; left: 0; right: 0; bottom: calc(var(--m-kb, 0px) + 51px); z-index: 71; background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.18); display: flex; flex-direction: column; max-height: min(46vh, 340px); }
  .m-fsheet[hidden] { display: none; }
  html:not(.m-editing) .m-fsheet { display: none; }
  .m-fs-size { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-family: var(--ui); font-size: 14px; color: var(--muted); }
  .m-fs-size b { min-width: 56px; text-align: center; color: var(--text); font-weight: 600; }
  .m-fs-size button { height: 34px; min-width: 44px; border: 1px solid var(--line); background: var(--paper); color: var(--text); border-radius: 8px; font-size: 15px; }
  .m-fs-size .m-fs-done { margin-left: auto; border: 0; background: transparent; color: var(--accent); font-weight: 600; }
  .m-fs-align { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-family: var(--ui); font-size: 14px; color: var(--muted); }
  .m-fs-align span { min-width: 34px; }
  .m-fs-align button { flex: 1; height: 34px; border: 1px solid var(--line); background: var(--paper); color: var(--text); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
  .m-fs-align button svg { width: 18px; height: 18px; }
  .m-fs-align button.on { border-color: var(--accent); color: var(--accent); }
  .m-fs-list { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px 0 8px; }
  .m-fs-list button { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); padding: 11px 16px; font-size: 19px; }
  .m-fs-list button.on { background: var(--accent-soft); color: var(--accent); }
  .m-fs-group { padding: 12px 16px 4px; font-family: var(--ui); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  .m-fs-list button span { font-family: var(--ui); font-size: 15px; }

  /* side panels (Revise, comments) slide over the page */
  /* side panels (Revise, comments, snapshots) are a sheet over the bottom half, so the chapter and its highlights
     stay in view above it. The page gets room at the bottom so every line can still be scrolled above the sheet. */
  .revise-panel:not(.pl-side) { position: fixed; z-index: 90; left: 0; right: 0; top: auto; bottom: 0; width: auto !important; height: 46vh; height: 46dvh; padding-top: 0; padding-bottom: env(safe-area-inset-bottom); border-radius: 16px 16px 0 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 40px rgba(0,0,0,.22); }
  .revise-panel:not(.pl-side)::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 7px auto 0; flex: none; }
  html.m-panel-open .m-shade { opacity: 0 !important; pointer-events: none !important; }
  html.m-panel-open #editor-wrap { padding-bottom: 48vh; padding-bottom: 48dvh; }
  html.m-panel-open .writer-quote, body:not(.writer) .writer-quote { display: none; }
  .m-shade { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(20, 16, 10, .32); opacity: 0; pointer-events: none; transition: opacity .2s; }
  html.m-panel-open .m-shade { opacity: 1; pointer-events: auto; }
  .findbar { top: calc(env(safe-area-inset-top) + 56px) !important; left: 8px; right: 8px; }
  .findbar input { flex: 1; min-width: 0; width: auto; font-size: 16px; }

  /* writer mode: just the words (the floating ✕ leaves it) */
  body.writer .m-phead, body.writer .m-pfoot, body.writer .writer-exit { display: none !important; }
  body.writer .page { margin-top: calc(env(safe-area-inset-top) + 40px); }
  .pv-head #pv-close, .help-head #help-x { visibility: hidden; }

  /* preview & export: one column, tabs scroll sideways */
  .pv-back { padding: 0; }
  .pv { border-radius: 0; padding-top: env(safe-area-inset-top); }
  .pv-head { gap: 6px; padding: 8px 60px 8px 10px; }
  .pv-title { display: none; }
  .pv-tabs { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; min-width: 0; }
  .pv-tabs button { flex-shrink: 0; white-space: nowrap; }
  .pv-body { flex-direction: column; overflow: auto; }
  .pv-side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .pv-stage { min-height: 70vh; overflow: hidden; }
  /* full-screen helpers: leave room for the floating ✕ */
  .help-head, .mp-top { padding-right: 62px !important; padding-top: calc(env(safe-area-inset-top) + 8px) !important; }
  .help-back, #bi, #intro { padding: 0 !important; }
  .help, #bi > div { width: 100% !important; height: 100% !important; max-height: none !important; border-radius: 0 !important; }
  /* Outline / Corkboard / Moodboard / Timeline open as their own screen */
  html.m-view-binder .plan-nav { margin: 0 12px 6px; }
  html.m-plan .m-pfoot, html.m-plan #m-prev, html.m-plan #m-next { display: none !important; }
  .outline-view { margin: 12px 0 60px; padding: 0 12px; }
  .ol-row { grid-template-columns: 26px 1fr 1fr 60px; grid-template-areas: "no title title num" ". syn syn syn" ". pov status status"; gap: 4px 8px; }
  .ol-row.ol-th { display: none; }
  .ol-row > span { min-width: 0; }
  .ol-syn { min-height: 2.6em; height: auto !important; overflow: auto; field-sizing: content; }
  .ol-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .ol-row > :nth-child(1) { grid-area: no; } .ol-row > :nth-child(2) { grid-area: title; } .ol-row > :nth-child(3) { grid-area: syn; }
  .ol-row > :nth-child(4) { grid-area: pov; } .ol-row > :nth-child(5) { grid-area: status; } .ol-row > :nth-child(6) { grid-area: num; }
  .cork-view { padding: 14px 12px 60px; }
  .timeline-view { padding: 12px; }
  .modal .m-foot { position: sticky; bottom: 0; background: var(--paper); flex-wrap: wrap; }

  /* main screen */
  .lib-head { flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
  .lib-total { font-size: 12px; }
  .lib-body { padding: 14px; }
  .lib-row { flex-wrap: wrap; gap: 10px; }
  .lib-actions { flex-wrap: wrap; }
  .dash { grid-template-columns: 1fr; }
  .dash-card.dials { flex-wrap: wrap; justify-content: center; }
  /* dialogs use the whole width */
  .modal { width: calc(100vw - 16px) !important; max-width: none !important; max-height: calc(100vh - 24px); }
  .new-pop { left: 8px !important; right: 8px; width: auto !important; }
  .new-pop .np-prev { display: none; }
  .tg-cols, .cs-cols { grid-template-columns: 1fr !important; }
  /* the list on top, and what the picked one looks like underneath (side by side doesn't fit a phone) */
  .tg-cols { flex-direction: column; height: auto; gap: 10px; }
  .tg-list { width: auto; max-height: 34vh; max-height: 34dvh; }
  .tg-prev { flex: none; max-height: 38vh; max-height: 38dvh; justify-content: flex-start; padding: 10px; }
  .tg-prev .sp-sheet { width: 100%; max-width: 280px; }
  /* Help: the sections become a strip to swipe along under the search box */
  .help-body { flex-direction: column; }
  .help-nav { width: auto; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; gap: 6px; flex: none; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .help-nav::-webkit-scrollbar { display: none; }
  .help-nav a { white-space: nowrap; flex: none; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
  .help-nav .help-acts { display: none; }
  .help-main { padding: 6px 16px 30px; }
  .help-head input { min-width: 0; }
}
.help-main { min-width: 0; overflow-wrap: anywhere; }
.help-main table { display: block; max-width: 100%; overflow-x: auto; }

/* ================= CALMER TOP BAR (0.24) ================= */
.tb-tucked, .tb-tucked[hidden] { display: none !important; }
.tb-detailed { display: none; }
body.detailed .tb-detailed { display: inline-grid; }
body.detailed span.tb-detailed { display: inline-block; }
.tb-cmdk { margin-left: 6px; background: var(--panel-2); }
.tb-cmdk:hover { background: var(--line); }
.export-split { display: inline-flex; align-items: stretch; border-radius: 8px; overflow: hidden; background: var(--accent); }
.export-split .btn { border: 0; border-radius: 0; background: transparent; color: var(--accent-text); font-weight: 600; }
.export-split .btn:hover { background: rgba(0,0,0,.12); }
#btn-export-more { padding: 0 7px; border-left: 1px solid rgba(255,255,255,.3); display: inline-grid; place-items: center; }
#btn-export-more svg { width: 15px; height: 15px; }
#btn-panel.on { background: var(--accent-soft); color: var(--accent); }
.export-pop { position: fixed; z-index: 700; width: 360px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.18); padding: 6px; }
.export-pop hr { border: 0; height: 1px; background: var(--line); margin: 4px 8px; }
.ex-item { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); padding: 10px 12px; border-radius: 9px; cursor: pointer; font: inherit; }
.ex-item:hover, .ex-item:focus-visible { background: var(--accent-soft); outline: none; }
.ex-ic { color: var(--muted); margin-top: 1px; }
.ex-item:first-child .ex-ic { color: var(--accent); }
.ex-t { flex: 1; min-width: 0; }
.ex-t b { font-weight: 600; font-size: 14px; display: block; }
.ex-t small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ex-item kbd, .cmdk kbd { font: 11px var(--ui); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--bg); white-space: nowrap; }
.ex-note { margin: 4px 12px 8px; color: var(--muted); font-size: 12.5px; }

/* Find anything (Ctrl+K) */
.cmdk-back { position: fixed; inset: 0; z-index: 870; background: rgba(20, 18, 14, .32); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; animation: fade .1s ease-out; overscroll-behavior: contain; }
/* fitted to the part of the screen you can see (an iPad's keyboard or its bar doesn't shrink the page: --vv-h, mobile.js) */
.cmdk { width: min(600px, calc(100vw - 32px)); background: var(--paper); border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.3); overflow: hidden; display: flex; flex-direction: column; max-height: min(70vh, calc(var(--vv-h, 100vh) * .86 - 12vh)); }
.cmdk-in { flex: none; display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-in svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.cmdk-in input { flex: 1; border: 0; outline: none; background: transparent; font: 17px var(--ui); color: var(--text); }
.cmdk-list { overflow: auto; padding: 6px; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }   /* a swipe scrolls the list, never the page behind */
.cmdk-grp { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 10px 12px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 6px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: 14px var(--ui); text-align: left; cursor: pointer; }
.cmdk-item.on { background: var(--accent-soft); }
.cmdk-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; color: var(--muted); }
.cmdk-item.on .cmdk-ic svg { color: var(--accent); }
.cmdk-t { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.cmdk-t b { font-weight: 500; white-space: nowrap; }
.cmdk-t small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-none { padding: 18px; color: var(--muted); margin: 0; }
.cmdk-foot { flex: none; display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--bg); font-size: 12px; color: var(--muted); }
.cmdk-try { margin-left: auto; }
@media (max-width: 720px) { .cmdk-try { display: none; } .cmdk-back { padding-top: calc(env(safe-area-inset-top) + 20px); } }

/* ================= SIDE PANEL TABS ================= */
.side-tabs { display: flex; align-items: center; gap: 2px; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.side-tab { height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 13px var(--ui); cursor: pointer; white-space: nowrap; }
.side-tab:hover { color: var(--text); background: var(--panel-2); }
.side-tab.on { background: var(--paper); color: var(--accent); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.side-tab.t-revise.on { color: #6d28d9; }
:root[data-theme="dark"] .side-tab.t-revise.on { color: #c4b5fd; }
.side-n { color: var(--faint); font-size: 11px; font-weight: 400; }
.side-x { margin-left: auto; }
#revise-panel .rp-title > :not(.rp-checked), #revise-panel .rp-title { font-size: 0; }
#revise-panel .rp-title .rp-checked { font-size: 12px; }
#rp-close, #notes-panel .rp-head { display: none !important; }
#revise-panel .rp-head { padding-top: 6px; padding-bottom: 6px; }
.side-body { padding: 12px 14px 30px; display: flex; flex-direction: column; gap: 12px; }
.side-lead { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.side-lead b { color: var(--text); font-weight: 600; }
.side-note { margin: 0; color: var(--faint); font-size: 12px; line-height: 1.5; }
.side-empty { margin: 4px 0; color: var(--muted); font-size: 13px; }
.side-snaptake { display: flex; gap: 6px; }
.side-snaptake input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--text); font: 13px var(--ui); }
.side-snaps { display: flex; flex-direction: column; gap: 4px; }
.side-snap { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 9px; padding: 8px 10px; cursor: pointer; color: var(--text); font: 13px var(--ui); }
.side-snap:hover { border-color: var(--accent); }
.side-snap span { color: var(--muted); font-size: 12px; }
#style-panel .form-grid { grid-template-columns: 1fr 1fr; gap: 10px 10px; }
#style-panel .form-grid .field.full, #style-panel .form-grid .section-label, #style-panel .form-grid .check { grid-column: 1 / -1; }
#style-panel .section-label { margin-top: 6px; }
.side-foot { display: flex; justify-content: flex-end; }
.revise-panel { display: flex; flex-direction: column; }

/* ================= SELECTION BAR ================= */
.selbar { position: fixed; z-index: 640; display: flex; align-items: center; gap: 2px; padding: 4px; background: #25231f; color: #e7e4dd; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.28); animation: fade .12s ease-out; }
:root[data-theme="dark"] .selbar { background: #3a3b41; }
.selbar.hidden { display: none; }
.selbar .sb-group { display: contents; }
body.writer .selbar .sb-full { display: none; }
.sb-btn { min-width: 32px; height: 32px; padding: 0 7px; border: 0; border-radius: 7px; background: transparent; color: inherit; font: 15px Georgia, serif; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.sb-btn.wide { font: 13px var(--ui); padding: 0 9px; }
.sb-btn svg { width: 17px; height: 17px; }
.sb-btn:hover { background: rgba(255,255,255,.12); }
.sb-btn.on { background: rgba(255,255,255,.2); }
.sb-sep { width: 1px; height: 20px; background: rgba(255,255,255,.18); margin: 0 2px; }
.tb-more[hidden] { display: none !important; }
/* side panel sizing */
.side-tabs { gap: 0; padding: 8px 6px 6px 8px; }
.side-tab { padding: 0 8px; font-size: 12.5px; }
#style-panel .form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
#style-panel .field { min-width: 0; }
#style-panel select, #style-panel input[type=number], #style-panel input[type=text] { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
#style-panel .side-body { overflow-x: hidden; }

/* ---- Style panel and dialogs: form controls that match the rest of the app (not plain Windows boxes) */
#style-panel select, .modal select {
  -webkit-appearance: none; appearance: none; height: 32px; padding: 0 28px 0 10px;
  border: 1px solid var(--line); border-radius: 7px; background-color: var(--paper); color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; cursor: pointer;
  text-overflow: ellipsis; white-space: nowrap; transition: border-color .12s, box-shadow .12s;
}
#style-panel input[type=number], #style-panel input[type=text] {
  height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--text); outline: none;
}
#style-panel select:hover, #style-panel input:hover, .modal select:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
#style-panel select:focus, #style-panel input:focus, .modal select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); outline: none; }
#style-panel input[type=number]::-webkit-inner-spin-button { opacity: .5; }
#style-panel input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
#style-panel .field label { font-size: 12px; color: var(--muted, #888); margin-bottom: 4px; display: block; }
/* font names get the whole row so they aren't cut off */
#style-panel .form-grid .field:has(select[id$="font"]), #style-panel .form-grid .field:has(#s-width) { grid-column: 1 / -1; }

/* ---- Quiet top bar: Stuck?, Sprint and Revise are plain until in use. Only Copy for Docs is filled. */
.btn.stuck-top, .sprint-top, #btn-revise, :root[data-theme="dark"] .btn.stuck-top, :root[data-theme="dark"] .sprint-top, :root[data-theme="dark"] #btn-revise {
  background: transparent; color: var(--text); border-color: transparent; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.btn.stuck-top:hover, .sprint-top:hover, #btn-revise:hover { background: var(--hover, rgba(0,0,0,.05)); border-color: transparent; }
:root[data-theme="dark"] .btn.stuck-top:hover, :root[data-theme="dark"] .sprint-top:hover, :root[data-theme="dark"] #btn-revise:hover { background: rgba(255,255,255,.07); }
.btn.stuck-top svg, .sprint-top .bolt, #btn-revise svg { color: var(--muted); width: 16px; height: 16px; }
.sprint-top .bolt svg { width: 16px; height: 16px; }
/* in use: the colour comes back so you can see it at a glance */
.sprint-top.running, :root[data-theme="dark"] .sprint-top.running { background: rgba(224, 162, 0, .16); color: #8a6200; font-weight: 600; }
:root[data-theme="dark"] .sprint-top.running { color: var(--sprint); }
.sprint-top.running .bolt { color: var(--sprint); }
#btn-revise.on, :root[data-theme="dark"] #btn-revise.on { background: rgba(124, 58, 237, .13); color: #6d28d9; font-weight: 600; }
:root[data-theme="dark"] #btn-revise.on { background: rgba(167, 139, 250, .18); color: #c4b5fd; }
#btn-revise.on svg { color: inherit; }
.btn.stuck-top.nudge { background: rgba(13, 148, 136, .13); color: #0f766e; animation: st-glow-teal 2.4s ease-in-out infinite; }
:root[data-theme="dark"] .btn.stuck-top.nudge { background: rgba(45, 212, 191, .16); color: #5eead4; animation: st-glow-teal 2.4s ease-in-out infinite; }
@keyframes st-glow-teal { 0%, 100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0); } 50% { box-shadow: 0 0 0 4px rgba(13, 148, 136, .14); } }
.btn.stuck-top.nudge svg { color: inherit; }

/* ---- Phone: a smaller set of tools, like Scrivener's iPhone app. iPad and computer keep everything. */
html.m-phone #plan-nav button[data-v="cork"], html.m-phone #plan-nav button[data-v="mood"], html.m-phone #plan-nav button[data-v="timeline"],
html.m-phone #rp-level, html.m-phone #btn-sprint, html.m-phone #btn-split, html.m-phone #split-pane { display: none !important; }
html.m-phone #st-session, html.m-phone #st-today { pointer-events: none; }

/* find in chapter (web and phone): every match softly, the current one strongly */
::highlight(unwip-find) { background-color: rgba(250, 204, 21, .32); }
::highlight(unwip-find-cur) { background-color: rgba(249, 115, 22, .65); color: inherit; }

/* phone keyboard row: scrolls sideways, with a soft fade showing there's more */
@media (max-width: 720px) {
  .m-fbar { touch-action: pan-x; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .m-fbar::-webkit-scrollbar { display: none; }
  .m-fbar.more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
  .m-fbar.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 36px), transparent); }
  .m-fbar.more-l:not(.more-r) { -webkit-mask-image: linear-gradient(to right, transparent, #000 28px); mask-image: linear-gradient(to right, transparent, #000 28px); }
  /* writer mode on a phone: no quote (there isn't room above the chapter title) */
  html.m-phone .writer-quote { display: none !important; }
}

/* ---- Dropbox (iPhone / iPad version) */
.dbx-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; margin-right: 10px; white-space: nowrap; }
.dbx-pill.ok svg { color: #0061fe; }
.dbx-pill { position: relative; }
.dbx-bar { position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius: 2px; background: color-mix(in srgb, currentColor 18%, transparent); overflow: hidden; }
.dbx-bar b { display: block; height: 100%; background: #0061fe; border-radius: 2px; }
:root[data-theme="dark"] .dbx-bar b { background: #6aa8ff; }
:root[data-theme="dark"] .dbx-pill.ok svg { color: #6aa8ff; }
.dbx-pill.off { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.dbx-pill.busy svg { animation: pulse 1.2s ease-in-out infinite; color: #0061fe; }
.dbx-pill.warn { color: #b45309; border-color: rgba(180, 83, 9, .35); }
:root[data-theme="dark"] .dbx-pill.warn { color: #fbbf24; }
.dbx-card .link-btn { border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.dbx-list { margin: 8px 0; padding-left: 0; list-style: none; }
.dbx-list li { padding: 4px 0; }
.dbx-first { display: flex; gap: 12px; align-items: center; padding: 6px 0; }
.dbx-first b { display: block; }
.dbx-first span:not(.sy-spin) { color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .dbx-pill { margin-right: 6px; padding: 0 10px; } .lib-head-right .lib-total { display: none; } }
.pc-only { display: contents; }
html.web .pc-only { display: none !important; }

/* ---- Tracked changes (suggestions) */
.editor ins.tc-ins { text-decoration: underline; text-decoration-color: #16a34a; text-decoration-thickness: 2px; text-underline-offset: 3px; color: #15803d; background: rgba(22, 163, 74, .08); }
.editor del.tc-del { text-decoration: line-through; text-decoration-color: #dc2626; text-decoration-thickness: 1.5px; color: #b91c1c; background: rgba(220, 38, 38, .06); }
:root[data-theme="dark"] .editor ins.tc-ins { color: #86efac; text-decoration-color: #4ade80; background: rgba(74, 222, 128, .1); }
:root[data-theme="dark"] .editor del.tc-del { color: #fca5a5; text-decoration-color: #f87171; background: rgba(248, 113, 113, .08); }
.editor ins.tc-ins, .editor del.tc-del { cursor: pointer; border-radius: 2px; }
.editor .tc-flash { outline: 2px solid var(--accent); outline-offset: 2px; }
.st-track { display: inline-flex; align-items: center; gap: 6px; }
.st-track[hidden], .st-dot[hidden] { display: none !important; }
.st-tc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.st-tc-dot.live { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
body.tc-on .st-track { color: #15803d; font-weight: 600; }
:root[data-theme="dark"] body.tc-on .st-track { color: #86efac; }
#changes-panel .tc-switch { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; margin-bottom: 12px; }
#changes-panel .tc-switch input { margin-top: 3px; accent-color: #16a34a; width: 16px; height: 16px; }
#changes-panel .tc-switch span { display: flex; flex-direction: column; gap: 2px; }
#changes-panel .tc-switch small { color: var(--muted); font-size: 12px; line-height: 1.4; }
#changes-panel .tc-bar { display: flex; align-items: center; gap: 6px; margin: 4px 0 10px; font-size: 12.5px; color: var(--muted); }
#changes-panel .tc-bar span { flex: 1; }
#changes-panel .tc-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--paper); cursor: pointer; }
#changes-panel .tc-card.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#changes-panel .tc-who { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
#changes-panel .tc-who b { color: var(--text); }
#changes-panel .tc-what { font-family: var(--doc-font, Georgia), serif; font-size: 14.5px; line-height: 1.45; word-break: break-word; }
#changes-panel .tc-old { color: #b91c1c; text-decoration: line-through; }
#changes-panel .tc-new { color: #15803d; text-decoration: underline; text-decoration-color: #16a34a; }
:root[data-theme="dark"] #changes-panel .tc-old { color: #fca5a5; }
:root[data-theme="dark"] #changes-panel .tc-new { color: #86efac; }
#changes-panel .tc-lbl { font-family: var(--ui); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
#changes-panel .tc-acts { display: flex; gap: 6px; margin-top: 8px; }
.side-tabs { overflow-x: auto; scrollbar-width: none; }
.side-tabs::-webkit-scrollbar { display: none; }
.revise-panel:not(.pl-side) { width: 340px; }
.side-tabs .side-tab { padding: 0 7px; font-size: 12.5px; }
@media (max-width: 720px) { .revise-panel:not(.pl-side) { width: auto; } }
.side-tabs .side-tab { padding: 0 6px; }
.side-tabs .side-x { flex-shrink: 0; margin-left: auto; }
.rd-pick { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 12px 0; }
.rd-pick-head { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.rd-list { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.rd-list small { color: var(--muted); margin-left: 6px; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.rd-res { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.rd-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 9px; padding: 9px 12px; cursor: pointer; font: inherit; color: var(--text); }
.rd-row span { color: var(--muted); font-size: 12.5px; }
.rd-row:hover { border-color: var(--accent); }
.tc-readers { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }

/* ---- Read aloud */
::highlight(unwip-read) { background-color: rgba(52, 82, 138, .16); text-decoration: underline; text-decoration-color: rgba(52, 82, 138, .55); text-decoration-thickness: 2px; text-underline-offset: 4px; }
:root[data-theme="dark"] ::highlight(unwip-read) { background-color: rgba(138, 166, 220, .22); }
.ra-bar { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 99px; background: #1f2a3c; color: #f5f3ee; box-shadow: 0 14px 40px rgba(0,0,0,.28); font: 13px var(--ui); }
.ra-b { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: inherit; display: grid; place-items: center; cursor: pointer; }
.ra-b svg { width: 18px; height: 18px; }
.ra-b:hover { background: rgba(255,255,255,.12); }
.ra-play { width: 40px; height: 40px; background: #f5f3ee; color: #1f2a3c; }
.ra-play:hover { background: #fff; }
.ra-pos { min-width: 54px; text-align: center; opacity: .7; font-variant-numeric: tabular-nums; }
.ra-bar select { height: 30px; border-radius: 99px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: inherit; padding: 0 8px; font: inherit; max-width: 150px; }
.ra-bar select option { color: #1f2a3c; }
@media (max-width: 720px) { .ra-bar { bottom: calc(70px + env(safe-area-inset-bottom)); max-width: calc(100vw - 20px); flex-wrap: wrap; justify-content: center; row-gap: 6px; border-radius: 24px; } .ra-bar .ra-voice { order: 10; flex: 1 1 100%; max-width: none; } }
.rd-how { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--paper); font-size: 13px; margin: 6px 0 4px; }
.rd-how summary { cursor: pointer; }
.rd-how ol { margin: 8px 0 6px; padding-left: 20px; } .rd-how li { margin: 3px 0; } .rd-how p { margin: 6px 0 0; color: var(--muted); }

/* ---- Insights: pacing and characters */
.insights-view { padding: 18px 26px 40px; overflow: auto; }
html.m-phone #plan-nav button[data-v="insights"] { display: none !important; }
.in-wrap { max-width: 1200px; margin: 0 auto; }
.in-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.in-tabs { display: inline-flex; background: var(--panel-2, rgba(0,0,0,.05)); border-radius: 10px; padding: 3px; }
.in-tabs button { border: 0; background: transparent; padding: 7px 16px; border-radius: 8px; font: 600 13.5px var(--ui); color: var(--muted); cursor: pointer; }
.in-tabs button.on { background: var(--paper); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.in-sum { color: var(--muted); font-size: 13.5px; }
.in-loading, .in-empty { color: var(--muted); padding: 60px 0; text-align: center; font-size: 14.5px; line-height: 1.6; }
.in-foot { color: var(--muted); font-size: 12.5px; margin-top: 12px; line-height: 1.5; }
.pc-legend { display: flex; gap: 18px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.pc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pc-k { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.pc-k.nar { background: #9db1d4; } .pc-k.dlg { background: #34528a; } .pc-k.scn { width: 7px; height: 7px; border-radius: 50%; background: #d97706; } .pc-k.avg { height: 0; border-top: 2px dashed var(--muted); border-radius: 0; }
.pc-scroll { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 6px; }
.pc-chart { --plot: 280px; --base: 40px; position: relative; display: flex; align-items: flex-end; gap: 4px; height: calc(var(--plot) + var(--base)); min-width: calc(var(--n) * 22px); }
.pc-col { flex: 1 1 0; min-width: 18px; max-width: 64px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; border: 0; background: transparent; padding: 0; cursor: pointer; position: relative; z-index: 1; }
.pc-bar { position: relative; background: #9db1d4; border-radius: 5px 5px 2px 2px; max-height: var(--plot); height: 0; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; transition: filter .12s; }
.pc-bar { height: calc(var(--h, 0) * 1%); }
.pc-dlg { background: #34528a; width: 100%; }
.pc-col:hover .pc-bar { filter: brightness(1.08) saturate(1.2); }
.pc-col.cur .pc-bar { outline: 2px solid var(--accent); outline-offset: 2px; }
.pc-col.flag .pc-lbl { color: #b45309; font-weight: 700; }
.pc-scn { height: 16px; display: flex; justify-content: center; align-items: center; gap: 2px; flex-wrap: wrap; overflow: hidden; margin-top: 4px; }
.pc-scn i { width: 5px; height: 5px; border-radius: 50%; background: #d97706; }
.pc-scn b { font-size: 10px; color: #d97706; }
.pc-lbl { height: 20px; font: 600 11px var(--ui); color: var(--muted); text-align: center; line-height: 20px; }
.pc-avg { position: absolute; left: 0; right: 0; border-top: 2px dashed color-mix(in srgb, var(--muted) 70%, transparent); z-index: 2; pointer-events: none; }
.pc-avg span { position: absolute; right: 0; top: -20px; font: 600 11px var(--ui); color: var(--muted); background: var(--paper); padding: 0 4px; }
#in-body { position: relative; }
.pc-tip { position: absolute; width: 260px; transform: translateY(-100%); background: #1f2a3c; color: #f5f3ee; border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.45; z-index: 20; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.pc-tip b { display: block; margin-bottom: 2px; } .pc-tip em { opacity: .8; }
.in-notes { margin-top: 18px; display: flex; flex-direction: column; gap: 6px; }
.in-notes h4 { margin: 0 0 4px; font: 700 12px var(--ui); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.in-note { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 10px 14px 10px 36px; font: 14px/1.45 var(--ui); color: var(--text); cursor: pointer; position: relative; }
.in-note::before { content: ''; position: absolute; left: 14px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.in-note.k-long::before { background: #d97706; } .in-note.k-short::before { background: #0891b2; } .in-note.k-talk::before { background: #34528a; } .in-note.k-quiet::before { background: #9db1d4; } .in-note.k-scene::before { background: #7c3aed; }
.in-note:hover { border-color: var(--accent); }
.in-ok { color: #15803d; font-size: 14px; }
.ch-scroll { overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; max-height: calc(100vh - 230px); }
.ch-grid { border-collapse: separate; border-spacing: 0; font: 13px var(--ui); }
.ch-grid th, .ch-grid td { padding: 0; height: 30px; min-width: 26px; text-align: center; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.ch-grid thead th { position: sticky; top: 0; background: var(--paper); z-index: 3; height: 34px; }
.ch-grid tr.ch-pov th, .ch-grid tr.ch-pov td { position: sticky; top: 34px; background: var(--paper); z-index: 3; border-bottom: 2px solid var(--line); }
.ch-grid .ch-name { position: sticky; left: 0; background: var(--paper); z-index: 4; text-align: left; padding: 0 12px; min-width: 170px; white-space: nowrap; font-weight: 600; }
.ch-grid thead .ch-name, .ch-grid .ch-pov .ch-name { z-index: 5; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.ch-name i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.ch-name small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.ch-h { border: 0; background: none; font: 600 11.5px var(--ui); color: var(--muted); cursor: pointer; width: 100%; height: 100%; }
.ch-h:hover { color: var(--accent); }
.ch-dot { width: 22px; height: 22px; border: 0; padding: 0; border-radius: 50%; background: var(--c); transform: scale(var(--s)); cursor: pointer; opacity: .85; }
.ch-dot.pov { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--c); opacity: 1; }
.ch-dot:hover { opacity: 1; filter: brightness(1.1); }
.ch-povb { width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--c, transparent); color: #fff; font: 700 10px var(--ui); cursor: pointer; }
.ch-povb:not([style*="--c"]) { color: var(--muted); border: 1px dashed var(--line); }
.ch-povb.guess { opacity: .45; }
.ch-gap { padding: 0 14px !important; white-space: nowrap; color: var(--muted); font-size: 12.5px; text-align: left !important; min-width: 150px; }
.ch-gapb { border: 0; background: rgba(217, 119, 6, .12); color: #b45309; border-radius: 99px; padding: 3px 10px; font: 600 12px var(--ui); cursor: pointer; }
:root[data-theme="dark"] .ch-gapb { color: #fbbf24; }
.ch-gapb small { font-weight: 400; opacity: .8; }
.ch-grid td.gapcell { background: rgba(217, 119, 6, .09); }
.ch-grid td.gapcell.gs { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.ch-grid td.gapcell.ge { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
:root[data-theme="dark"] .ch-grid td.gapcell { background: rgba(251, 191, 36, .07); }

/* ---- Dialogue view */
::highlight(unwip-dv) { color: color-mix(in srgb, var(--text) 26%, transparent); }
.dv-bar { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 81; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border-radius: 99px; background: #1f2a3c; color: #f5f3ee; box-shadow: 0 14px 40px rgba(0,0,0,.28); font: 13px var(--ui); white-space: nowrap; }
.dv-seg { display: inline-flex; background: rgba(255,255,255,.1); border-radius: 99px; padding: 2px; }
.dv-seg button { border: 0; background: transparent; color: inherit; font: 600 13px var(--ui); padding: 6px 14px; border-radius: 99px; cursor: pointer; opacity: .75; }
.dv-seg button.on { background: #f5f3ee; color: #1f2a3c; opacity: 1; }
.dv-bar select { height: 30px; border-radius: 99px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: inherit; padding: 0 8px; font: inherit; max-width: 170px; }
.dv-bar select:disabled { opacity: .4; }
.dv-bar select option { color: #1f2a3c; }
.dv-compact { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; opacity: .9; }
.dv-stat { opacity: .7; font-variant-numeric: tabular-nums; }
.dv-x { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.dv-x:hover { background: rgba(255,255,255,.12); }
html.dv-on .ra-bar { bottom: 100px; }
#editor.dv-hiding > p + p { margin-top: .9em; }
@media (max-width: 720px) {
  .dv-bar { bottom: calc(70px + env(safe-area-inset-bottom)); max-width: calc(100vw - 16px); flex-wrap: wrap; justify-content: center; border-radius: 18px; gap: 6px; padding: 6px; }
  .dv-stat { display: none; }
  html.dv-on .ra-bar { bottom: calc(150px + env(safe-area-inset-bottom)); }
}

/* ---- Writing history */
.hi-range { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.hi-range button { border: 1px solid var(--line); background: var(--paper); color: var(--muted); border-radius: 99px; padding: 5px 14px; font: 600 13px var(--ui); cursor: pointer; }
.hi-range button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.hi-cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.hi-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--paper); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hi-card b { font: 700 22px var(--ui); letter-spacing: -.3px; }
.hi-card > span { font: 13px var(--ui); color: var(--muted); }
.hi-card small { display: block; font-size: 11.5px; opacity: .85; margin-top: 2px; }
.hi-card.flame b { color: #c2410c; }
:root[data-theme="dark"] .hi-card.flame b { color: #fb923c; }
.hi-sec { margin-top: 18px; }
.hi-sec h3 { font: 700 12px var(--ui); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 8px; }
.hi-two { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; }
.hi-say { margin: 0 0 8px; font-size: 14px; } .hi-say.muted { color: var(--muted); }
.hm { --cell: 13px; --gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.hm-months { display: grid; grid-template-columns: repeat(var(--weeks), calc(var(--cell) + var(--gap))); margin-left: 34px; font: 11px var(--ui); color: var(--muted); height: 16px; }
.hm-months span { white-space: nowrap; }
.hm-body { display: flex; gap: 6px; }
.hm-wd { display: grid; grid-template-rows: repeat(7, var(--cell)); gap: var(--gap); font: 10.5px/var(--cell) var(--ui); color: var(--muted); width: 28px; }
.hm-grid { display: flex; gap: var(--gap); }
.hm-col { display: grid; grid-template-rows: repeat(7, var(--cell)); gap: var(--gap); }
.hm-c { display: inline-block; width: var(--cell); height: var(--cell); border-radius: 3px; background: color-mix(in srgb, var(--line) 70%, transparent); cursor: pointer; }
.hm-c.none { background: transparent; cursor: default; }
.hm-c.l1 { background: color-mix(in srgb, var(--accent) 28%, var(--paper)); }
.hm-c.l2 { background: color-mix(in srgb, var(--accent) 50%, var(--paper)); }
.hm-c.l3 { background: color-mix(in srgb, var(--accent) 75%, var(--paper)); }
.hm-c.l4 { background: var(--accent); }
.hm-c.today { outline: 2px solid var(--text); outline-offset: 0; }
.hm-c.sel { outline: 2px solid #f59e0b; outline-offset: 1px; }
.hm-c[data-k]:hover { filter: brightness(1.15); }
.hm-key { display: flex; align-items: center; gap: 3px; justify-content: flex-end; font: 11px var(--ui); color: var(--muted); margin-top: 6px; }
.hm-key .hm-c { cursor: default; margin: 0 1px; }
.hi-day { margin-top: 8px; font: 13px var(--ui); color: var(--muted); min-height: 18px; }
.hi-day b { color: var(--text); }
.hb { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-bottom: 18px; position: relative; }
.hb-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; }
.hb-col i { display: block; width: 100%; max-width: 34px; background: color-mix(in srgb, var(--accent) 45%, var(--paper)); border-radius: 4px 4px 0 0; }
.hb-col.top i { background: var(--accent); }
.hb-col span { position: absolute; bottom: -18px; font: 10.5px var(--ui); color: var(--muted); white-space: nowrap; }
.hb-hours .hb-col i { max-width: 14px; }
.hb-vals { display: flex; gap: 3px; margin-top: 6px; } .hb-vals span { flex: 1; text-align: center; font: 600 11px var(--ui); color: var(--muted); }
.hi-books { display: grid; gap: 6px; }
.hi-book { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 70px; align-items: center; gap: 10px; font: 13px var(--ui); }
.hi-book span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-book i { height: 10px; background: color-mix(in srgb, var(--line) 60%, transparent); border-radius: 99px; overflow: hidden; }
.hi-book em { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.hi-book b { text-align: right; font-variant-numeric: tabular-nums; }
/* Writing history › Copy… (history.js copyPanel) */
.hc { display: flex; flex-direction: column; gap: 10px; }
.hc-sub { font: 700 12px var(--ui); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-top: 6px; }
.hc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-chips button { border: 1px solid var(--line); background: var(--paper); color: var(--muted); border-radius: 99px; padding: 5px 14px; font: 600 13px var(--ui); cursor: pointer; }
.hc-chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.hc-pick { display: flex; flex-wrap: wrap; gap: 12px; font: 13px var(--ui); color: var(--muted); }
.hc-pick label { display: flex; align-items: center; gap: 6px; }
.hc-as { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hc-opt { display: flex; gap: 9px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; cursor: pointer; font: 13.5px var(--ui); line-height: 1.35; }
.hc-opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--paper)); }
.hc-opt input { margin: 2px 0 0; accent-color: var(--accent); }
.hc-opt small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.hc-ticks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.hc-ck { display: flex; gap: 7px; align-items: center; font: 13px var(--ui); cursor: pointer; }
.hc-ck input { accent-color: var(--accent); margin: 0; }
.hc-pv { border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2, var(--paper)); max-height: 300px; overflow: auto; }
.hc-text { margin: 0; padding: 10px 12px; font: 12.5px/1.6 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace; white-space: pre; color: var(--text); }
.hc-text.tab { tab-size: 14; }
.hc-pic { display: block; width: 100%; height: auto; }
.hc-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 720px) {
  .hc-as { grid-template-columns: 1fr; }
  .hc-btns .btn { flex: 1 1 40%; }
  .hc-pv { max-height: 220px; }
}
@media (max-width: 900px) { .hi-cards { grid-template-columns: repeat(3, 1fr); } .hi-two { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .hi-cards { grid-template-columns: repeat(2, 1fr); } .hm { --cell: 11px; --gap: 2px; } }

/* ---- Series bible */
.tr-series { display: inline-grid; place-items: center; margin-left: 4px; color: var(--accent); opacity: .8; }
.tr-series svg { width: 13px; height: 13px; }
.sb-intro { margin-top: 0; color: var(--muted); }
.sb-name { display: flex; gap: 8px; } .sb-name input { flex: 1; }
.sb-books { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, var(--paper)); font: 14px var(--ui); }
.sb-books > svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.sb-chip { display: inline-block; margin: 2px 0 2px 6px; padding: 2px 10px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); font-size: 12.5px; }
.sb-hint { color: var(--muted); font-size: 13.5px; }
.sb-sec { margin-top: 16px; }
.sb-sec h3 { font: 700 12px var(--ui); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 6px; }
.sb-sec h3 span { background: var(--line); color: var(--text); border-radius: 99px; padding: 1px 8px; margin-left: 4px; font-size: 11px; }
.sb-kind { font: 600 13px var(--ui); margin: 10px 0 4px; }
.sb-list { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); max-height: 220px; overflow: auto; }
.sb-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); font: 14px var(--ui); cursor: default; }
label.sb-row { cursor: pointer; }
.sb-row:last-child { border-bottom: 0; }
.sb-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-k { color: var(--muted); font-size: 12.5px; }
.sb-ic svg { width: 15px; height: 15px; color: var(--accent); }
.sb-sec > .btn { margin-top: 10px; }
.sb-miss .sb-list { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
html.dv-on #editor-wrap { scroll-padding-bottom: 110px; } html.dv-on #editor { padding-bottom: 90px; }
:root[data-theme="dark"] .dv-bar { background: #2c3a52; border: 1px solid rgba(255,255,255,.12); }
@media (max-width: 720px) {
  .dv-bar { display: grid; grid-template-columns: 1fr auto; width: calc(100vw - 16px); max-width: 420px; }
  .dv-seg { justify-self: start; }
  .dv-bar select { max-width: none; width: 100%; }
  .dv-long { display: none; }
  .dv-x { grid-column: 2; grid-row: 1; }
}
.in-note.k-empty::before { background: #94a3b8; }
.in-note.k-g::before { background: var(--accent); opacity: .5; }
p.in-note.k-g { cursor: default; margin: 0; }
p.in-note.k-g:hover { border-color: var(--line); }
.in-note small { color: var(--muted); font-weight: 400; }
.pc-col.empty .pc-bar { height: 6px !important; background: transparent; border: 1.5px dashed var(--line); }
.dbx-steps { margin: 0 0 12px; padding-left: 20px; } .dbx-steps li { margin: 4px 0; }
a.dbx-open { display: inline-flex; text-decoration: none; }

/* ---- Sprint history */
.spr-filter { display: flex; align-items: center; gap: 10px; margin: -4px 0 14px; font: 13px var(--ui); color: var(--muted); }
.spr-filter select { height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--text); padding: 0 10px; font: inherit; }
.spr-cards { grid-template-columns: repeat(4, 1fr); }
.spr-chart { position: relative; display: flex; align-items: flex-end; gap: 3px; height: 90px; margin: 16px 0 6px; padding: 0 2px; border-bottom: 1px solid var(--line); }
.spr-chart i { flex: 1; max-width: 22px; background: color-mix(in srgb, var(--accent) 55%, var(--paper)); border-radius: 3px 3px 0 0; }
.spr-avg { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--muted); opacity: .7; }
.spr-avg span { position: absolute; right: 0; top: -17px; font: 11px var(--ui); color: var(--muted); }
.spr-table-wrap { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 14px; background: var(--paper); }
.spr-table { width: 100%; border-collapse: collapse; font: 13.5px var(--ui); }
.spr-table th { position: sticky; top: 0; background: var(--paper); text-align: left; font: 700 11.5px var(--ui); text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); }
.spr-table td { padding: 8px 12px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.spr-table td small { color: var(--muted); margin-left: 4px; }
.spr-table .n { text-align: right; font-variant-numeric: tabular-nums; }
.spr-table tr.best td { background: color-mix(in srgb, #f59e0b 9%, transparent); }
.spr-star { color: #d97706; }
.spr-doc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.spr-del { width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.spr-del:hover { background: rgba(220, 38, 38, .1); color: #dc2626; }
button.stat-card { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
button.stat-card:hover { border-color: var(--accent); }
@media (max-width: 620px) { .spr-cards { grid-template-columns: repeat(2, 1fr); } .spr-table td:nth-child(2), .spr-table th:nth-child(2) { display: none; } }
.spr-filter select { width: auto; min-width: 220px; }

/* ---- main screen footer: no-AI note, About, Report */
.lib-foot { margin: 40px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--muted); font: 13px/1.5 var(--ui); }
.noai { display: flex; align-items: center; gap: 10px; max-width: 640px; }
.noai-badge { flex: none; border: 1.5px solid currentColor; border-radius: 99px; padding: 2px 10px; font: 700 11px var(--ui); letter-spacing: .5px; text-transform: uppercase; color: var(--text); }
.lib-links { display: flex; gap: 8px; align-items: center; }
.about-head { font: 15px var(--ui); } .about-head b { font-size: 22px; margin-right: 6px; } .about-head span { color: var(--muted); }
.about-slogan { margin: 2px 0 12px; font-style: italic; color: var(--muted); }
.about h4 { margin: 16px 0 4px; font: 700 12px var(--ui); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.about p { margin: 0; }
.about-note { padding: 2px 0 2px 14px; border-left: 3px solid var(--accent, #c8553d); } .about-note p + p { margin-top: 8px; }
.rep textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 90px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 14px/1.4 var(--ui); background: var(--paper); color: var(--text); }
.rep-details { margin-top: 10px; font-size: 13px; } .rep-details summary { cursor: pointer; color: var(--muted); }
.rep-details pre { white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 12px/1.45 ui-monospace, Consolas, monospace; }
@media (max-width: 720px) { .noai { flex-direction: column; gap: 6px; } }
/* ---- town maps: tool options appear only for the picked tool */
.mp-toollist { display: contents; }
.mp-opts { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; pointer-events: none; z-index: 2; }
.mp-opts > * { pointer-events: auto; }
.mp-opts .chip { background: var(--paper); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.mp-opts .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.mp-opt-l { font: 700 11px var(--ui); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: var(--paper); padding: 5px 8px; border-radius: 99px; }
.mp-opt-h { font: 12.5px var(--ui); color: var(--muted); background: color-mix(in srgb, var(--paper) 85%, transparent); padding: 4px 10px; border-radius: 99px; }
.about-small { font-size: 12.5px; color: var(--muted); }
.lic > p { margin-top: 0; }
.lic-item { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; background: var(--paper); }
.lic-item summary { cursor: pointer; padding: 10px 14px; font: 14px var(--ui); }
.lic-item summary span { color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.lic-copy, .lic-note { margin: 0 14px 8px; font-size: 13px; } .lic-note { color: var(--muted); }
.lic-item pre { margin: 0 14px 14px; max-height: 260px; overflow: auto; white-space: pre-wrap; font: 11.5px/1.45 ui-monospace, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }

/* connections and "Appears in" on sheets */
.sl { margin: 4px 0 18px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel, transparent); font: 13px var(--ui); display: grid; gap: 8px; }
.sl.hidden { display: none; }
.sl-row { display: flex; gap: 10px; align-items: baseline; }
.sl-k { flex: 0 0 92px; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.sl-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.sl-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.sl-go { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; }
.sl-go:hover { text-decoration: underline; }
.sl-x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 50%; }
.sl-x:hover { color: var(--text); background: color-mix(in srgb, var(--text) 10%, transparent); }
.sl-add, .sl-ch { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 2px 10px; font: inherit; cursor: pointer; color: var(--text); }
.sl-add { border-style: dashed; color: var(--accent); }
.sl-add:hover, .sl-ch:hover { border-color: var(--accent); }
.sl-ch b { color: var(--accent); margin-left: 3px; }
.sl-dim { color: var(--muted); }
.slc .field { margin-bottom: 10px; } .slc .field input, .slc .field select { width: 100%; box-sizing: border-box; }
.slc-own.hidden { display: none; }
.slc-list { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.slc-g { font: 700 11px var(--ui); text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 6px 6px 2px; }
.slc-i { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 8px; border-radius: 6px; font: 14px var(--ui); color: var(--text); cursor: pointer; }
.slc-i:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.slc-i.on { background: var(--accent); color: #fff; }
.slw-key { display: flex; flex-wrap: wrap; gap: 14px; font: 13px var(--ui); margin-bottom: 6px; }
.slw-key i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.slw-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.slw-wrap svg { display: block; font: 13px var(--ui); }
.slw-e line { stroke: var(--muted); stroke-opacity: .55; stroke-width: 1.3; }
.slw-e text { fill: var(--muted); text-anchor: middle; font-size: 11px; paint-order: stroke; stroke: var(--bg, #fff); stroke-width: 3px; }
.slw-n { cursor: pointer; }
.slw-n text { fill: var(--text); text-anchor: middle; font-weight: 600; paint-order: stroke; stroke: var(--bg, #fff); stroke-width: 3px; }
.slw-n.hi circle { stroke: var(--text); stroke-width: 2; }
.slw-n.dim, .slw-e.dim { opacity: .15; }
@media (max-width: 640px) { .sl-row { flex-direction: column; gap: 4px; } .sl-k { flex: none; } }

/* your own calendar */
.tl-axis.cal i { font-style: normal; }
.tl-axis .tl-m1 { color: var(--text); font-weight: 700; }
.tl-ev .tl-wd { font-style: normal; display: block; color: var(--muted); }
.ev-wrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.modal .ev-wrow input[type=number] { width: 80px; flex: none; } .modal .ev-wrow select { width: auto; min-width: 150px; flex: none; }
.tl-ev:has(.tl-wd) { height: 62px; }
.tl-moon { position: absolute; bottom: 1px; transform: translateX(-50%); font-size: 9px; line-height: 1; font-weight: 400; opacity: .85; pointer-events: auto; }

/* turning a list into sheets */
.tsh-doc { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 10px 0; }
.tsh-dh { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 15px; }
.tsh-dh label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.modal .tsh-dh select { width: auto; padding: 4px 8px; }
.tsh-gh { font: 700 12.5px var(--ui); color: var(--muted); margin: 8px 0 2px; }
.tsh-e { display: grid; grid-template-columns: 18px auto 1fr; column-gap: 8px; align-items: baseline; padding: 3px 4px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.tsh-e:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tsh-e.off { opacity: .45; }
.tsh-e .tsh-n { white-space: nowrap; } .tsh-e .tsh-a { color: var(--muted); font-size: 12.5px; }
.tsh-e .tsh-d { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tsh-e.off .tsh-n b { text-decoration: line-through; }
.tsh-left { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.tsh-opt { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 13.5px; }
.tsh-sum { margin: 10px 0 0; }

/* a map in split view */
.sp-map figure { margin: 0 0 14px; } .sp-map figcaption { font: 600 13px var(--ui); color: var(--muted); margin-bottom: 4px; }
.sp-map .sp-map-img { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 6px; }
.sp-map-wait { color: var(--muted); font: 13px var(--ui); }

/* natural voice setup */
.nv-note { padding: 10px 14px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 0 8px 8px 0; margin-bottom: 12px; }
.nv-note p { margin: 6px 0 0; } .nv-small { font-size: 12.5px; color: var(--muted); }
.nv-voices { columns: 2; padding-left: 18px; margin: 6px 0 10px; } .nv-voices span { color: var(--muted); font-size: 12.5px; }
.nv-prog { margin-top: 10px; } .nv-prog.hidden { display: none; }
.nv-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; } .nv-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.nv-pt { font-size: 12.5px; color: var(--muted); }
.ra-wait { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* the book font, when it's also used for synopses, cards and split view */
body.book-font .doc-synopsis, body.book-font .ol-syn, body.book-font .ck-card, body.book-font .sp-editor { font-family: var(--book-font), Georgia, serif; }
.bf-prev { margin: 10px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 17px; line-height: 1.5; background: var(--paper); }
.bf-prev b { display: block; font-size: 21px; margin-bottom: 4px; }
.tl-grid { display: flex; gap: 20px; align-items: flex-start; }
.tl-set { width: 300px; flex: none; }
.tl-set .field { margin-bottom: 10px; }
.tl .check { display: flex; gap: 8px; align-items: flex-start; margin: 7px 0; font-size: 14px; } .tl .check small { display: block; color: var(--muted); font-size: 12.5px; }
.tl-scope { margin-top: 12px; font-size: 14px; }
.tl-prev { flex: 1; min-width: 0; max-height: 420px; overflow: auto; padding: 18px 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--text); }
.tl-prev h3 { text-align: center; margin: 0 0 14px; font-size: 1.3em; }
.tl-prev .tl-brk { text-align: center; margin: 8px 0 !important; text-indent: 0; }
.side-whole { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
@media (max-width: 640px) { .tl-grid { flex-direction: column; } .tl-set { width: 100%; } .tl-prev { order: -1; width: 100%; box-sizing: border-box; max-height: 220px; position: sticky; top: 0; z-index: 1; } }
.bf .check { display: flex; gap: 8px; align-items: flex-start; margin: 7px 0; font-size: 14px; } .bf .check small { display: block; color: var(--muted); font-size: 12.5px; }
.bf-scope { display: grid; gap: 4px; margin-top: 6px; }

/* importing from Scrivener */
.sim-grid { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 260px); gap: 6px 8px; align-items: center; margin: 12px 0; }
.sim-h { font: 700 12px var(--ui); text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.sim-l { display: flex; gap: 8px; align-items: center; cursor: pointer; min-width: 0; }
.sim-l b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .sim-l small { color: var(--muted); font-size: 12.5px; }
.sim-l.off { opacity: .45; } .sim-ic { font-size: 18px; }
.sim-arrow { color: var(--muted); text-align: center; }
.sim-r { display: flex; flex-direction: column; } .sim-mem { color: var(--accent); font-size: 11.5px; margin-top: 2px; }
.sim-not { font-size: 13px; color: var(--muted); margin: 8px 0; }
.sim-foot { border-top: 1px solid var(--line); padding-top: 10px; } .sim-foot .check { display: flex; gap: 8px; align-items: center; margin: 8px 0; font-size: 14px; }
.sim-small { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.simp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.simp-h { font: 700 12px var(--ui); color: var(--muted); margin-bottom: 4px; }
.simp-page { height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; background: #fffef9; color: #222; line-height: 1.5; }
.simp-after p { margin: 0; text-indent: .5in; } .simp-after p:first-of-type, .simp-after h1 + p { text-indent: 0; }
.simp-after h1 { font-size: 1.5em; text-align: center; margin: 0 0 1em; }
/* labels from Scrivener */
.lbl-chip { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; font: 600 11px/18px var(--ui); color: #222; background: color-mix(in srgb, var(--lc) 45%, white); vertical-align: middle; white-space: nowrap; }
@media (max-width: 640px) { .sim-grid { grid-template-columns: minmax(0,1fr) 20px minmax(0, 150px); } .simp-cols { grid-template-columns: 1fr; } }

/* chapter titles typed into the text */
.tt-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 10px 0; background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tt-box p { margin: 0 0 6px; } .tt-box .check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-size: 14px; } .tt-box small { display: block; color: var(--muted); font-size: 12.5px; }
.nv-done { color: #2f7d4a; font-weight: 600; margin: 0 0 10px; } .nv-fail { color: #b3412e; margin-top: 10px; } .nv-try { font-size: 12.5px; margin-left: 4px; }
.nv-voices li { break-inside: avoid; }
.nm-head { display: flex; justify-content: space-between; align-items: center; } .nm-ignored { color: var(--muted); font-size: 13px; margin: 8px 4px; }

/* no hard feelings */
.nhf-lead { font-size: 15px; margin: 0 0 12px; }
.nhf-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; cursor: pointer; }
.nhf-opt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.untested { display: inline; color: #a0632a; font-style: italic; }
.nhf-opt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
/* the summary before an export */
.xs { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 12px 0 4px; font-size: 14px; }
.xs p { margin: 0 0 6px; } .xs-left { color: var(--muted); }
.xs-tc { margin-top: 10px; padding: 10px 12px; border-radius: 8px; border-left: 4px solid #c9892b; background: color-mix(in srgb, #c9892b 10%, transparent); }
.xs-tc .check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; } .xs-tc small { display: block; color: var(--muted); font-size: 12.5px; }
.tsx-cap { position: absolute; left: 8%; right: 8%; bottom: 14px; text-align: center; font: italic 12px/1.35 var(--ui); color: #8a857c; pointer-events: none; }

/* Insights in the side panel */
.ins-mini { display: flex; align-items: flex-end; gap: 2px; height: 70px; margin: 6px 0 14px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; }
.ins-mini button { flex: 1; min-width: 2px; border: 0; padding: 0; background: color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 2px 2px 0 0; cursor: pointer; }
.ins-mini button:hover { background: var(--accent); }
#insights-panel .side-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
/* six side-panel tabs: wrap onto two lines rather than hide any */
.side-tabs { flex-wrap: wrap; overflow: visible; row-gap: 2px; padding-right: 36px; position: relative; }
.side-tabs .side-x { position: absolute; right: 6px; top: 8px; margin: 0; }
.nhf-tt { display: flex; gap: 8px; align-items: flex-start; margin: 10px 2px; font-size: 14px; } .nhf-tt small { display: block; color: var(--muted); font-size: 12.5px; }

/* saving failed (disk full, no permission): stays until it saves again */
#save-trouble { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 9999; max-width: min(720px, calc(100vw - 32px)); background: #fff4e5; color: #6b3a00; border: 1px solid #e0a34a; border-radius: 10px; padding: 10px 14px; font: 14px/1.45 var(--ui); box-shadow: 0 6px 24px rgba(0,0,0,.18); }
#save-trouble .btn { margin-left: 8px; }

.import-report li.ir-warn { color: #8a4b00; }

/* What I've used */
.ug-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; } @media (max-width: 640px) { .ug-cols { grid-template-columns: 1fr; } }
.ug-cols h4 { margin: 6px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ug-list { margin: 0; padding: 0 0 0 1.4em; max-height: 46vh; overflow: auto; font-size: 13.5px; }
.ug-list li { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; border-bottom: 1px solid var(--line); }
.ug-list li span { flex: 1; } .ug-list li b { font-variant-numeric: tabular-nums; } .ug-list li small { color: var(--muted); font-size: 12px; min-width: 70px; text-align: right; }
.ug-never { list-style: none; padding-left: 0; color: var(--muted); }

/* conflicted copy bar */
.chg-bar.cq-bar { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: start; background: color-mix(in srgb, #c9892b 12%, var(--paper, #fffef9)); border-color: color-mix(in srgb, #c9892b 45%, transparent); color: inherit; }
.cq-bar .chg-sw { background: #c9892b; margin-top: 4px; }
.chg-bar.cq-bar > .cq-acts { grid-column: 2; display: flex; flex-direction: row; gap: 6px; flex-wrap: wrap; flex: none; }
.cq-bar .cq-acts .btn { width: auto; }
:root[data-theme="dark"] .chg-bar.cq-bar { background: #3a2c17; color: #f0d9b5; }
/* Deleted books */
.lib-bin { margin: 18px 0 4px; text-align: center; }
.lib-bin .link-btn { color: var(--muted); font-size: 13.5px; }
.lib-bin .link-btn:hover { color: var(--text); }
.bin-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 55vh; overflow: auto; }
.bin-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; }
.bin-row b { display: block; }
.bin-row span { font-size: 12.5px; color: var(--muted); }
.bin-row .btn.danger-text { margin-right: 0; }
@media (max-width: 560px) { .bin-row { grid-template-columns: 1fr 1fr; } .bin-row > div { grid-column: 1 / -1; } }
/* A chapter in its own window */
.popout-body { display: flex; flex-direction: column; height: 100vh; margin: 0; background: var(--bg); }
.po-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--panel, var(--bg)); }
.po-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.po-tools { display: flex; align-items: center; gap: 6px; }
.po-count, .po-saved { font-size: 12.5px; color: var(--muted); margin: 0 6px; white-space: nowrap; }
.po-main { flex: 1; overflow: auto; padding: 28px 16px 80px; }
.po-main .page { margin: 0 auto; max-width: var(--page-width, 720px); }
.po-main .editor { min-height: 70vh; outline: none; }
.tr-pop { margin-left: 6px; font-size: 12px; color: var(--accent); }
.lib-group { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; margin: 14px 2px -4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-weight: 600; }
.lib-group:first-child { margin-top: 0; }
.lib-group small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
/* Dropbox on the phone: synced by a tap, with a ⚠ when another device changed something */
.dbx-pill.news { color: #b45309; border-color: rgba(180, 83, 9, .45); }
:root[data-theme="dark"] .dbx-pill.news { color: #fbbf24; }
.dbx-pill.pending svg, .dbx-pill.news svg { color: #0061fe; }
.dbx-warn { font-weight: 700; color: #d97706; margin-left: -2px; }
.dbx-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #0061fe; margin-left: -3px; }
.dbx-mini { position: relative; color: var(--muted); }
.dbx-mini.ok svg { color: #0061fe; }
.dbx-mini.busy svg { animation: pulse 1.2s ease-in-out infinite; color: #0061fe; }
.dbx-mini .dbx-warn, .dbx-mini .dbx-dot { position: absolute; right: 2px; top: 2px; font-size: 11px; }
.dbx-mini.warn { color: #b45309; }
.sy-auto { margin: 10px 0 4px; }
/* Import from Dropbox: a plain list, the whole row is the button */
.dbi-path { margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.dbi-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 0 6px; }
.dbi-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.dbi-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.dbi-row:first-child { border-top: 0; }
.dbi-row:active, .dbi-row:hover { background: var(--accent-soft); }
.dbi-row > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbi-go { color: var(--accent); font-size: 13px; font-weight: 600; flex: none; }
.dbi-ic { flex: none; }
/* before and after on a phone: two short panes, with room around them to scroll the window */
@media (max-width: 640px) { .simp-page { height: 30vh; } .simp { padding: 0 6px; } }
/* PC: the sync button, easy to spot on a big screen */
.dbx-pill.pcs-pill { height: 38px; padding: 0 4px 0 14px; font-size: 14px; color: var(--text); gap: 8px; background: color-mix(in srgb, #0061fe 7%, var(--paper)); border: 1.5px solid color-mix(in srgb, #0061fe 45%, var(--line)); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.dbx-pill.pcs-pill svg { width: 18px; height: 18px; color: #0061fe; }
.dbx-pill.pcs-pill .pcs-act { margin-left: 4px; padding: 0 12px; height: 28px; display: inline-flex; align-items: center; border-radius: 99px; background: #0061fe; color: #fff; font-weight: 600; font-size: 13px; }
.dbx-pill.pcs-pill:hover .pcs-act { background: #0050d6; }
.dbx-pill.pcs-pill.off { padding-right: 14px; background: var(--paper); border-color: var(--line); color: var(--muted); }
.dbx-pill.pcs-pill.off svg { color: var(--muted); }
.dbx-pill.pcs-pill.warn, .dbx-pill.pcs-pill.news { background: color-mix(in srgb, #d97706 10%, var(--paper)); border-color: color-mix(in srgb, #d97706 55%, var(--line)); color: var(--text); }
.dbx-pill.pcs-pill.warn .pcs-act, .dbx-pill.pcs-pill.news .pcs-act { background: #d97706; }
:root[data-theme="dark"] .dbx-pill.pcs-pill svg { color: #6aa8ff; }
.pcs-mini { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 10px; margin-left: 8px; border-radius: 99px; border: 1.5px solid color-mix(in srgb, #0061fe 45%, var(--line)); background: color-mix(in srgb, #0061fe 7%, var(--paper)); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pcs-mini svg { color: #0061fe; }
.pcs-mini:hover { background: color-mix(in srgb, #0061fe 14%, var(--paper)); }
.pcs-mini.busy svg { animation: pulse 1.2s ease-in-out infinite; }
.pcs-mini.off { border-color: var(--line); background: transparent; color: var(--muted); font-weight: 400; }
.pcs-mini.off svg { color: var(--muted); }
.pcs-mini.warn, .pcs-mini.news { border-color: color-mix(in srgb, #d97706 55%, var(--line)); background: color-mix(in srgb, #d97706 10%, var(--paper)); }
.pcs-mini .dbx-warn { position: static; font-size: 12px; margin: 0; }
:root[data-theme="dark"] .pcs-mini svg { color: #6aa8ff; }
/* polish: empty chart, and the main screen on smaller screens */
.chart-empty { position: absolute; inset: 0 0 22px 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 0 16px; pointer-events: none; }
.lib-empty b { color: var(--text); }
.sbb-row .sbb-empty { padding: 6px 0 18px; text-align: left; }   /* the Story Bible's "make a book first": a line, not a big empty box */
@media (max-width: 1000px) { .brand .brand-slogan { display: none; } .lib-total { white-space: nowrap; } }
@media (max-width: 900px) { .lib-head-right .lib-total { display: none; } .lib-tabs { margin-left: 16px; } }
@media (max-width: 640px) {
  /* one tidy header: the name with sync and settings, then Write / Play across the width */
  /* the name keeps its size; sync, record and settings share what's left, and the sync pill shortens with … */
  .lib-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 8px; row-gap: 10px; padding: 10px 14px; }
  .lib-head .brand { grid-column: 1; grid-row: 1; min-width: 0; display: grid; grid-auto-flow: column; grid-template-rows: auto auto; justify-content: start; align-items: center; column-gap: 4px; row-gap: 3px; }
  .lib-head .brand-wordmark { height: 28px; grid-row: 1; grid-column: 1 / span 3; }
  .lib-head .brand-beta, .lib-head .dev-tag { grid-row: 2; justify-self: start; }
  .lib-head .brand-slogan { display: none; }
  /* BETA and DEV sit small under the name, so the sync pill has room to say what it's doing */
  .lib-head .brand-beta, .lib-head .dev-tag { margin: 0; padding: 1px 6px; font-size: 9.5px; line-height: 1.4; letter-spacing: .06em; }
  .lib-head-right { grid-column: 2; grid-row: 1; gap: 4px; min-width: 0; justify-content: flex-end; }
  .lib-head-right > * { flex-shrink: 0; }
  .lib-head-right > .dbx-pill { flex: 1 1 auto; min-width: 34px; }
  .lib-head .lib-tabs { grid-column: 1 / -1; grid-row: 2; margin: 0; }
  .lib-head .lib-tabs button { flex: 1; padding: 7px 0; }
  .dbx-pill { margin-right: 0; max-width: none; overflow: hidden; height: 34px; }
  .dbx-pill span { overflow: hidden; text-overflow: ellipsis; }
  /* the goal button sits under the dials instead of over them */
  .dash-setgoal { position: static; flex-basis: 100%; order: 9; }
  .quote-card { padding: 14px 44px 14px 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-grid .field input:not([type=checkbox]):not([type=radio]), .form-grid .field select { width: 100%; box-sizing: border-box; }
}
@media (min-width: 641px) { .dash-card.dials:has(.dash-setgoal) .stat-stack { margin-top: 20px; } }

/* ---- Proof of writing ---- */
/* the Record button: an empty ring while idle (so it never looks like it's already recording); solid red with a
   pulsing dot only while Replay or a screen video is actually recording */
/* idle: plain, in the theme's own colours, so it never looks like it's already recording. Red only while recording. */
.statusbar .st-proof, .rec-btn { display: inline-flex; align-items: center; gap: 7px; margin-right: 12px; height: 22px; padding: 0 11px 0 9px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); font-weight: 600; font-size: 12.5px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.statusbar .st-proof:hover, .rec-btn:hover { background: var(--hover, rgba(127, 127, 127, .12)); color: var(--text); }
.st-proof .pf-dot { width: 9px; height: 9px; border-radius: 50%; background: #d64535; display: inline-block; }
.st-proof .pf-dot.off { background: transparent; border: 2px solid currentColor; box-sizing: border-box; width: 10px; height: 10px; box-shadow: none; opacity: .9; }   /* not recording: an empty ring */
.statusbar .st-proof.on, .rec-btn.on { background: #d64535; border-color: #d64535; color: #fff; }
.statusbar .st-proof.on:hover, .rec-btn.on:hover { background: #c23b2c; }
.st-proof.on .pf-dot { background: #fff; box-shadow: none; animation: pfpulse 1.6s ease-in-out infinite; }
@keyframes pfpulse { 50% { opacity: .35; } }
.pf-dialog .pf-lead { margin: 0 0 14px; color: var(--muted); }
.pf-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: var(--paper); }
.pf-card h3 { margin: 0 0 6px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.pf-card p { margin: 0 0 10px; }
.pf-tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.pf-tag.warn { background: rgba(214, 69, 53, .12); color: #c23b2c; }
.pf-warn { background: rgba(214, 69, 53, .08); border: 1px solid rgba(214, 69, 53, .35); border-radius: 8px; padding: 10px 12px; margin: 0 0 10px; }
.pf-q { display: flex; flex-direction: column; gap: 6px; margin: 0 0 10px; }
.pf-q label { cursor: pointer; }
.pf-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.pf-small { font-size: 13px; color: var(--muted); }
.pf-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.pf-sum div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--paper); }
.pf-sum b { display: block; font-size: 22px; } .pf-sum span { font-size: 13px; color: var(--muted); }
.pf-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pf-table th, .pf-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pf-table th { color: var(--muted); font-weight: 600; }
.pf-table small { display: block; color: var(--muted); font-size: 12px; }
.pf-acts { white-space: nowrap; text-align: right; }
.pf-back { position: fixed; inset: 0; z-index: 400; background: rgba(20, 18, 15, .55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.pf-shell { width: min(980px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 8px; }
.pf-head { display: flex; align-items: center; justify-content: space-between; color: #fff; }
.pf-head .icon-btn { color: #fff; }
.pf-prog { position: fixed; right: 20px; bottom: 50px; z-index: 450; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; width: 280px; }
.pf-bar { height: 6px; background: var(--panel); border-radius: 3px; overflow: hidden; } .pf-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
@media (max-width: 640px) {
  .pf-sum { grid-template-columns: 1fr 1fr; }
  .pf-table { display: block; overflow-x: auto; }
  .pf-back { padding: 8px; }
  .pf-page { height: 60vh; }
}

/* Report a problem: pick how to email it */
.rep-via { display: grid; gap: 8px; margin: 8px 0 12px; }
.rep-via .btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 14px; height: auto; }
.rep-via .btn span { font-size: .85em; opacity: .75; font-weight: 400; }

/* main screen: "Let's get you settled in", then "Take a tour" */
#btn-settle { white-space: nowrap; }
#btn-settle.settle-new { font-weight: 600; }
.m-phone #btn-settle.settle-tour { display: none; }   /* the tour points at the computer layout */
@media (max-width: 720px) { #btn-settle { padding: 5px 10px; font-size: 13px; } }

/* welcome setup, first screen: a small wordmark and slogan above the question */
.in-hello { display: flex; align-items: baseline; gap: 14px; margin: 0 0 10px; color: var(--text); }
.in-hello svg { width: 120px; height: auto; display: block; }
.in-hello .in-slogan { margin: 0; }
.in-custom { margin: 14px 0 0; font-size: 13.5px; }

/* main screen: the Getting started card (hide it with its ×) */
.gs-card { margin: 0 0 22px; padding: 18px 20px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.gs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.gs-head h2 { margin: 0; font-size: 17px; }
.gs-head span { color: var(--muted); font-size: 12.5px; }
.gs-x { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.gs-x:hover { background: var(--bg); color: var(--text); }
.gs-bar { height: 4px; border-radius: 4px; background: var(--line); margin: 12px 0 10px; overflow: hidden; }
.gs-bar i { display: block; height: 100%; background: var(--accent, #EE6038); border-radius: 4px; transition: width .4s ease; }
.gs-card ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 18px; }
.gs-card li { display: flex; gap: 10px; align-items: flex-start; }
.gs-card li b { display: block; font-size: 14px; }
.gs-card li small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.35; margin-top: 2px; }
.gs-tick { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--line); }
.gs-card li.on .gs-tick { border-color: #EE6038; background: #EE6038 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; }
.gs-card li.on b { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.sf-step { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
.sf-step span { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.sf-banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 16px; border-radius: 10px; background: #FBE3D3; color: #7a3412; font-size: 14px; }
.sf-banner span { flex: 1; }
@media (max-width: 720px) { .sf-banner { flex-wrap: wrap; } .sf-banner span { flex: 1 1 100%; } .sf-banner .gs-x { position: absolute; top: 6px; right: 6px; } .sf-banner { position: relative; padding-right: 34px; } }
.m-phone #btn-settle { display: none; }   /* no room on a phone's top bar; the setup runs by itself on first launch */

/* a book with changes on this phone/iPad that aren't in Dropbox yet */
.project-card .pc-unsynced { color: #b8372a; font-size: 12.5px; font-weight: 600; margin-top: 6px; }
:root[data-theme="dark"] .project-card .pc-unsynced { color: #ff8a7a; }
.mp-opt-sep { width: 1px; align-self: stretch; margin: 4px 4px; background: var(--line); }
.mp-opts .chip.act { border-style: dashed; }

/* ================= BUILD ================= */
.bd-rune-ic { font-family: "Segoe UI Historic", "Noto Sans Runic", Georgia, serif; font-weight: 700; color: var(--accent); }
.bd-row { margin-top: 6px; }
.bd-row h1 { font-size: 17px; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.bd-card { position: relative; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; transition: border-color .12s, transform .12s; outline: none; }
.bd-card:hover, .bd-card:focus-visible { border-color: var(--accent); transform: translateY(-1px); }
.bd-thumb { aspect-ratio: 16 / 11; background: #efe6d2; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); }
.bd-thumb img { width: 100%; height: 100%; object-fit: contain; }
.bd-thumb.empty span { font-size: 38px; opacity: .7; }
.bd-ct { padding: 9px 12px 11px; display: flex; flex-direction: column; min-width: 0; }
.bd-ct b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-ct span { color: var(--muted); font-size: 12px; }
.bd-more { position: absolute; top: 6px; right: 6px; background: var(--paper); opacity: 0; }
.bd-card:hover .bd-more, .bd-card:focus-within .bd-more { opacity: 1; }
@media (pointer: coarse) { .bd-more { opacity: 1; } }
.bd-radio { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; font-weight: 400; cursor: pointer; }
.bd-radio input { margin-top: 3px; }
.bd-check { display: flex; gap: 8px; align-items: center; margin: 6px 0; cursor: pointer; font-size: 13.5px; }
.bd-top .tb-right { gap: 6px; }
.bd-extra:empty { display: none; }
.bd-main { flex: 1; min-height: 0; overflow: auto; background: var(--bg); position: relative; }
.bd-main > .mp-view { height: 100%; }
#bd-saved { color: var(--muted); font-size: 12px; margin-left: 8px; }
.br-wrap h3, .ar-side h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 16px 0 6px; font-weight: 700; }
.br-wrap h3:first-child, .ar-side h3:first-child { margin-top: 0; }
.ar-side h3 small { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* magic system */
.bm-page { max-width: 860px; margin: 0 auto; padding: 22px 24px 60px; display: flex; flex-direction: column; gap: 14px; }
.bm-intro { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13.5px; }
.bm-intro b { color: var(--text); }
.bm-bar { height: 5px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.bm-bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.bm-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.bm-card h2 { font-size: 16px; margin: 0 0 6px; }
.bm-help { color: var(--muted); font-size: 13px; margin: 0 0 10px; line-height: 1.45; }
.bm-q { margin-top: 12px; }
.bm-q label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
.bm-card textarea, .bm-card input:not([type]), .bm-card input[type=number], .bm-card select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; outline: none; }
.bm-card textarea { resize: vertical; font: 14px/1.5 Georgia, serif; }
.bm-card textarea:focus, .bm-card input:focus, .bm-card select:focus { border-color: var(--accent); }
.bm-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.bm-li { display: flex; gap: 8px; align-items: center; }
.bm-li span { color: var(--muted); }
.bm-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.bm-row { display: grid; grid-template-columns: minmax(120px, 1fr) 150px 2fr auto; gap: 8px; align-items: center; }
.bm-row:not(:has(select)) { grid-template-columns: minmax(120px, 1fr) 2.2fr auto; }
.bm-name { font-weight: 600; }
.bm-rules { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.bm-rule { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.bm-rule.off .bm-rt { opacity: .45; }
.bm-rt { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; line-height: 2; }
.bm-rt select, .bm-rt input[type=number] { width: auto !important; padding: 3px 6px !important; font-weight: 600; }
.bm-rt input[type=number] { width: 56px !important; }
.bm-spells { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; margin-bottom: 10px; }
.bm-spell { border: 1px solid var(--line); border-left: 4px solid #3f9a5a; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; background: var(--bg); }
.bm-spell.bad { border-left-color: #d08a1e; }
.bm-sh { display: flex; gap: 8px; align-items: center; }
.bm-sname { flex: 1; font-weight: 600; }
.bm-pow { display: flex; gap: 5px; align-items: center; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.bm-pow select { width: auto !important; padding: 3px 6px !important; }
.bm-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.bm-chips > span { font-size: 12px; color: var(--muted); width: 62px; }
.bm-chips em { font-size: 12px; color: var(--faint); }
.bm-chips .chip small { opacity: .6; margin-left: 2px; }
.bm-verdict { font-size: 12.5px; }
.bm-spell.good .bm-verdict { color: #2f7d47; }
.bm-spell.bad .bm-verdict { color: #a2620c; }
.bm-find { display: flex; gap: 8px; }
.bm-find select { flex: 1; }
.bm-hits { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 13.5px; }
.bm-hit small { color: var(--muted); margin: 0 6px 0 2px; }
.bm-hit span { color: var(--muted); }
.bm-hit.none span { color: var(--faint); font-style: italic; }

/* runes + sigils */
.br-wrap, .sg-wrap { display: grid; grid-template-columns: 190px minmax(0, 1fr) 290px; gap: 16px; padding: 16px; min-height: 100%; }
.sg-wrap { grid-template-columns: minmax(0, 1fr) 290px; }
.br-list, .br-side, .br-edit, .sg-edit { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-width: 0; }
.br-list { display: flex; flex-direction: column; gap: 10px; }
.br-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; overflow: auto; max-height: 62vh; }
.br-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 4px; border: 1px solid var(--line); border-radius: 8px; background: #f7f0e0; cursor: pointer; color: #2b2118; }
.br-tile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.br-tile span { font-size: 10.5px; color: #6b5a40; font-weight: 600; }
.br-list-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.br-edit, .sg-edit { display: flex; flex-direction: column; gap: 10px; }
.br-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.br-stage { display: flex; justify-content: center; background: #f4ecd8; border-radius: 10px; padding: 14px; }
.br-svg { width: min(100%, 360px); max-height: 52vh; aspect-ratio: auto; touch-action: none; cursor: crosshair; }
.br-dot { fill: #b8a37c; }
.br-hit { stroke: transparent; stroke-width: 9; fill: none; cursor: pointer; }
.br-hit:hover { stroke: rgba(238, 96, 56, .25); }
.br-pv { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3 3; fill: none; }
.br-fields { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; align-items: end; }
.br-fields .br-wide { grid-column: 1 / -1; }
.br-fields input, .br-side input:not([type]), .br-side textarea, .br-side select, .ar-side select, .ar-side input:not([type]) { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; outline: none; }
.br-side textarea { resize: vertical; font: 14px/1.5 Georgia, serif; }
.br-side .field, .ar-side .field { margin-bottom: 8px; }
.br-side input[type=range], .ar-side input[type=range] { width: 100%; }
.br-preview { background: #f4ecd8; border-radius: 10px; padding: 10px; margin: 8px 0; overflow: auto; max-height: 260px; text-align: center; }
.br-preview svg { max-width: 100%; height: auto; }
.sg-stage { background: var(--panel-2); border-radius: 10px; padding: 10px; display: flex; justify-content: center; touch-action: none; cursor: crosshair; }
.sg-stage svg { width: min(100%, 62vh); height: auto; aspect-ratio: 1; border-radius: 6px; }

/* coat of arms */
.ar-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; padding: 16px; min-height: 100%; }
.ar-show { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ar-shield { width: min(100%, 360px); height: min(58vh, 520px); display: flex; justify-content: center; }
.ar-shield svg { filter: drop-shadow(0 3px 6px rgba(0,0,0,.18)); }
.ar-blazon { text-align: center; max-width: 520px; }
.ar-blazon small { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.ar-blazon p { font: italic 18px/1.45 Georgia, serif; margin: 4px 0 0; }
.ar-warn:empty { display: none; }
.ar-warn { max-width: 520px; background: rgba(208, 138, 30, .1); border: 1px solid rgba(208, 138, 30, .4); border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.ar-warn p { margin: 4px 0 0; color: var(--muted); }
.ar-side { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px; overflow: auto; }
.ar-shapes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ar-shape { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 5px; cursor: pointer; }
.ar-shape svg { width: 100%; height: 34px; fill: var(--faint); }
.ar-shape.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.ar-shape.on svg { fill: var(--accent); }
.ar-sw { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-bottom: 8px; }
.ar-extras { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
/* the shared symbol picker (symbols.js) */
.sym-pick .sym-search { width: 100%; margin-bottom: 10px; }
.sym-pick section { margin-bottom: 12px; } .sym-pick h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 6px; }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.sym-b { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); cursor: pointer; font-size: 11px; line-height: 1.15; text-align: center; }
.sym-b svg { width: 36px; height: 36px; } .sym-b:hover { border-color: var(--accent); } .sym-b.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

@media (max-width: 1000px) {
  .br-wrap { grid-template-columns: 150px minmax(0, 1fr); }
  .br-wrap .br-side { grid-column: 1 / -1; }
  .ar-wrap, .sg-wrap { grid-template-columns: 1fr; }
}
.bd-credit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 14px; font-size: 12.5px; color: var(--muted); background: var(--panel); border-bottom: 1px solid var(--line); }
.sym-note { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.bd-credit b { color: var(--text); font-weight: 600; }
#bd-pmenu { display: none; }   /* phones only (rule below) */
@media (max-width: 700px) {
  .br-wrap { grid-template-columns: 1fr; padding: 10px; }
  .br-tiles { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); max-height: 150px; }
  .bm-page { padding: 14px 12px 40px; }
  .bm-row .bm-what, .bm-row select { grid-column: 1 / 2; }
  .bm-spells { grid-template-columns: 1fr; }
  .ar-wrap, .sg-wrap { padding: 10px; }
  .ar-shield { height: 46vh; }
  .bd-top #bd-copy, .bd-top #bd-png, .bd-top #bd-add { display: none; }
  .bd-top #bd-pmenu { display: inline-flex; }
  .bd-top .pl-kind { display: none; }
  .bd-grid { grid-template-columns: repeat(2, 1fr); }
}
.bd-top .tb-left { gap: 10px; flex: 1; min-width: 0; max-width: none; display: flex; align-items: center; }   /* the shared 260px cap cut Build names short */
.bd-top .tb-right { margin-left: auto; display: flex; align-items: center; }
/* iPad width: Copy picture, Save PNG and Add to book fold into ⋯ as on phones, or Random slid over Record */
@media (min-width: 701px) and (max-width: 1000px) { .bd-top #bd-copy, .bd-top #bd-png, .bd-top #bd-add { display: none; } .bd-top #bd-pmenu { display: inline-flex; } }
.bd-main { display: block; }
.sg-wrap h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 16px 0 6px; font-weight: 700; }
.sg-wrap h3:first-child { margin-top: 0; }
.ar-wrap { height: 100%; min-height: 0; }
.ar-show { overflow: auto; }
@media (max-width: 1000px) { .ar-wrap { height: auto; } .ar-show { position: sticky; top: 0; z-index: 2; } .ar-shield { height: 34vh; } .ar-blazon p { font-size: 15px; } }
@media (max-width: 700px) {
  #bd-saved { display: none; }
  .bd-top { gap: 4px; padding: 0 6px; }
  .bd-top .pl-title { min-width: 60px; font-size: 14px; }
  .bd-top .tb-right .btn { padding: 5px 9px; }
  .bd-tools { grid-template-columns: 1fr 1fr; gap: 8px; }
  .bd-tools .pl-tool { padding: 12px; }
  .bd-tools .pl-tool em { display: none; }
  .br-stage { padding: 6px; }
  .br-svg { max-height: 38vh; }
}

/* 0.44.1: edge cases from the layout sweep */
.project-grid { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.project-card { min-width: 0; }
.project-card h3 { overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 720px) { .project-grid { grid-template-columns: minmax(0, 1fr); } }
html.touch-device .mp-top { padding-right: 62px; }
#build-screen .mp-top { padding-right: 14px !important; }   /* no floating ✕ over Build's maps (mobile.js) */
.pl-stats { flex-wrap: wrap; }
@media (max-width: 520px) { .pl-stats div { min-width: 0; flex: 1 1 40%; } }
.pl-title, #bd-title { text-overflow: ellipsis; }
.bd-thumb { position: relative; overflow: hidden; min-height: 0; }
.bd-thumb img { position: absolute; inset: 0; }
html.web .lib-head { padding-top: calc(18px + env(safe-area-inset-top)); padding-left: max(32px, env(safe-area-inset-left)); padding-right: max(32px, env(safe-area-inset-right)); }
.toasts { bottom: calc(44px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); }
@media (max-width: 700px) {
  html.web .lib-head { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .bd-top .tb-left { min-width: 0; flex: 1 1 auto; }
  .bd-top .pl-title { min-width: 0; width: 100%; }
  .bd-extra .btn { font-size: 0; padding: 5px 8px; }
  .bd-extra .btn::first-letter { font-size: 15px; }
  .bm-row:not(:has(select)) .bm-what { grid-column: 1 / -1; }
  .bm-row { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .bm-sh { flex-wrap: wrap; }
  .bm-sname { min-width: 0; flex: 1 1 140px; }
  .bm-chips > span { width: 100%; }
  .bm-chips .chip { padding: 3px 9px; font-size: 12.5px; }
}
@media (pointer: coarse) {
  #br-undo, #sg-undo, .gs-x { min-width: 40px; min-height: 40px; }
  .bd-check input, .bm-on input { width: 20px; height: 20px; }
  .mp-top .btn.small, .mp-top .icon-btn.small, .mp-top select { min-height: 36px; }
}
@media (max-width: 700px) {
  .bm-row, .bm-row:not(:has(select)) { grid-template-columns: minmax(0, 1fr) auto; }
  .bm-row .bm-name { grid-column: 1; grid-row: 1; }
  .bm-row .icon-btn { grid-column: 2; grid-row: 1; }
  .bm-row select { grid-column: 1 / -1; grid-row: 2; width: 100% !important; }
  .bm-row .bm-what { grid-column: 1 / -1; grid-row: 3; }
  .bm-row:not(:has(select)) .bm-what { grid-row: 2; }
  .bm-chips .chip { width: auto !important; flex: 0 0 auto !important; }
}
@media (pointer: coarse) { .mp-hint { display: none; } #dash-history { display: inline-block; padding: 10px 6px; margin: -10px -6px; } .bd-check { min-height: 36px; } }
.bm-chips .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-card .pc-elsewhere { color: #a2620c; font-size: 12.5px; font-weight: 600; margin-top: 6px; }
:root[data-theme="dark"] .project-card .pc-elsewhere { color: #f0b45a; }
.dev-tag { display: inline-block; margin-left: 8px; padding: 2px 7px; border-radius: 6px; background: #e8590c; color: #fff; font: 700 11px/1.4 system-ui, sans-serif; letter-spacing: .8px; vertical-align: middle; }
html.flavor-dev .lib-head { border-bottom: 3px solid #e8590c; }
html.flavor-dev .topbar { box-shadow: inset 0 3px 0 #e8590c; }

/* name chips (timeline event characters, chapters) */
.chipin { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: text; }
.chipin:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.chipin-c { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 11px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 16%, var(--paper)); color: var(--text); font-size: 13.5px; font-weight: 500; }
.chipin-c button { border: 0; background: none; color: var(--muted); font-size: 15px; line-height: 1; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; }
.chipin-c button:hover { background: rgba(0,0,0,.08); color: var(--text); }
.chipin-w { position: relative; flex: 1; min-width: 120px; }
.chipin-in { width: 100%; border: 0 !important; outline: none; background: transparent; padding: 4px 2px !important; font: inherit; color: var(--text); box-shadow: none !important; }
.chipin-s { position: absolute; left: 0; top: calc(100% + 6px); min-width: 200px; max-height: 220px; overflow: auto; z-index: 50; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; }
.chipin-s.hidden { display: none; }
.chipin-s button { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--text); font: inherit; font-size: 14px; }
.chipin-s button.on, .chipin-s button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.ev-chs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; min-height: 28px; align-items: center; }
#ev-ch-add { max-width: 280px; }
.tl-fbtn.on { border-color: var(--accent); color: var(--accent); }
.tl-fmenu { position: fixed; z-index: 120; width: 260px; max-height: 60vh; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.tl-fmenu .tl-fmode { align-self: flex-start; }
.tl-flist { overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.tl-flist .check { display: flex; gap: 8px; align-items: center; padding: 5px 4px; border-radius: 6px; cursor: pointer; }
.tl-flist .check:hover { background: var(--panel-2); }
.tl-ffoot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 6px; }
.dial-copy { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 3px 4px; margin-left: 2px; border-radius: 6px; vertical-align: -2px; }
.dial-copy:hover { color: var(--accent); background: var(--panel-2); }
@media (pointer: coarse) { .dial-copy { padding: 8px; margin: -6px -4px -6px 0; } }

/* ---- "Not recording" reminder (Proof of writing, a setting per book) */
.pf-remind { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 10px;
  padding: 7px 8px 7px 16px; border-radius: 999px; background: #d64535; color: #fff; box-shadow: 0 6px 22px rgba(150, 30, 20, .35); font-size: 14px; animation: pf-remind-in .3s ease-out; }
.pf-remind { cursor: pointer; animation: pf-remind-in .3s ease-out, pf-remind-pulse 2.2s ease-in-out .3s infinite; }
.pf-remind .pf-rt { display: flex; flex-direction: column; line-height: 1.2; }
.pf-remind .pf-rt small { opacity: .85; font-size: 12px; }
.pf-remind b { letter-spacing: .06em; text-transform: uppercase; font-size: 13px; }
.pf-remind.paused { background: #d9822b; box-shadow: 0 6px 22px rgba(160, 90, 20, .35); }
.pf-remind.paused .btn.primary { color: #a45d15; }
@keyframes pf-remind-pulse { 50% { opacity: .78; } }
/* phone: sit above the bottom bar, full width, one line (the book's name is already at the top) */
@media (max-width: 720px) {
  .pf-remind { left: 10px; right: 10px; transform: none; bottom: calc(env(safe-area-inset-bottom) + 64px); padding: 6px 6px 6px 14px; animation: pf-remind-pulse 2.2s ease-in-out infinite; }
  .pf-remind .pf-rt { flex: 1; min-width: 0; } .pf-remind .pf-rt small { display: none; }
  .pf-remind .btn { white-space: nowrap; }
}
/* the whole window gets a glowing edge while it isn't recording (red) or is paused (amber) */
body.pf-alert::after, body.pf-alert-paused::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 2000; border-radius: 8px; animation: pf-edge 2.2s ease-in-out infinite; }
body.pf-alert::after { box-shadow: inset 0 0 0 3px rgba(214, 69, 53, .85), inset 0 0 28px rgba(214, 69, 53, .45); }
body.pf-alert-paused::after { box-shadow: inset 0 0 0 3px rgba(217, 130, 43, .85), inset 0 0 28px rgba(217, 130, 43, .45); }
@keyframes pf-edge { 50% { opacity: .55; } }
.pf-remind .pf-dot { width: 11px; height: 11px; border-radius: 50%; background: #fff; display: inline-block; animation: pfpulse 1.2s ease-in-out infinite; }
.pf-remind .pf-dot.off { background: transparent; border: 2px solid #fff; box-sizing: border-box; animation: none; }
.pf-remind .btn.primary { background: #fff; color: #b8372a; border-color: #fff; }
.pf-remind .icon-btn { color: #fff; opacity: .8; } .pf-remind .icon-btn:hover { opacity: 1; background: rgba(255, 255, 255, .15); }
.pf-remind.hidden { display: none; }
body.writer .pf-remind { bottom: 18px; }
@keyframes pf-remind-in { from { transform: translate(-50%, 12px); opacity: 0; } }
.pf-remind-set { display: block; margin-top: 12px; }
.statusbar .st-proof.on.paused, .rec-btn.on.paused { background: #8a6d1f; border-color: #8a6d1f; }
.st-proof.on.paused .pf-dot { animation: none; background: transparent; border: 2px solid #fff; box-sizing: border-box; }

/* editing the sheet of Characters, Places or Items: only the fields and headings */
.cs-dlg.sheet-only .cs-name, .cs-dlg.sheet-only .cs-single-f { display: none; }

/* moving from the old web address to unwip.app */
.mv-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px auto 0; max-width: 980px; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--line); font-size: 14px; }
.mv-banner > span { flex: 1; min-width: 220px; }
.mv-banner.hidden { display: none; }
.mv-dlg .mv-steps { background: var(--panel); border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.mv-dlg .mv-steps ol { margin: 6px 0 0; padding-left: 20px; }
.sy-note.sy-alert { background: #fff4d6; color: #6b4d00; border: 1px solid #f0d58a; border-radius: 10px; padding: 10px 14px; }
:root[data-theme="dark"] .sy-note.sy-alert { background: #3a3020; color: #f3dca0; border-color: #6b5a2c; }
.bm-howto { border-color: var(--accent, #5b7bd5); }
.bm-howto ol { margin: 8px 0 10px; padding-left: 22px; line-height: 1.5; }
.bm-howto li { margin-bottom: 4px; }
.bm-howto-show { font-size: 12.5px; margin-top: 6px; }
#ar-size { width: 100%; }

/* 0.44.12: letter effects that look clearly different from each other, and shown above dialogs (so the demo shows them) */
.tw-layer { z-index: 990; }
.tw-ghost.fade { animation: tw-fade .55s ease-in both; }
.tw-ghost.rise { animation: tw-rise .42s cubic-bezier(.2,1.3,.4,1) both; }
.tw-ghost.drop { animation: tw-drop .55s linear both; }
.tw-ghost.pop { animation: tw-pop .38s ease-out both; }
.tw-ghost.ink { animation: tw-ink .7s ease-out both; }
.tw-ghost.strike { animation: tw-strike .26s ease-out both; }
.tw-ghost.glow { animation: tw-glow .8s ease-out both; }
.tw-ghost.spin { animation: tw-spin .45s cubic-bezier(.2,1.2,.4,1) both; }
.tw-ghost.scatter { animation: tw-scatter .45s cubic-bezier(.2,1.1,.3,1) both; }
@keyframes tw-fade { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes tw-rise { 0% { opacity: 0; transform: translateY(1.1em); } 70% { opacity: 1; transform: translateY(-.14em); } 100% { opacity: 1; transform: none; } }
@keyframes tw-drop { 0% { opacity: 0; transform: translateY(-1.8em) rotate(-14deg); animation-timing-function: ease-in; } 45% { opacity: 1; transform: translateY(0) rotate(3deg); animation-timing-function: ease-out; } 65% { transform: translateY(-.32em) rotate(-2deg); animation-timing-function: ease-in; } 82% { transform: translateY(0); animation-timing-function: ease-out; } 91% { transform: translateY(-.08em); } 100% { opacity: 1; transform: none; } }
@keyframes tw-pop { 0% { opacity: 0; transform: scale(3.2); } 60% { opacity: 1; transform: scale(.8); } 80% { transform: scale(1.12); } 100% { opacity: 1; transform: none; } }
@keyframes tw-ink { 0% { opacity: 0; transform: scale(1.9); filter: blur(9px); color: var(--ink-blot, #111); } 35% { opacity: .9; transform: scale(1.25); filter: blur(4px); } 100% { opacity: 1; transform: none; filter: blur(0); } }
@keyframes tw-strike { 0% { opacity: 1; transform: translateY(-.55em) scale(1.35) rotate(var(--tilt, 0deg)); color: var(--strike, #000); text-shadow: 0 0 2px var(--strike, #000); } 35% { transform: translateY(.1em) scale(.92) rotate(var(--tilt, 0deg)); } 55% { transform: translate(-.04em, 0) rotate(var(--tilt, 0deg)); } 75% { transform: translate(.03em, 0); } 100% { opacity: 1; transform: none; } }
@keyframes tw-glow { 0% { opacity: 0; color: #ffd27a; text-shadow: 0 0 .5em #ff9a2e, 0 0 1em #ffb347; transform: scale(1.15); } 30% { opacity: 1; color: #ffcf70; text-shadow: 0 0 .45em #ff9a2e, 0 0 .9em #ffb347; } 100% { text-shadow: 0 0 0 transparent; transform: none; } }
@keyframes tw-spin { 0% { opacity: 0; transform: scale(.1) rotate(-540deg); } 100% { opacity: 1; transform: none; } }
@keyframes tw-scatter { 0% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -1em)) rotate(var(--rot, 0deg)) scale(1.3); } 100% { opacity: 1; transform: none; } }
:root[data-theme="dark"] { --ink-blot: #fff; }

/* Build from inside a book */
.bd-pick h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.bd-pick-list { display: flex; flex-direction: column; gap: 4px; }
.bd-pick-row { display: flex; align-items: center; gap: 6px; }
.bd-pick-open { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--text); cursor: pointer; }
.bd-pick-open:hover { border-color: var(--accent, #5b7bd5); }
.bd-pick-open b { display: block; } .bd-pick-open small { color: var(--muted); }
.bd-pick-th { width: 46px; height: 34px; border-radius: 6px; overflow: hidden; display: grid; place-items: center; background: var(--panel); flex: none; font-size: 18px; }
.bd-pick-th img { width: 100%; height: 100%; object-fit: cover; }
.bd-pick-win { font-size: 17px; }
.bd-pick-new { display: flex; flex-wrap: wrap; gap: 6px; }
.ctx-menu { max-height: calc(100vh - 16px); overflow-y: auto; }
.mp-selbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 4px; padding: 5px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mp-selbar.hidden { display: none; }

/* the Record button in the library, Build and Play top bars: a touch taller to sit with the other buttons */
.rec-btn { height: 30px; margin-right: 6px; font-size: 13px; white-space: nowrap; flex: none; }
@media (max-width: 640px) { .rec-btn .rb-label { display: none; } .rec-btn { padding: 0 9px; } }
/* Build's top bar: the title gives way so "Saving…" never slides under the Record button */
.bd-top .tb-left .pl-title { flex: 0 1 300px; min-width: 60px; }
#bd-saved { flex: none; white-space: nowrap; }
.pf-left { font-size: 12px; color: var(--muted); margin-top: -4px; } .pf-left:empty { display: none; }
.pf-table .pf-acts { white-space: nowrap; } .pf-table .pf-acts .btn + .btn { margin-left: 4px; }
/* ---- Licence key */
.lic-dialog textarea { width: 100%; box-sizing: border-box; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--text); resize: vertical; }
.lic-msg { min-height: 1.4em; margin: 8px 0 0; }
.lic-msg.bad { color: #c23b2c; }
.lic-msg.good, .lic-ok { color: #2f7d4a; }
.lic-bar { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 900; display: flex; align-items: center; gap: 12px; max-width: min(760px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(0,0,0,.18); font-size: 14px; }
.lic-bar .btn { flex: none; }
.brand-beta { align-self: center; margin: 0 2px 0 6px; padding: 2px 8px; border-radius: 999px; font: 600 11px/1.4 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: #b4472a; background: rgba(238, 96, 56, .13); }
.page-sheet { position: absolute; top: 16px; right: 64px; border: 0; background: transparent; color: var(--faint); border-radius: 7px; padding: 5px 8px; cursor: pointer; font-size: 12px; }
.page-sheet:hover { background: var(--panel-2); color: var(--text); }
/* sprints: how it went */
.sp-howwent { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2, transparent); text-align: left; }
.sp-howwent > label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.sp-howwent .chip-row { flex-wrap: wrap; }
.sp-howwent input { width: 100%; margin-top: 10px; box-sizing: border-box; }
.spr-how { font-size: 12px; }
.spr-how .spr-tag { display: inline-block; padding: 1px 7px; margin: 1px 4px 1px 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.spr-how small { display: block; color: var(--muted); }
/* magic system: the picture */
.bm-pic-wrap { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.bm-pic { flex: 0 1 380px; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: transparent; cursor: zoom-in; line-height: 0; }
.bm-pic img { width: 100%; height: auto; display: block; }
.bm-pic-opts { flex: 1 1 240px; min-width: 0; }
.bm-pic-opts > label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.bm-pic-opts > label:first-child { margin-top: 0; }
.bm-pic-opts .chip-row { flex-wrap: wrap; }
.bm-sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid; margin-right: 6px; vertical-align: -1px; }
.bm-pic-show { display: flex; flex-direction: column; gap: 4px; }
.bm-big img { width: 100%; height: auto; border-radius: 10px; display: block; }
/* continuity pass */
.cn-lead { margin: 0 0 14px; color: var(--muted); }
.cn-facts { display: flex; flex-direction: column; gap: 6px; }
.cn-row { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr 100px 28px; gap: 8px; align-items: center; }
.cn-th { font-size: 12px; color: var(--muted); font-weight: 600; }
.cn-row input { width: 100%; box-sizing: border-box; min-width: 0; }
.cn-found { font-size: 12.5px; color: var(--muted); }
.cn-ok { color: #2f7d4a; }
.cn-acts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 12px 0 6px; }
.cn-from select { margin-left: 6px; max-width: 220px; }
@media (max-width: 700px) { .cn-row { grid-template-columns: 1fr 1fr 28px; } .cn-row > :nth-child(3), .cn-row > :nth-child(4) { grid-column: span 1; } .cn-th > :nth-child(3), .cn-th > :nth-child(4) { display: none; } }
.cn-bar { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 880; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; max-width: min(860px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.cn-info { flex: 1 1 260px; min-width: 0; }
.cn-what { font-size: 15px; }
.cn-what small { display: block; color: var(--muted); font-size: 12px; }
.cn-rw { color: var(--muted); font-size: 13px; }
.cn-where { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cn-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
::highlight(cn-hit) { background-color: rgba(238, 96, 56, .3); }
/* LitRPG: [system messages] look like system boxes while writing (only on screen; the book keeps plain brackets) */
body.litrpg .editor p.lit-sys, body.litrpg #editor p.lit-sys { margin: .5em auto; padding: .35em .9em; max-width: 92%; border: 1px solid rgba(80, 140, 230, .55); border-left: 4px solid rgba(80, 140, 230, .85); border-radius: 6px; background: rgba(80, 140, 230, .08); text-indent: 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88em; letter-spacing: .01em; }
.lit-sub { margin: 4px 0 6px 26px; display: flex; flex-direction: column; gap: 4px; }
.lit-rows { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.lit-row { display: grid; grid-template-columns: 120px 1fr 28px; gap: 8px; }
.lit-row input { min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.lit-acts { display: flex; gap: 8px; flex-wrap: wrap; }
/* LitRPG ledger */
.rp-litrpg { display: none; } body.litrpg .rp-litrpg { display: inline-flex; }
.lg-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.lg-body { max-height: 62vh; overflow: auto; }
.lg-body h4 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.lg-list { display: flex; flex-direction: column; gap: 6px; }
.lg-flag { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--text); cursor: pointer; font: inherit; }
.lg-flag:hover { border-color: var(--accent); }
.lg-flag > span:first-child { flex: none; width: 20px; text-align: center; font-weight: 700; }
.lg-flag.down > span:first-child { color: #c23b2c; } .lg-flag.jump > span:first-child { color: #b07a12; }
.lg-flag small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.lg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lg-table th { text-align: left; font-weight: 600; padding: 6px 10px 6px 0; width: 30%; vertical-align: middle; }
.lg-table td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.lg-table tr:last-child td { border-bottom: 0; }
.lg-spark { color: var(--accent); display: block; }
.lg-vals { font-size: 13px; }
.lg-ok { color: #2f7d4a; }
.lg-done { color: #2f7d4a; font-size: 12px; font-weight: 500; } .lg-open { color: var(--muted); font-size: 12px; font-weight: 500; }
.lg-warn { color: #b07a12; font-size: 12px; margin-left: 6px; }
/* Build › Character sheet */
.bs-page { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; max-width: 1240px; margin: 0 auto; padding: 18px; }
@media (max-width: 900px) { }
.bs-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.bs-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); flex: 1 1 140px; }
.bs-grid input { font-size: 14px; }
.bs-row { display: grid; grid-template-columns: 1fr 96px 96px 28px; gap: 8px; margin-bottom: 6px; align-items: center; }
.bs-row input { min-width: 0; }
.bs-th { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.bs-levels { max-height: 280px; overflow: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; }
.bs-levels table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.bs-levels th { position: sticky; top: 0; background: var(--paper); text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); font-weight: 600; }
.bs-levels td { text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.bs-levels th:first-child, .bs-levels td:first-child { text-align: left; }
.bs-levels tr { cursor: pointer; } .bs-levels tr.on td { background: var(--accent-soft); font-weight: 600; }
.bs-stick { position: sticky; top: 12px; }
.bs-lv { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.bs-lv input { flex: 1; } .bs-lv b { min-width: 2.5em; color: var(--text); }
.bs-shot img { width: 100%; height: auto; display: block; border-radius: 10px; margin-bottom: 10px; }
.bs-lines { white-space: pre-wrap; font-size: 12.5px; background: var(--panel-2, var(--bg)); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 6px 0 8px; }
/* name ideas */
.page-names { right: 210px; }
.ng-opts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.ng-row2 { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.ng-cols { display: grid; gap: 12px; }
.ng-cols.n2 { grid-template-columns: 1fr 1fr; } .ng-cols.n3 { grid-template-columns: repeat(3, 1fr); } .ng-cols.n4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .ng-cols.n3, .ng-cols.n4 { grid-template-columns: 1fr 1fr; } }
.ng-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ng-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ng-name { text-align: left; padding: 5px 9px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer; font: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ng-name:hover { background: var(--panel-2); } .ng-name.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.ng-own { margin-top: 4px; font-size: 13px; min-width: 0; }
.ng-preview { margin-top: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ng-full { font-family: var(--serif, Georgia, serif); font-size: 24px; }
.ng-h { margin-left: 12px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.ng-acts { display: flex; gap: 6px; }
.bs-name { display: flex; gap: 6px; } .bs-name input { flex: 1; min-width: 0; }
/* system-style letter effects */
.tw-ghost.decode { animation: tw-decode .28s steps(1) both; color: var(--accent) !important; }
.tw-ghost.scan { animation: tw-scan .32s linear both; }
.tw-ghost.glitch { animation: tw-glitch .3s steps(2, end) both; }
@keyframes tw-decode { 0% { opacity: .55; } 100% { opacity: 1; } }
@keyframes tw-scan { 0% { clip-path: inset(0 0 100% 0); filter: drop-shadow(0 1px 0 var(--accent)); } 85% { clip-path: inset(0 0 0 0); filter: drop-shadow(0 1px 0 var(--accent)); } 100% { clip-path: inset(0 0 0 0); filter: none; } }
@keyframes tw-glitch { 0% { opacity: .2; transform: translateX(.08em); text-shadow: -.08em 0 rgba(255, 60, 120, .75), .08em 0 rgba(60, 200, 255, .75); } 40% { opacity: 1; transform: translateX(-.05em); text-shadow: .05em 0 rgba(255, 60, 120, .6), -.05em 0 rgba(60, 200, 255, .6); } 100% { transform: none; text-shadow: none; } }
/* cursors */
.tw-caret.under { border-radius: 0; }
.tw-caret.glow { box-shadow: 0 0 6px var(--accent), 0 0 14px var(--accent); }
/* the game-system themes: a thin edge of light round the page, nothing more */
:root[data-skin="sysblue"] .page, :root[data-skin="terminal"] .page, :root[data-skin="neon"] .page { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent), 0 0 28px color-mix(in srgb, var(--accent) 9%, transparent); }
:root[data-skin="status"] .page { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), 0 6px 22px rgba(30, 60, 110, .08); }
/* Witch and Infernal: candle-light round the page and a faint star in the corner */
:root[data-skin="witch"] .page, :root[data-skin="infernal"] .page { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 40px color-mix(in srgb, var(--accent) 10%, transparent); background-repeat: no-repeat; background-position: right 22px bottom 22px; background-size: 120px; }
:root[data-skin="witch"] .page { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-100 -100 200 200' fill='none' stroke='%23d6a95b' stroke-width='3' opacity='.09'%3E%3Ccircle r='95'/%3E%3Cpath d='M0-95L55.8 76.9L-90.4-29.4H90.4L-55.8 76.9Z'/%3E%3C/svg%3E"); }
:root[data-skin="infernal"] .page { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-100 -100 200 200' fill='none' stroke='%23e0452f' stroke-width='3' opacity='.09'%3E%3Ccircle r='95'/%3E%3Ccircle r='86'/%3E%3Cpath d='M0 86L-50.5-69.6L81.8 26.6H-81.8L50.5-69.6Z'/%3E%3C/svg%3E"); }
:root[data-skin="witch"] ::selection { background: #4a3658; }
:root[data-skin="infernal"] ::selection { background: #5a1c16; }
:root[data-skin="terminal"] ::selection { color: #0a0d0a; background: #5fd38a; }
/* rune alphabets on a dark panel (System / circuit look) */
.br-dark .br-stage, .br-dark .br-preview { background: #121418; }
.br-dark .br-tile { background: #1a1d23; color: #e4e7ec; }
.br-dark .br-tile span { color: #8fb6d6; }
.br-dark .br-dot { fill: #2c4a68; }
/* System window: a game interface while you draw, not only in the finished picture: grid lines, a cyan frame with
   corner brackets and a readout. (The plain dark panel stays a quiet charcoal.) */
.br-system .br-stage, .br-system .br-preview { position: relative; background-color: #07101e; background-image: linear-gradient(rgba(95, 208, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(95, 208, 255, .06) 1px, transparent 1px); background-size: 22px 22px; border: 1px solid rgba(95, 208, 255, .45); box-shadow: inset 0 0 30px rgba(95, 208, 255, .12); }
.br-system .br-stage::before { content: 'SYSTEM // RUNE EDITOR'; position: absolute; top: 8px; left: 12px; font: 600 10px/1 Menlo, Consolas, monospace; letter-spacing: 2px; color: #5fd0ff; opacity: .8; pointer-events: none; }
.br-system .br-stage::after { content: ''; position: absolute; inset: 4px; pointer-events: none; background: linear-gradient(#5fd0ff, #5fd0ff) top left / 18px 2px, linear-gradient(#5fd0ff, #5fd0ff) top left / 2px 18px, linear-gradient(#5fd0ff, #5fd0ff) top right / 18px 2px, linear-gradient(#5fd0ff, #5fd0ff) top right / 2px 18px, linear-gradient(#5fd0ff, #5fd0ff) bottom left / 18px 2px, linear-gradient(#5fd0ff, #5fd0ff) bottom left / 2px 18px, linear-gradient(#5fd0ff, #5fd0ff) bottom right / 18px 2px, linear-gradient(#5fd0ff, #5fd0ff) bottom right / 2px 18px; background-repeat: no-repeat; }
.br-system .br-tile { background: #07101e; border-color: rgba(95, 208, 255, .35); color: #cfe9ff; }
.br-system .br-tile span { color: #5fd0ff; font-family: Menlo, Consolas, monospace; }
.br-system .br-dot { fill: #1d4466; }
/* Build › Insignia */
.in-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; max-width: 1240px; margin: 0 auto; padding: 18px; }
.in-left { position: sticky; top: 0; align-self: start; }
.in-shot img { width: 100%; max-width: 480px; display: block; margin: 0 auto; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
@media (max-width: 900px) { .in-page { grid-template-columns: minmax(0, 1fr); padding: 12px; } .in-left { position: static; } .in-shot img { max-width: 280px; } .in-left .bm-help { margin-top: 8px; } }
.in-sch i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 2px; border: 1px solid rgba(0,0,0,.2); vertical-align: -1px; }
.in-sch i:last-of-type { margin-right: 6px; }
.in-toggles { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0 6px; }
.in-w { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.in-cols { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--muted); }
.in-cols label { display: flex; align-items: center; gap: 6px; }

/* Settings › LitRPG: tick boxes inside a field look like the other tick boxes, at every width */
#s-litrpg label.check, #s-licence label.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 400; margin: 0 0 8px; }
#s-litrpg label.check input { width: auto; flex: none; margin: 0; }
#s-litrpg .lit-sub { padding-left: 4px; }
.modal .form-grid, .modal .form-grid > * { min-width: 0; }

/* phones: Record sits in the bar under the book's list, since the status bar is hidden there */
.binder-foot .bf-proof { display: none; }
@media (max-width: 720px) { .binder-foot .bf-proof { display: inline-flex; align-items: center; justify-content: center; } }
.bf-proof .pf-dot { width: 11px; height: 11px; border-radius: 50%; background: #d64535; display: inline-block; }
.bf-proof .pf-dot.off { background: transparent; border: 2px solid currentColor; box-sizing: border-box; }
.bf-proof.on .pf-dot { animation: pfpulse 1.6s ease-in-out infinite; }
.pf-books { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
/* dialogs fit the part of the screen you can actually see (iPhone's 100vh includes the area under Safari's bars),
   and the last thing in a long dialog can always be scrolled fully into view (Safari ignores bottom padding there) */
@supports (height: 100dvh) {
  .modal { max-height: calc(100dvh - 60px); }
  .modal.xwide { height: min(760px, calc(100dvh - 60px)); }
  @media (max-width: 720px) { .modal { max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); } }
}
.modal .m-body { min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.modal .m-body::after { content: ''; display: block; height: 16px; flex: none; }
@media (pointer: coarse) { .tip-q { width: 22px; height: 22px; font-size: 12px; } }

/* iPhone and iPad zoom the whole page in when you tap a box with text under 16px; that zoom pushed things off the
   right edge and under the keyboard bar. Boxes you type in are 16px on touch screens. */
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea { font-size: max(16px, 1em) !important; }
}
/* while the iPhone keyboard is up, dialogs sit in the part of the screen you can see (set by mobile.js) */
/* iOS slides the whole page up while selecting or scrolling with the keyboard open (beta, 28 Oct: the top bar and the
   formatting row went off the top of the screen): they stay at the top of what you can see */
html.m-editing .m-phead, html.m-editing .m-fbar { translate: 0 var(--vv-top, 0px); }
html.m-kb-open .modal-back { top: var(--vv-top, 0); bottom: auto; height: var(--vv-h, 100%); align-items: end; padding-bottom: 6px; }
html.m-kb-open .modal { max-height: calc(var(--vv-h, 100vh) - 16px) !important; }
@supports (height: 100dvh) {
  .in-card, .bi-card { max-height: calc(100dvh - 48px); }
  .ctx-menu { max-height: calc(100dvh - 16px); }
  .ch-scroll { max-height: calc(100dvh - 230px); }
}
.in-card > *:last-child, .bi-card .bi-body { padding-bottom: max(12px, env(safe-area-inset-bottom)); }

/* ---------- phones: Build's character sheet in one column that fits */
@media (max-width: 900px) {
  .bs-page { grid-template-columns: minmax(0, 1fr); padding: 10px; gap: 12px; }
  .bs-page > *, .bs-page .bm-card { min-width: 0; }
  .bs-stick { position: static; }
}
@media (max-width: 560px) {
  .bs-row { grid-template-columns: minmax(0, 1fr) 64px 64px 24px; gap: 6px; }
  .bs-grid label { flex: 1 1 100%; }
  .bs-levels { overflow: auto; }
  .bs-levels table { width: max-content; min-width: 100%; }
}

/* ---------- phones: Play's writing screen. The bar becomes two rows, the exercise's checklist a short strip at the
   top, and the page takes the rest (side by side left a one-word-wide column and nowhere to write) */
@media (max-width: 720px) {
  #play-screen .pl-top { flex-wrap: wrap; height: auto; min-height: 52px; row-gap: 4px; padding: 6px 8px; padding-top: calc(6px + env(safe-area-inset-top)); }
  #play-screen .pl-top .tb-left { flex: 1 1 100%; gap: 6px; }
  #play-screen .pl-top .pl-kind { display: none; }
  #play-screen .pl-top .pl-title { min-width: 0; max-width: none; position: static; transform: none; }
  #play-screen .pl-top .tb-right { flex: 1 1 100%; margin-left: 0; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
  #play-screen .pl-top .tb-right .rec-btn { margin-right: auto; }
  #play-screen .main { flex-direction: column; }
  #play-screen .pl-side { order: -1; position: static; width: auto !important; max-height: 32vh; max-height: 32dvh; overflow: auto; border-left: 0; border-bottom: 1px solid var(--line); flex: none; }
  #play-screen .pl-wrap { flex: 1; min-height: 0; }
}
/* runes: the whole drawing area is for drawing on touch screens, not scrolling */
.br-stage { touch-action: none; -webkit-user-select: none; user-select: none; }
/* a picture in a chapter is never wider than the page (Build's "Add to book" pictures come with a fixed width) */
.editor img, .pl-editor img, .sp-editor img { max-width: 100%; height: auto; }   /* the split pane is #sp-editor (it said #split-editor, which nothing is) */
/* phones: the map's buttons are one row you swipe along, so the map itself gets the screen */
@media (max-width: 720px) {
  .mp-top { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .mp-top::-webkit-scrollbar { display: none; }
  .mp-top > * { flex: none; }
  .mp-top .mp-title { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mp-top .mp-sp { display: none; }
  /* Done is pinned to the bar's right end, outside the swiping row: "sticky" inside a sideways-scrolling row drifts
     on the iPhone while it moves, then snaps back over the other buttons. The row leaves room at its end for it. */
  .mp-view { position: relative; }
  .mp-top { position: static; }
  .mp-top::after { content: ""; flex: none; width: 10px; height: 1px; }   /* room at the end of the row (a scrolling row ignores its own end padding) */
  .mp-top #mp-done { position: absolute; right: 10px; top: var(--mp-done-top, 8px); z-index: 3; box-shadow: -14px 0 12px 6px var(--bg); }
}

/* ---- Build on a phone: the picture stays pinned at the top while the options scroll (build.js: pin-small when
   scrolled down, pin-open after tapping a small picture, pin-hide while typing). Desktop layouts are untouched. */
@media (max-width: 720px) {
  .bd-main .ar-show, .bd-main .in-left, .bd-main .bs-pin, .bd-main .br-pinbox { position: sticky; top: 0; z-index: 4; }
  .bd-main .in-left { background: var(--bg); padding: 4px 0 8px; box-shadow: 0 8px 10px -10px rgba(0,0,0,.4); }
  .bd-main .bs-right, .bd-main .bs-stick { display: contents; }
  .bd-main .bs-pin { order: -1; box-shadow: 0 8px 10px -10px rgba(0,0,0,.4); }
  .bd-main .br-edit, .bd-main .sg-edit { display: contents; }
  .bd-main .br-pinbox { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 8px 10px -10px rgba(0,0,0,.4); }
  .bd-main .in-shot img { max-height: 34vh; width: auto; max-width: 100%; }
  .bd-main .bs-shot img { max-height: 30vh; width: auto; max-width: 100%; margin: 0 auto 6px; }
  .bd-main .sg-stage svg { width: min(100%, 42vh); }
  .bd-main .br-svg { max-height: 34vh; }
  /* rune alphabets: the list of runes goes under the rune you're drawing */
  .bd-main .br-wrap > .br-edit .br-pinbox { order: 1; }
  .bd-main .br-wrap > .br-list { order: 2; }
  .bd-main .br-wrap > .br-edit .br-fields { order: 3; }
  .bd-main .br-wrap > .br-side { order: 4; }
  /* scrolled down: smaller (coats of arms and character sheets only; sigils, insignia and runes stay the same size) */
  .bd-main.pin-small:not(.pin-open) .ar-shield { height: 20vh; }
  .bd-main.pin-small:not(.pin-open) .ar-blazon, .bd-main.pin-small:not(.pin-open) .ar-warn { display: none; }
  .bd-main.pin-small:not(.pin-open) .ar-show { padding: 8px; }
  .bd-main.pin-small:not(.pin-open) .bs-shot img { max-height: 17vh; }
  .bd-main.pin-small:not(.pin-open) .bs-pin h2 { display: none; }
  /* typing: not pinned, so the keyboard can't hide the field under the picture */
  .bd-main.pin-hide .ar-show, .bd-main.pin-hide .in-left, .bd-main.pin-hide .bs-pin, .bd-main.pin-hide .br-pinbox { position: static; }
}
.bs-stick > .bm-card + .bm-card { margin-top: 14px; }

/* ---- page size (look.js pageZoom): the writing page alone gets bigger; the toolbars keep their size */
#editor-wrap > .page, #pl-wrap > .page { zoom: var(--page-zoom, 1); }
.st-zoomer { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; }
/* the keyboard focus ring sits inside each button, so it can't reach over the % next to it */
.st-zoomer .st-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.st-zoomer .st-btn:focus:not(:focus-visible) { outline: none; }
/* no negative margin here: the plain status buttons pull in 6px each side, which made the − and + hover patches lie over the % */
.st-zoomer .st-btn { padding: 2px 8px; margin: 0; min-width: 0; }
#st-zoom.flash { animation: np-flash .6s ease-out; border-radius: 6px; }
#st-zoom { font-variant-numeric: tabular-nums; min-width: 44px; }
@media (max-width: 720px) { .st-zoomer { display: none; } }


/* Writer mode strip: the status bar rises when the mouse nears the bottom edge, with page size, typewriter, fade, Exit */
.st-writer { display: inline-flex; align-items: center; gap: 12px; margin-right: 8px; }
body:not(.writer) .st-writer { display: none; }
.st-writer .st-btn.on { color: var(--accent); }
.st-writer .st-wexit { border: 1px solid var(--line); margin: 0; padding: 2px 10px; }
body.writer .statusbar.peek { opacity: 1; }
body.writer .statusbar { z-index: 7; }
@media (max-width: 720px) { .st-writer { display: none !important; } }
/* Spark › Interview a character: the questions in the chosen set */
.iv-preview { margin: 12px 0 0; padding: 10px 14px 10px 32px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.iv-preview li + li { margin-top: 3px; }

/* Levels: Focus / Detail / Lore. body.detailed is on for Detail and Lore, body.lore only for Lore.
   Build (in a book's top bar) starts at Detail; the main screen's Play and Build tabs are always there. */
body:not(.detailed) #btn-build-book { display: none; }
#mode-switch button { padding: 5px 4px; }

/* Export: one button, a grouped menu, one line per item; the explanation shows at the bottom */
#btn-export-more { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-left: 0; }
#btn-export-more .ex-btn-ic, #btn-export-more .ex-caret { display: inline-grid; place-items: center; }
#btn-export-more .ex-btn-ic svg { width: 15px; height: 15px; }
#btn-export-more .ex-caret svg { width: 14px; height: 14px; opacity: .85; }
.export-pop.ex-grouped { width: 330px; padding: 4px 6px 0; }
.ex-grp { padding: 10px 10px 3px; font: 700 10.5px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--faint, var(--muted)); }
.ex-grouped .ex-item { align-items: center; padding: 7px 10px; }
.ex-grouped .ex-ic { color: var(--muted); }
.ex-grouped .ex-t b { font-size: 14px; font-weight: 500; }
.ex-grouped .ex-note { position: sticky; bottom: 0; margin: 6px -6px 0; padding: 10px 16px 12px; border-top: 1px solid var(--line); background: var(--bg); min-height: 2.9em; line-height: 1.4; }

/* Two searches, two looks: the top button is "Go to or do" (Ctrl+K), with its own icon and its key written on it;
   the magnifier (bottom of the sidebar) is only ever "find words in my book" */
.tb-btn.tb-cmdk { width: auto; gap: 6px; padding: 0 9px; display: inline-flex; align-items: center; font: 500 12px var(--ui); color: var(--muted); border: 1px solid var(--line); }
.tb-cmdk svg { width: 16px; height: 16px; color: var(--accent); }
.tb-cmdk .cmdk-key { white-space: nowrap; }
.ex-grouped .ex-ic { display: inline-grid; place-items: center; width: 18px; flex: 0 0 18px; margin-top: 0; }
.ex-grouped .ex-ic svg { width: 17px; height: 17px; }
.tb-cmdk .cmdk-lbl { color: var(--text); }
.tb-cmdk .cmdk-key { padding: 1px 5px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); font-size: 11px; }
@media (max-width: 1500px) { .tb-cmdk .cmdk-lbl { display: none; } }

/* Character sheets (Lore): the button on a character's page, and the sheet */
.page-charsheet { position: absolute; top: 14px; left: 18px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--accent); border-radius: 8px; padding: 5px 10px; cursor: pointer; font: 600 12.5px var(--ui); }
.page-charsheet:hover { background: var(--accent-soft); }
.page-charsheet.hidden { display: none; }
.cs { --r-common: #6f685b; --r-uncommon: #2f7a45; --r-rare: #2c5aa0; --r-epic: #7a3d93; --r-legend: #9a5f05; font-family: var(--ui); }
:root[data-theme="dark"] .cs { --r-common: #b8ae9c; --r-uncommon: #6cc488; --r-rare: #7fa8ec; --r-epic: #c58ae0; --r-legend: #f0b44c; }
.cs-head { text-align: center; margin: -4px 0 12px; }
.cs-name { font: 700 30px/1.1 var(--serif, Georgia, serif); color: var(--accent); }
.cs-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.cs-time { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.cs-when { flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px; border-radius: 9px; background: var(--paper); border: 1px solid var(--line); font-size: 13.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cs-when b, .cs-when svg { color: var(--accent); flex: 0 0 auto; }
.cs-when span:last-child { overflow: hidden; text-overflow: ellipsis; }
.cs-nav { width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line); background: var(--paper); color: var(--text); font-size: 18px; cursor: pointer; }
.cs-nav:disabled { opacity: .35; cursor: default; }
.cs-track { flex: 2 1 160px; position: relative; height: 40px; margin: 0 14px; }
.cs-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 10px); }
.cs-track i { position: absolute; left: 0; top: 50%; height: 3px; margin-top: -1.5px; background: var(--accent); }
.cs-stop { position: absolute; top: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; border: 0; background: transparent; padding: 0; cursor: pointer; }
.cs-stop span { position: absolute; left: 10px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); box-sizing: border-box; }
.cs-stop.on span { left: 7px; top: 7px; width: 18px; height: 18px; background: var(--accent); border-color: var(--paper); box-shadow: 0 0 0 2px var(--accent); }
.cs-tabs { display: flex; margin: 12px 0 14px; border-bottom: 1px solid var(--line); }
.cs-tabs button { flex: 1; min-height: 42px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font: 600 14px var(--ui); cursor: pointer; }
.cs-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.cs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(58px, auto); gap: 10px; }
.cs-frame { grid-column: 2; grid-row: 1 / span 4; position: relative; border: 1.5px solid var(--accent); border-radius: 12px; background: var(--panel-2); display: flex; flex-direction: column; align-items: center; overflow: hidden; min-height: 280px; }
.cs-pic { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; padding: 10px 6px 4px; box-sizing: border-box; position: relative; }
.cs-figure { height: 100%; max-height: 236px; width: auto; }
:root[data-theme="dark"] .cs-figure { filter: invert(.9) sepia(.15); }
.cs-own { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cs-up { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px; color: var(--muted); text-align: center; cursor: pointer; font-size: 13px; }
.cs-up b { color: var(--text); }
.cs-up input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cs-figs { position: relative; z-index: 1; flex: 0 0 auto; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 6px; box-sizing: border-box; border-top: 1px solid var(--line); background: var(--paper); }
.cs-fig { min-height: 28px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--paper); color: var(--text); font: 600 12px var(--ui); cursor: pointer; }
.cs-fig.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.cs-slot { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 7px 10px; border-radius: 11px; border: 1.5px solid currentColor; background: var(--paper); text-align: left; cursor: pointer; font-family: var(--ui); min-width: 0; }
.cs-slot.empty { border-style: dashed; color: var(--line); background: transparent; }
.cs-slot.empty .cs-ic, .cs-slot.empty .cs-v { color: var(--muted); }
.cs-slot.sel { box-shadow: 0 0 0 3px var(--accent-soft); }
.cs-slot.r-common, .cs-rar.r-common { color: var(--r-common); }
.cs-slot.r-uncommon, .cs-rar.r-uncommon { color: var(--r-uncommon); }
.cs-slot.r-rare, .cs-rar.r-rare { color: var(--r-rare); }
.cs-slot.r-epic, .cs-rar.r-epic { color: var(--r-epic); }
.cs-slot.r-legend, .cs-rar.r-legend { color: var(--r-legend); }
.cs-ic { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid currentColor; display: grid; place-items: center; }
.cs-st { min-width: 0; display: flex; flex-direction: column; }
.cs-k { font: 700 10.5px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cs-v { font: 600 14px var(--ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-r { font-size: 11.5px; color: var(--muted); }
.cs-detail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); font-size: 13.5px; }
.cs-rar { font-weight: 600; }
.cs-note { color: var(--muted); }
.cs-sp { flex: 1; }
.cs-edit { margin-top: 12px; padding: 12px; border-radius: 10px; border: 1px solid var(--accent); background: var(--paper); display: flex; flex-direction: column; gap: 10px; }
.cs-edit-h { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.cs-edit-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr); gap: 10px; }
.cs-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.cs-edit input, .cs-edit select { font: 14px var(--ui); padding: 7px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); color: var(--text); min-width: 0; }
.cs-hist { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cs-h { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border-radius: 999px; background: var(--panel-2); font-size: 12.5px; }
.cs-hx { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; width: 24px; height: 24px; border-radius: 50%; }
.cs-hx:hover { background: var(--line); color: var(--text); }
.cs-edit-b { display: flex; justify-content: flex-end; gap: 8px; }
.cs-rows .cs-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.cs-row small { color: var(--muted); font-size: 12px; }
.cs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 999px; background: var(--panel-2); font-size: 13.5px; }
.cs-chip small { color: var(--muted); font-size: 11.5px; }
.cs-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-top: 14px; }
.cs-tile { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 9px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); min-width: 0; }
.cs-tile span { font: 700 10.5px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-tile b { font: 700 20px var(--ui); }
.cs-tile small { min-height: 14px; font-size: 11.5px; font-weight: 600; color: var(--r-uncommon); }
.cs-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 14px; font-size: 13px; }
.cs-foot select { font: 13px var(--ui); padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); margin-left: 6px; }
@media (max-width: 640px) {
  .cs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-grid .cs-frame { grid-column: 1 / span 2; grid-row: 1; min-height: 260px; }
  .cs-grid .cs-slot { grid-column: auto !important; grid-row: auto !important; }
  .cs-edit-row { grid-template-columns: minmax(0, 1fr); }
  .cs-track { margin: 0 8px; }
  .cs-when { flex-basis: 100%; }
}

/* the level switch on the main screen: Play and Build tabs unlock at Detail */
.lib-mode { margin-left: 28px; margin-right: 10px; width: 210px; flex: 0 0 auto; }
.lib-mode + .lib-tabs { margin-left: 0; }
@media (max-width: 720px) { #mode-switch button[data-m="lore"], #lib-mode button[data-m="lore"] { display: none; } }
body:not(.detailed) #lib-tabs button[data-tab="play"], body:not(.detailed) #lib-tabs button[data-tab="build"], body:not(.lore) #lib-tabs button[data-tab="world"] { display: none; }
@media (max-width: 720px) { .lib-head .lib-mode { grid-column: 1 / -1; grid-row: 2; width: auto; margin: 0 0 6px; } .lib-head .lib-mode + .lib-tabs { grid-row: 3; } }
.lib-head { gap: 12px; }
.selbar .sb-addto { display: none; }
body.detailed .selbar .sb-addto { display: contents; }
body.writer .selbar .sb-addto { display: none; }
/* Add to… menu (addto.js) */
.addto-menu { position: fixed; z-index: 700; min-width: 240px; padding: 5px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.2); display: flex; flex-direction: column; animation: fade .12s ease-out; }
.addto-menu .addto-h { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 5px 9px 4px; }
.addto-menu button { text-align: left; border: 0; background: transparent; color: inherit; font: inherit; padding: 7px 9px; border-radius: 7px; cursor: pointer; }
.addto-menu button:hover, .addto-menu button:focus-visible { background: var(--panel-2); outline: none; }
.addto-page { display: flex; flex-direction: column; gap: 10px; }
.addto-page .field { margin: 0; }
.addto-page textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--text); font: 14px/1.5 var(--serif, Georgia, serif); resize: vertical; }
.addto-page input[type=text] { width: 100%; box-sizing: border-box; }
.addto-page .check small { color: var(--muted); }
.addto-page .addto-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.addto-page .addto-row .field[hidden] + .field { grid-column: auto; }
@media (max-width: 560px) { .addto-page .addto-row { grid-template-columns: 1fr; } }
.cs-add label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.cs-add input, .cs-add select { width: 100%; box-sizing: border-box; font: 14px var(--ui); padding: 7px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); color: var(--text); min-height: 36px; }

/* main header with four tabs (Lore): drop the slogan and the long word-count text first, then put the level switch
   and the tabs on a second row so Record and Settings never fall off the right edge */
.lib-total { white-space: nowrap; }
@media (max-width: 1500px) { .lib-head .brand .brand-slogan { display: none; } .lib-head .lt-long { display: none; } }
/* lh-two is set by app.js when one row doesn't fit (it measures, since what's in the header changes) */
@media (min-width: 721px) {
  .lib-head.lh-two { flex-wrap: wrap; row-gap: 12px; }
  .lib-head.lh-two .lib-head-right { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
  .lib-head.lh-two .lib-mode { order: 3; margin-left: 0; }
  .lib-head.lh-two .lib-tabs { order: 4; }
  .lib-head.lh-two::after { content: ''; order: 2; flex-basis: 100%; }
}
.lib-head-right { min-width: 0; }
.lib-total .lt-long { color: var(--muted); font-weight: 400; font-variant-numeric: normal; }

/* Lore › Character sheets: every character in the book, one row each */
.cs-browse { display: flex; flex-direction: column; gap: 6px; min-width: min(420px, 80vw); }
.cs-br-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.cs-br-row:hover { border-color: var(--accent); }
.cs-br-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-br-row small { color: var(--muted); }
.cs-br-ic { display: inline-grid; color: var(--muted); }
.cs-br-ic svg { width: 18px; height: 18px; }

/* Open World pieces on a phone: the picture, view only */
.bd-view { display: flex; flex-direction: column; gap: 10px; }
.bd-view-pic { display: grid; place-items: center; min-height: 160px; background: var(--panel-2); border-radius: 8px; overflow: hidden; }
.bd-view-pic img { display: block; width: 100%; height: auto; }

/* character sheet, view only on a phone: gear as a list */
.cs-gear .cs-row > span:first-child { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cs-gear .cs-row small { color: var(--muted); }

/* phone: the timeline is one row under "Up to date" (‹ track ›), and the page's sheet buttons sit above the name
   instead of on top of it */
@media (max-width: 720px) {
  .cs-when { flex-basis: 100%; }
  .cs-track { flex: 1 1 0; min-width: 0; margin: 0 10px; }
}
html.m-phone .page-charsheet:not(.hidden), html.m-phone .page-sheet:not(.hidden) { position: static; display: inline-flex; margin: 0 8px 12px 0; vertical-align: middle; }

/* character sheet › Stats: the check against a Build stat system */
.cs-sys { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--paper); }
.cs-sys p { margin: 0; }
.cs-sys.ok { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.cs-sys.off { border-color: #c98a2b; background: color-mix(in srgb, #c98a2b 9%, var(--paper)); }
.cs-sys-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0 0; font-size: 13px; flex-wrap: wrap; }
.cs-sys-row span:first-child { font-weight: 600; }
.cs-sys-tip { margin: 0 0 10px; }

/* New character sheet: a name, or one of the characters already there */
.cs-new { display: flex; flex-direction: column; gap: 12px; min-width: min(440px, 80vw); }
.cs-new-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.cs-new-or::before, .cs-new-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.cs-new-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow: auto; }
.cs-new-pick { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--text); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.cs-new-pick:hover { border-color: var(--accent); }
.cs-new-pick small { color: var(--muted); font-size: 11px; }

/* ---- world calendar (calendar.js): a year you can see, edited in place */
.cal2 { display: flex; flex-direction: column; gap: 16px; }
.c2-pre { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.c2-card { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--text); font: inherit; cursor: pointer; }
.c2-card:hover { border-color: var(--accent); }
.c2-card b { font-size: 13.5px; }
.c2-card span { font-size: 12px; color: var(--muted); line-height: 1.35; }
.c2-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.c2-title #cal-name { flex: 1 1 260px; min-width: 0; font: 600 22px/1.2 var(--serif, Georgia, serif); border: 0; border-bottom: 1px dashed transparent; background: none; color: var(--text); padding: 2px 0; outline: none; }
.c2-title #cal-name:hover, .c2-title #cal-name:focus { border-bottom-color: var(--line); }
.c2-era { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.c2-era input { width: 90px; border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; background: var(--paper); color: var(--text); font: inherit; font-size: 13px; }
/* the year strip */
.c2-year { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.c2-months, .c2-bands, .c2-moon { position: relative; height: 30px; }
.c2-bands { height: 18px; }
.c2-moon { height: 16px; }
.c2-sm { position: absolute; top: 0; bottom: 0; border-right: 1px solid var(--paper); background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.c2-sm:first-child { border-radius: 6px 0 0 6px; } .c2-sm:last-child { border-radius: 0 6px 6px 0; border-right: 0; }
.c2-sm:nth-child(even) { background: color-mix(in srgb, var(--accent) 22%, var(--panel-2)); }
.c2-sm span { font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; max-width: 100%; }
.c2-band { position: absolute; top: 0; bottom: 0; color: #fff; font-size: 10.5px; font-weight: 600; letter-spacing: .3px; padding-left: 6px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; opacity: .85; }
.c2-bands .c2-band:first-child { border-radius: 4px 0 0 4px; }
.c2-moon b { position: absolute; left: 0; top: 0; font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--paper); padding-right: 6px; z-index: 1; line-height: 16px; }
.c2-moon::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dotted var(--line); }
.c2-moon i { position: absolute; top: 3px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--mc, #e8c55a); box-shadow: 0 0 0 2px var(--paper); }
.c2-moon i:first-child { margin-left: 0; }
.c2-leg { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); padding-top: 2px; }
.c2-leg i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
/* sections */
.c2-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.c2-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.c2-sec { min-width: 0; }
.c2-sec h4 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.c2-sec h4 small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.c2-list { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow: auto; }
.c2-row { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 8px; min-width: 0; flex-wrap: wrap; }
.c2-row:hover { background: var(--panel-2); }
.c2-n { width: 18px; text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.c2-name { flex: 1 1 110px; min-width: 80px; border: 0; border-bottom: 1px solid transparent; background: none; color: var(--text); font: inherit; font-size: 14px; padding: 4px 2px; outline: none; }
.c2-name:hover { border-bottom-color: var(--line); } .c2-name:focus { border-bottom-color: var(--accent); }
.c2-step { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); overflow: hidden; }
.c2-step button { border: 0; background: none; color: var(--muted); width: 24px; height: 26px; cursor: pointer; font-size: 15px; }
.c2-step button:hover { color: var(--text); background: var(--panel-2); }
.c2-step input { width: 40px; border: 0; background: none; text-align: center; font: inherit; font-size: 13px; color: var(--text); -moz-appearance: textfield; padding: 0; }
.c2-step input::-webkit-inner-spin-button, .c2-step input::-webkit-outer-spin-button, .c2-small::-webkit-inner-spin-button, .c2-year-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.c2-step em { font-style: normal; font-size: 11.5px; color: var(--muted); padding-right: 9px; }
.c2-tools { display: inline-flex; gap: 1px; margin-left: auto; opacity: 0; transition: opacity .12s; }
.c2-row:hover .c2-tools, .c2-row:focus-within .c2-tools { opacity: 1; }
@media (hover: none) { .c2-tools { opacity: 1; } }
.c2-tools button { border: 0; background: none; color: var(--muted); width: 22px; height: 24px; border-radius: 6px; cursor: pointer; }
.c2-tools button:hover:not(:disabled) { color: var(--text); background: var(--paper); }
.c2-tools button:disabled { opacity: .3; cursor: default; }
.c2-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; padding-left: 6px; font-size: 13px; }
.c2-all { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.c2-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.c2-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--panel-2); font-size: 13px; }
.c2-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; width: 18px; height: 18px; border-radius: 50%; font-size: 13px; line-height: 1; }
.c2-chip button:hover { background: var(--paper); color: var(--text); }
#cal-wadd { flex: 1 1 110px; min-width: 90px; border: 0; background: none; font: inherit; font-size: 13px; color: var(--text); outline: none; padding: 4px; }
.c2-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.c2-dot.moon { width: auto; height: auto; font-size: 13px; }
.c2-say { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.c2-small, .c2-year-in { width: 46px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: var(--paper); color: var(--text); font: inherit; font-size: 13px; text-align: center; -moz-appearance: textfield; }
.c2-year-in { width: 70px; }
.c2-sel { border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: var(--paper); color: var(--text); font: inherit; font-size: 13px; max-width: 150px; }
.c2-sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
/* the first month as a calendar page */
.c2-begin { border-top: 1px solid var(--line); padding-top: 14px; }
#c2-month { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 12px; align-items: start; }
.c2-cal { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); padding: 10px; min-width: 0; }
.c2-cal-h { font-weight: 600; font-size: 13.5px; margin-bottom: 6px; } .c2-cal-h span { font-weight: 400; color: var(--muted); }
.c2-grid { display: grid; gap: 2px; }
.c2-wd { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.c2-d { position: relative; min-height: 30px; border-radius: 6px; background: var(--panel-2); font-size: 11.5px; padding: 2px 4px; display: flex; flex-direction: column; gap: 0; overflow: hidden; }
.c2-d.blank { background: none; }
.c2-d b { font-weight: 500; font-variant-numeric: tabular-nums; }
.c2-d small { font-size: 10px; line-height: 1; }
.c2-d.one { background: var(--accent); color: #fff; }
.c2-d em { font-style: normal; font-size: 9px; font-weight: 700; letter-spacing: .3px; }
.c2-lines { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text); }
.c2-lines b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
@media (max-width: 760px) { .c2-cols, #c2-month { grid-template-columns: minmax(0, 1fr); } .c2-pre { grid-template-columns: minmax(0, 1fr); } }

/* the calendar window is wider than other wide windows, and its small controls keep their own size */
.modal.cal-wide { width: min(1040px, 96vw); max-width: min(1040px, 96vw); }
.modal .cal2 .c2-step input[type=number] { width: 40px; padding: 0; border: 0; background: none; border-radius: 0; text-align: center; height: 26px; }
.modal .cal2 input.c2-small[type=number] { width: 46px; padding: 4px 6px; background: var(--paper); }
.modal .cal2 input.c2-year-in[type=number] { width: 72px; padding: 4px 6px; background: var(--paper); }
.modal .cal2 select.c2-sel { width: auto; padding: 4px 6px; background: var(--paper); }
.modal .cal2 .c2-name { width: auto; }
.c2-row.mo { flex-wrap: nowrap; }
@media (max-width: 760px) {
  .c2-pre { display: flex; overflow-x: auto; gap: 6px; }
  .c2-card { flex: 0 0 auto; padding: 7px 10px; } .c2-card span { display: none; }
  .c2-row.mo .c2-step em { display: none; }
  .c2-row.mo .c2-tools button[data-mv] { display: none; }
}

/* ---- Story Bible (bible.js): the shelf on Open World, and the bible's own page */
.sbb-shelf { margin-bottom: 26px; }
.sbb-row { display: flex; gap: 12px; flex-wrap: wrap; }
.sbb-card { position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; width: 170px; height: 220px; padding: 16px 14px 14px 22px; border-radius: 4px 10px 10px 4px; border: 1px solid var(--line); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, var(--paper)), var(--paper) 70%); color: var(--text); text-align: left; cursor: pointer; font: inherit; box-shadow: 0 1px 0 var(--line), 0 6px 18px rgba(0,0,0,.06); transition: transform .12s ease; }
.sbb-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.sbb-spine { position: absolute; left: 0; top: 0; bottom: 0; width: 9px; border-radius: 4px 0 0 4px; background: var(--accent); opacity: .8; }
.sbb-card b { font: 600 17px/1.25 var(--serif, Georgia, serif); }
.sbb-card em { font-style: normal; font-size: 12px; color: var(--muted); }
body.in-bible { overflow: hidden; }
.sbb { position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow: auto; padding: 0 max(28px, env(safe-area-inset-right)) 60px max(28px, env(safe-area-inset-left)); }
html.flavor-dev .sbb { border-top: 3px solid #e8590c; }
.sbb-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 0 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.sbb-top > .icon-btn { font-size: 22px; width: 36px; height: 36px; }
.sbb-title { display: flex; flex-direction: column; min-width: 0; }
.sbb-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--accent); font-weight: 700; }
.sbb-title h1 { margin: 0; font: 600 26px/1.15 var(--serif, Georgia, serif); }
.sbb-books { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.sbb-book { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); font-size: 13px; max-width: 240px; }
.sbb-bk-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* one line: a long title doesn't make its pill taller */
.sbb-book > b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; flex: 0 0 auto; }
.sbb-mv { display: inline-flex; }
.sbb-mv button { border: 0; background: none; color: var(--muted); cursor: pointer; width: 18px; font-size: 14px; }
.sbb-mv button:hover { color: var(--text); }
.sbb-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 12px 0 18px; }
.sbb-tabs button { border: 1px solid transparent; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 6px 14px; border-radius: 99px; cursor: pointer; }
.sbb-tabs button small { font-weight: 400; opacity: .8; margin-left: 2px; }
.sbb-tabs button:hover { color: var(--text); }
.sbb-tabs button.on { background: var(--paper); border-color: var(--line); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.sbb-load { color: var(--muted); padding: 30px 0; }
.sbb-body { max-width: 1180px; }
.sbb-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.sbb-q { flex: 1 1 240px; max-width: 360px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); color: var(--text); font: inherit; }
.sbb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sbb-ent { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--text); cursor: pointer; font: inherit; min-width: 0; }
.sbb-ent:hover { border-color: var(--accent); }
.sbb-pic { flex: 0 0 auto; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: color-mix(in srgb, var(--accent) 18%, var(--panel-2)); color: var(--accent); font: 600 17px var(--serif, Georgia, serif); }
.sbb-pic img { width: 100%; height: 100%; object-fit: cover; }
.sbb-pic svg { width: 22px; height: 22px; }
.sbb-pic.big { width: 96px; height: 96px; font-size: 36px; }
.sbb-ent-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sbb-ent-t b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbb-ent-t em { font-style: normal; font-size: 12.5px; color: var(--text); opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbb-ent-t small { font-size: 11.5px; color: var(--muted); }
.sbb-back { margin-bottom: 10px; }
.sbb-hero { display: flex; gap: 20px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.sbb-hero h2 { margin: 0; font: 600 32px/1.1 var(--serif, Georgia, serif); }
.sbb-aka { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.sbb-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sbb-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.sbb-cols > aside { border-left: 1px solid var(--line); padding-left: 24px; min-width: 0; }
.sbb-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0 0 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.sbb-fields dt { color: var(--muted); font-size: 13px; }
.sbb-fields dd { margin: 0; font-size: 14px; }
.sbb-sec h3 { margin: 18px 0 6px; font: 600 16px var(--serif, Georgia, serif); }
.sbb-sec p { margin: 0 0 8px; line-height: 1.6; font-family: var(--serif, Georgia, serif); }
.sbb-h { margin: 18px 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.sbb-h small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 4px; }
.sbb-cols > aside .sbb-h:first-child { margin-top: 0; }
.sbb-app { margin-bottom: 10px; } .sbb-app > b { display: block; font-size: 12.5px; margin-bottom: 4px; }
.sbb-app > div, .sbb-with, .sbb-gear { display: flex; gap: 4px; flex-wrap: wrap; }
.sbb-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
.sbb-chip:hover { border-color: var(--accent); }
.sbb-chip small { color: var(--muted); font-size: 11px; }
.sbb-gear .sbb-chip { cursor: default; }
.sbb-gear .r-rare { border-color: #4f8fe8; } .sbb-gear .r-epic { border-color: #a35fd0; } .sbb-gear .r-legend { border-color: #e0a030; } .sbb-gear .r-uncommon { border-color: #5aa469; }
.sbb-fl { font-size: 13px; color: var(--muted); }
.sbb-tl-book { margin-bottom: 24px; }
.sbb-tl-row { display: grid; grid-template-columns: 130px 12px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); }
.sbb-tl-when { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sbb-tl-dot { width: 10px; height: 10px; border-radius: 50%; align-self: center; }
.sbb-tl-row b { font-size: 14px; } .sbb-tl-row small { color: var(--muted); } .sbb-tl-row em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); }
.sbb-lore { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sbb-lore-it { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.sbb-lore-it:hover { border-color: var(--accent); }
.sbb-lore-it span { aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--panel-2); }
.sbb-lore-it img { width: 100%; height: 100%; object-fit: cover; }
.sbb-lore-it b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbb-pick { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }
/* book picker (New person/place/thing): chips, a search box and a short list, fine with hundreds of books */
.sbb-links { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.sbb-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 7px 10px; border-radius: 9px; background: var(--panel); border-left: 3px solid var(--rel, #888); }
.sbb-link .sbb-lk-t { font-size: 13.5px; color: var(--muted); }
.sbb-link .sbb-lk-when { font-size: 12px; color: var(--muted); }
.sbb-link .sbb-lk-note { flex-basis: 100%; font-size: 13px; color: var(--muted); font-style: italic; }
.sbb-link .sbb-fx { margin-left: auto; }
.sbb-link.over { opacity: .65; }
.sbb-links-before .sbb-before-h { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sbb-addlink { margin: 2px 0 14px; }
.g-family { --rel: #b5653a; } .g-love { --rel: #c0446e; } .g-ally { --rel: #3d7d50; } .g-conflict { --rel: #b03232; } .g-place { --rel: #3a6ea5; } .g-thing { --rel: #8e6c17; } .g-other { --rel: #7a7a86; }
:root[data-theme="dark"] .g-family { --rel: #e09366; } :root[data-theme="dark"] .g-love { --rel: #ec7ea3; } :root[data-theme="dark"] .g-ally { --rel: #6fbf86; } :root[data-theme="dark"] .g-conflict { --rel: #ef6b6b; } :root[data-theme="dark"] .g-place { --rel: #7aa8de; } :root[data-theme="dark"] .g-thing { --rel: #d1ad55; } :root[data-theme="dark"] .g-other { --rel: #a7a7b4; }
.sbb-web-wrap { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); overflow: hidden; }
.sbb-web { display: block; width: 100%; height: auto; }
.sbb-web .sbb-we path { fill: none; stroke: var(--rel); stroke-width: 2; }
.sbb-web .sbb-we.over path { stroke-dasharray: 5 5; opacity: .6; }
.sbb-web .sbb-we text { font-size: 11.5px; fill: var(--rel); text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.sbb-web marker path { fill: var(--rel); }
.sbb-web .sbb-wn { cursor: pointer; }
.sbb-web .sbb-wn circle, .sbb-web .sbb-wn rect, .sbb-web .sbb-wn path { fill: var(--panel); stroke: var(--text); stroke-width: 1.5; }
.sbb-web .sbb-wn.k-places rect { stroke: #3a6ea5; } .sbb-web .sbb-wn.k-items path { stroke: #8e6c17; }
.sbb-web .sbb-wn:hover circle, .sbb-web .sbb-wn:hover rect, .sbb-web .sbb-wn:hover path, .sbb-web .sbb-wn:focus circle { stroke-width: 3; fill: var(--accent-soft); outline: none; }
.sbb-web .sbb-wn:focus { outline: none; }
.sbb-web .ini { font-size: 13px; font-weight: 650; fill: var(--text); text-anchor: middle; pointer-events: none; }
.sbb-web .nm { font-size: 13px; fill: var(--text); text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.sbb-web-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 10px; font-size: 12.5px; color: var(--muted); }
.sbb-web-legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; background: var(--rel); margin-right: 6px; vertical-align: middle; }
.sbb-ro-tag { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; }
.sbb-bp { display: flex; flex-direction: column; gap: 8px; }
.sbb-bp-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; align-items: center; }
.sbb-bp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 13px; max-width: 100%; }
.sbb-bp-chip button { border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 4px; cursor: pointer; }
.sbb-bp-none { font-size: 13px; color: var(--muted); }
.sbb-bp-q { width: 100%; box-sizing: border-box; }
.sbb-bp-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 9px; padding: 4px; max-height: 230px; overflow: auto; background: var(--bg); }
.sbb-bp-h { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 4px 8px 2px; }
.sbb-bp-row { text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; padding: 7px 8px; border-radius: 6px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbb-bp-row:hover, .sbb-bp-row:focus-visible { background: var(--panel-2); outline: none; }
.sbb-bp-all { color: var(--accent); }
.sbb-bp-more { font-size: 12.5px; color: var(--muted); padding: 6px 8px; }
@media (max-width: 900px) { .sbb-cols { grid-template-columns: minmax(0, 1fr); } .sbb-cols > aside { border-left: 0; padding-left: 0; } .sbb-books { margin-left: 0; } }
/* Story Bible: As of, facts, and the Add to bible window */
.sbb-asof { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 0 0; font-size: 13px; color: var(--muted); }
.sbb-asof select { margin-left: 6px; max-width: min(420px, 70vw); padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--text); font: inherit; font-size: 13px; }
.sbb-spoil { font-size: 12px; color: var(--accent); }
.sbb-facts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.sbb-fact { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.sbb-ft { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); padding-top: 3px; overflow-wrap: anywhere; }
.sbb-fact p { margin: 0 0 6px; font-family: var(--serif, Georgia, serif); line-height: 1.5; }
.sbb-fm { display: flex; gap: 6px; align-items: center; }
.sbb-fx { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; width: 22px; height: 22px; border-radius: 6px; opacity: 0; }
.sbb-fact:hover .sbb-fx, .sbb-fx:focus { opacity: 1; } .sbb-fx:hover { color: var(--text); background: var(--panel-2); }
@media (hover: none) { .sbb-fx { opacity: 1; } }
.sbb-was { margin-top: 6px; font-size: 13px; } .sbb-was summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.sbb-old { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--line); } .sbb-old p { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.sbb-add { display: flex; flex-direction: column; gap: 10px; }
.sbb-add textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--text); font: 14px/1.5 var(--serif, Georgia, serif); resize: vertical; }
.sbb-add-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
@media (max-width: 520px) { .sbb-add-row { grid-template-columns: minmax(0, 1fr); } .sbb-fact { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
/* Story Bible: threads, glossary, and the kind switch in Add to bible */
.sbb-grow { flex: 1 1 320px; margin: 0; }
.sbb-thread { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--paper); flex-wrap: wrap; }
.sbb-thread.paid { border-left-color: #5aa469; } .sbb-thread.dropped { border-left-color: var(--line); opacity: .75; }
.sbb-th-main { min-width: 0; flex: 1 1 300px; } .sbb-th-main b { font-size: 15px; } .sbb-th-main p { margin: 4px 0 6px; color: var(--muted); font-size: 13.5px; }
.sbb-th-when { font-size: 12px; color: var(--muted); } .sbb-th-age { font-size: 12px; color: #b9772a; font-weight: 600; margin-left: 4px; }
.sbb-th-acts { display: flex; gap: 6px; align-items: center; } .sbb-thread .sbb-fx { opacity: 1; }
.sbb-gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.sbb-term { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.sbb-term b { font: 600 17px var(--serif, Georgia, serif); } .sbb-term p { margin: 4px 0 8px; font-size: 13.5px; }
.sbb-term small { font-size: 11.5px; color: var(--muted); } .sbb-term .sbb-fx { opacity: 0; } .sbb-term:hover .sbb-fx { opacity: 1; }
.sbb-near { display: flex; flex-direction: column; gap: 4px; } .sbb-near-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, #c98a2b 9%, var(--paper)); max-width: 560px; } .sbb-near-row small { color: var(--muted); }
.sbb-kinds { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: 3px; background: var(--panel-2); align-self: flex-start; }
.sbb-kinds label { cursor: pointer; } .sbb-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.sbb-kinds span { display: inline-block; padding: 5px 14px; border-radius: 99px; font-size: 13px; color: var(--muted); font-weight: 600; }
.sbb-kinds input:checked + span { background: var(--paper); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.sbb-kinds input:focus-visible + span { outline: 2px solid var(--accent); }
/* ===== Maps: Select an area and selected groups (maps-fixes) ===== */
.mp-selcount { display: none; align-self: center; padding: 0 8px; font: 600 12.5px var(--ui); color: var(--muted); white-space: nowrap; }
.mp-selbar.grp .mp-selcount { display: inline; }
.mp-selbar.grp [data-layer]:not([data-layer=del]) { display: none; }
.mp-selbar.grp [data-layer=del]::after { content: " Delete"; }
@media (max-width: 720px) {   /* a phone: a small square of arrows near the tools, clear of the screen's rounded corner */
  .mp-selbar { top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); left: 8px; transform: none; gap: 2px; padding: 4px; }
  .mp-selbar .mp-sl { display: none; }
  .mp-selbar .btn.small { min-width: 38px; min-height: 38px; padding: 0 8px; justify-content: center; }
}
@media (max-width: 720px) { .mp-marq-h { display: none; } }

/* ==== Build kit (buildkit.js): shared symbol chooser, colour row, handles on the picture, ribbons. Oct 2026. ==== */
.kit-sym { margin-bottom: 10px; }
.kit-sym-top { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.kit-sym-top .kit-cat { flex: 1 1 auto; min-width: 0; width: auto; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.kit-sym-top .kit-none { flex: none; padding: 5px 10px; }
.kit-find { width: 100%; margin-bottom: 6px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.kit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; max-height: 196px; overflow: auto; padding: 2px; }
.kit-grid.all { max-height: 300px; }
.kit-grid.big { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); max-height: 56vh; }
.kit-s { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); cursor: pointer; padding: 5px; display: flex; align-items: center; justify-content: center; min-width: 0; }
.kit-s svg { width: 100%; height: 100%; }
.kit-s:hover { border-color: var(--accent); }
.kit-s.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); color: var(--accent); }
.kit-empty { grid-column: 1 / -1; margin: 4px 0; font-size: 12.5px; color: var(--muted); }
.kit-pick .kit-sym-top .kit-cat { max-width: 320px; }
.kit-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kit-c { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(0,0,0,.22); background: var(--c); cursor: pointer; padding: 0; flex: none; }
.kit-c.small { width: 20px; height: 20px; }
.kit-c.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
.kit-dial { background: radial-gradient(circle, var(--c) 0 38%, transparent 40%), conic-gradient(#e53935, #fdd835, #43a047, #00acc1, #1e88e5, #8e24aa, #e53935); }
.kit-dial.open { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--muted); }
.kit-dial.on.open { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
.kit-name { flex-basis: 100%; font-size: 12px; color: var(--muted); margin: -2px 0 0 2px; }
.kit-colours { margin-bottom: 10px; }
.kit-lab { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.kit-reset { font-size: 12.5px; margin-left: 4px; }
.kit-reset.on { color: var(--muted); font-weight: 600; }
.kit-panel { margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.kit-sv { position: relative; height: 120px; border-radius: 8px; cursor: crosshair; touch-action: none; background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(var(--h) 100% 50%)); }
.kit-sv i { position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); transform: translate(-50%, -50%); pointer-events: none; }
.kit-hue { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; margin: 10px 0 0; border-radius: 7px; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.kit-hue::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid rgba(0,0,0,.45); cursor: pointer; }
.kit-hue::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid rgba(0,0,0,.45); cursor: pointer; }
.kit-pr { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.kit-now { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid rgba(0,0,0,.22); flex: none; }
.kit-hex { width: 92px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--text); font: 13px/1.2 'IBM Plex Mono', Menlo, Consolas, monospace; }
.kit-pip { display: inline-flex; align-items: center; gap: 5px; }
.kit-pip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.kit-pip-hint { margin: 6px 0 0; font-size: 12.5px; color: var(--accent); }
.kit-recent { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 10px; }
.kit-recent span { font-size: 12px; color: var(--muted); margin-right: 2px; }
body.kit-pipetting #bd-main .kit-host, body.kit-pipetting #bd-main .kit-host *, body.kit-pipetting #bd-main .bm-pic, body.kit-pipetting #bd-main .bm-pic *, body.kit-pipetting #bd-main .br-stage *, body.kit-pipetting #bd-main .br-preview * { cursor: crosshair !important; }
.kit-host { position: relative; }
.kit-host > svg.kit-ov { position: absolute; left: 0; top: 0; width: 100% !important; height: 100% !important; max-width: none; max-height: none; aspect-ratio: auto; border-radius: 0; filter: none; pointer-events: none; overflow: visible; z-index: 3; }
.kit-ov .kit-box { fill: none; stroke: #3d7bd9; stroke-width: 1.5; stroke-dasharray: 5 4; }
.kit-ov .kit-stem { stroke: #3d7bd9; stroke-width: 1.5; stroke-dasharray: 3 3; }
.kit-ov .kit-h { fill: #fff; stroke: #3d7bd9; stroke-width: 2; }
.kit-ov .kit-turn-ic { fill: none; stroke: #3d7bd9; stroke-width: 1.5; }
.kit-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.kit-item { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.kit-item.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kit-item-head { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 8px; cursor: pointer; }
.kit-item-ic { width: 28px; height: 28px; flex: none; color: var(--text); } .kit-item-ic svg { width: 28px; height: 28px; }
.kit-item-n { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 1px solid rgba(0,0,0,.3); flex: none; }
.kit-item-body { padding: 2px 10px 10px; }
.kit-item-body .ar-sw { margin: 4px 0 8px; }
.kit-sl { display: block; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.kit-sl input[type=range] { display: block; width: 100%; }
.kit-item .sg-rep { margin: 4px 0; font-size: 12.5px; }
.in-w small, .kit-sl small { color: var(--muted); font-weight: 400; }
.in-cols { display: block; margin-top: 12px; }
.ar-ribbons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ar-rib { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 4px 3px 3px; cursor: pointer; color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.ar-rib svg { width: 100%; height: 28px; }
.ar-rib span { font-size: 11px; color: var(--muted); }
.ar-rib.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.ar-rib.on span { color: var(--accent); }
@media (pointer: coarse) {
  .kit-c { width: 34px; height: 34px; }
  .kit-c.small { width: 28px; height: 28px; }
  .kit-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
  .kit-sv { height: 150px; }
}
/* ==== end of Build kit ==== */

/* Restart to update (updates.js readyPill) */
.up-pill { border: 0; border-radius: 999px; padding: 5px 12px; background: var(--accent); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
#statusbar .up-pill { padding: 1px 10px; font-size: 12px; margin-right: 8px; }

/* Story Bible: book menu on each book, and By book sections */
.sbb-bk-more { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 4px; margin-left: 2px; font-size: 14px; line-height: 1; }
.sbb-bk-more:hover { color: var(--text); }
.sbb-grp { flex-shrink: 0; }
.sbb-bookh { margin-top: 18px; }

/* maps and pictures on a page (pagelinks.js) */
.pg-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.pg-link { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; cursor: pointer; max-width: 260px; text-align: left; }
.pg-link:hover { border-color: var(--accent); }
.pg-thumb { width: 44px; height: 34px; border-radius: 6px; overflow: hidden; background: var(--panel-2); display: grid; place-items: center; flex-shrink: 0; font-size: 18px; }
.pg-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pg-t { display: flex; flex-direction: column; min-width: 0; font-size: 13px; line-height: 1.25; }
.pg-t b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-t small { color: var(--muted); font-size: 11.5px; }
.pg-add { border: 1px dashed var(--line); border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; padding: 6px 12px; cursor: pointer; }
.pg-add:hover { color: var(--accent); border-color: var(--accent); }
.pg-pick { display: flex; flex-direction: column; gap: 10px; }
.pg-pick-top { display: flex; gap: 8px; } .pg-pick-top .pg-q { flex: 1; min-width: 0; }
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; max-height: 46vh; overflow: auto; padding: 2px; }
.pg-cell { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; position: relative; background: var(--bg); }
.pg-cell input { position: absolute; top: 8px; right: 8px; }
.pg-cell .pg-thumb { width: 100%; height: 80px; }
.pg-cell small { color: var(--muted); font-size: 11.5px; }
.pg-cell.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* autocorrect (autocorrect.js): a brief underline where a word was corrected, the corrections list, Always correct */
.ac-flash { position: fixed; height: 2px; border-radius: 2px; background: var(--accent); pointer-events: none; z-index: 50; animation: acFlash .9s ease-out forwards; }
@keyframes acFlash { from { opacity: .9; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ac-flash { animation: none; opacity: .6; } }
.ac-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.ac-add input { flex: 1 1 140px; min-width: 0; }
.ac-list { display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow: auto; }
.ac-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.4fr) auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 6px; }
.ac-row:nth-child(odd) { background: var(--hover, rgba(127,127,127,.07)); }
.ac-row b, .ac-row span { overflow-wrap: anywhere; }
.ac-h { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.ac-always .ac-opts { margin: 8px 0 12px; flex-wrap: wrap; }
.ac-rm { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; width: 26px; height: 26px; border-radius: 6px; }
.ac-rm:hover, .ac-rm:focus-visible { color: var(--text); background: var(--hover, rgba(127,127,127,.12)); }
/* icon picker: the search box on top, found emojis under it */
.ip-own { margin-bottom: 12px; }
.ip-own input { width: 100%; max-width: 440px; font-size: 16px; }
.ip-found .ip-grid { max-height: 168px; overflow: auto; }
/* character sheet: "Looking back" is a button back to the latest chapter */
.cs-when.back { flex-basis: 300px; border-color: var(--accent); }
.cs-when .cs-chlink { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: none; padding: 0; font: inherit; color: var(--text); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.cs-when .cs-chlink:hover, .cs-when .cs-chlink:focus-visible { color: var(--accent); text-decoration-color: currentColor; }
.cs-when .cs-now { margin-left: auto; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--accent); flex: 0 0 auto; padding: 6px 0 6px 8px; cursor: pointer; }
.cs-others { display: flex; justify-content: space-between; gap: 8px; margin: -6px 0 2px; }
.cs-others button { max-width: 45%; min-width: 0; display: inline-flex; gap: 4px; }
.cs-others button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-others .nx { margin-left: auto; }
.cs-when > span:last-of-type { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* a short [message] on its own (Settings › LitRPG): a box that fits the words, starting where the full boxes start, or no box */
body.litrpg .editor p.lit-sys.lit-fit, body.litrpg #editor p.lit-sys.lit-fit { width: fit-content; max-width: 92%; margin-left: 4%; margin-right: auto; }
body.litrpg .editor p.lit-sys.lit-plain, body.litrpg #editor p.lit-sys.lit-plain { border: 0; background: none; padding: 0; margin: .4em 4%; max-width: none; font-family: inherit; font-size: inherit; font-weight: 700; letter-spacing: 0; }

/* Build below Lore: Open World pieces get their own heading, so it's clear why they're here and not at Lore */
.bd-from { display: flex; flex-direction: column; gap: 2px; margin: 26px 0 -4px; padding-top: 14px; border-top: 1px solid var(--line); }
.bd-from b { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bd-from span { color: var(--muted); font-size: 13.5px; }
/* Build › Character of the world (buildperson.js): a page like a character page in a book */
.bp-page { max-width: 760px; margin: 0 auto; padding: 22px 20px 60px; display: flex; flex-direction: column; gap: 14px; }
.bp-lead { margin: 0; }
.bp-sheet { background: var(--page-bg, var(--paper)); color: var(--page-ink, var(--text)); border: 1px solid var(--line); border-radius: 10px; padding: 28px 34px; min-height: 50vh; outline: none; font-family: var(--page-font, Georgia, serif); font-size: 16px; line-height: 1.6; box-shadow: var(--shadow); }
.bp-sheet h2 { font-size: 1.2em; margin: 1.1em 0 .3em; }
.bp-sheet p { margin: 0 0 .4em; }
@media (max-width: 720px) { .bp-page { padding: 12px 10px 40px; } .bp-sheet { padding: 18px; } }

/* ---- the import room (importroom.js): its own screen, a step at a time */
.imp-fab { position: fixed; right: 28px; bottom: 28px; z-index: 30; display: flex; align-items: center; gap: 10px; font: inherit; font-size: 15px; font-weight: 600; color: var(--text); background: var(--panel); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 99px; padding: 12px 20px; box-shadow: 0 10px 28px rgba(0,0,0,.22); cursor: pointer; }
.imp-fab svg { color: var(--accent); flex: none; }
.imp-fab:hover { border-color: var(--accent); }
#btn-import2 { display: inline-flex; align-items: center; gap: 7px; } #btn-import2 svg { color: var(--accent); }
@media (max-width: 640px) { #btn-import2 { display: none; } }
.imp-fab-n { background: var(--accent); color: var(--paper); font-size: 12px; border-radius: 99px; padding: 2px 8px; }
#write-home { padding-bottom: 90px; }
@media (max-width: 720px) { .imp-fab { right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); padding: 0 16px; min-height: 50px; } .imp-fab-t { font-size: 0; } .imp-fab-t::after { content: 'Import / Export'; font-size: 15px; } }
.ir { position: fixed; inset: 0; z-index: 58; background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
.ir-head { display: flex; align-items: center; gap: 14px; padding: 14px 26px; border-bottom: 1px solid var(--line); padding-top: calc(14px + env(safe-area-inset-top)); }
.ir-back { display: flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--accent); font: inherit; font-size: 15px; padding: 8px 0; cursor: pointer; }
.ir-title { font-size: 16px; } .ir-book { color: var(--muted); font-size: 14px; }
.ir-sp { flex: 1; }
.ir-steps { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--muted); }
.ir-steps li { padding: 4px 9px; border-radius: 99px; } .ir-steps li.done { color: var(--good); } .ir-steps li.on { background: var(--accent); color: var(--paper); font-weight: 600; }
.ir-phonebar { display: none; }
.ir-body { flex: 1; overflow: auto; min-height: 0; }
.ir-foot { display: flex; align-items: center; gap: 10px; padding: 12px 26px; border-top: 1px solid var(--line); padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.ir-pad { max-width: 1100px; margin: 0 auto; padding: 26px 32px 40px; display: flex; flex-direction: column; gap: 16px; }
.ir h1 { margin: 0; font-family: var(--book-font, Georgia), Georgia, serif; font-size: 26px; }
.ir-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.ir-sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.ir-lede { margin: 0; font-size: 19px; line-height: 1.6; }
.ir-hint { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.ir-count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.ir-cap { font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
/* welcome */
.ir-wel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; max-width: 1180px; margin: 0 auto; padding: 48px 40px; }
.ir-wel-l { display: flex; flex-direction: column; gap: 16px; max-width: 520px; }
.ir-wel-l h1 { font-size: 34px; line-height: 1.25; }
.ir-wel-steps { list-style: none; margin: 4px 0; padding: 4px 16px; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.ir-wel-steps li { display: flex; align-items: center; gap: 12px; padding: 8px 0; color: var(--muted); }
.ir-wel-steps li span { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 12.5px; flex: none; }
.ir-wel-steps li.on { color: var(--text); } .ir-wel-steps li.on span { background: var(--accent); border-color: var(--accent); color: var(--paper); font-weight: 600; }
.ir-guide { margin-top: 4px; }
.ir-wel-r { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ir-drop { border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 16px; background: var(--panel); padding: 26px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.ir-drop-ic svg { width: 40px; height: 40px; color: var(--accent); }
.ir-srcs { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 440px; }
.ir-srcs .btn { justify-content: center; white-space: normal; min-height: 42px; }
.ir-pend { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.ir-pend > div { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; } .ir-pend span { color: var(--muted); font-size: 13px; }
/* manuscript */
.ir-chs { display: flex; flex-direction: column; gap: 6px; }
.ir-part { font-weight: 600; color: var(--muted); padding: 8px 4px 0 calc(var(--d, 0) * 22px); font-size: 14px; }
.ir-ch { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-left: calc(var(--d, 0) * 22px); display: flex; flex-direction: column; gap: 8px; }
.ir-ch.big { border-color: var(--accent); }
.ir-ch-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ir-mv { display: flex; gap: 2px; }
.ir-no { width: 26px; color: var(--muted); font-weight: 500; text-align: right; }
.ir-ch-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ir-first { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--book-font, Georgia), Georgia, serif; }
.ir-warn { color: #c98a00; font-size: 13px; }
.ir-w { color: var(--muted); font-size: 13px; white-space: nowrap; }
.ir-ch-do { display: flex; gap: 8px; padding-left: 90px; flex-wrap: wrap; }
/* documents */
.ir-grip { flex: none; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 6px 4px; }
.ir-ch.ir-dragging { opacity: .5; } .ir-ch.ir-drop-b { box-shadow: 0 -3px 0 var(--accent); } .ir-ch.ir-drop-a { box-shadow: 0 3px 0 var(--accent); }
.ir-prog { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 180px; }
.ir-prog-bar { width: 180px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; } .ir-prog-bar i { display: block; height: 100%; background: var(--good, var(--accent)); }
.ir-li.done { opacity: .75; } .ir-tick { font-style: normal; color: var(--good, var(--accent)); margin-right: 6px; }
.ir-newsec { color: var(--accent); border-style: dashed; }
.ir-now { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.ir-now-l { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 13.5px; } .ir-now-l .on { color: var(--text); font-weight: 600; } .ir-now-m { opacity: .7; }
.ir-remind { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 26px 10px; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); font-size: 14.5px; }
.ir-remind span { flex: 1; min-width: 200px; }
.ir-pv { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ir-pv summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); }
.ir-pv[open] summary { margin-bottom: 8px; }
.ir-pv-where { font-size: 13.5px; color: var(--muted); margin-bottom: 8px; } .ir-pv-where b { color: var(--text); }
.ir-paper { background: #f6f3ec; color: #2a2a2a; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.22); padding: 14px 18px; font: 13px/1.55 var(--book-font, Georgia), Georgia, serif; max-height: 260px; overflow: hidden; max-width: 420px; }
.ir-paper h3 { margin: 0 0 6px; font-size: 16px; } .ir-paper p { margin: 2px 0; } .ir-paper p b { font-family: system-ui, sans-serif; font-size: 11.5px; color: #6b6760; }
.ir-paper h2 { margin: 10px 0 2px; font: 700 11px/1.3 system-ui, sans-serif; letter-spacing: .5px; text-transform: uppercase; color: #6b6760; }
.ir-flip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.ir-q.ir-ask { color: var(--text); font-weight: 600; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border-left: 3px solid var(--accent); }
.ir-guess { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); padding: 8px 12px; border-radius: 10px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--line)); }
.ir-guess b { color: var(--text); } .ir-g-t { flex: 1 1 220px; min-width: 0; line-height: 1.45; } .ir-guess .btn { margin-left: auto; } .ir-guess.agree { border-style: solid; border-color: var(--line); }
.ir-dests .btn.ir-guessed { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.ir-useall { align-self: flex-end; } .ir-apply { align-self: flex-start; }
.ir-split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.ir-list { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow: auto; }
.ir-li { text-align: left; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.ir-li span { color: var(--muted); font-size: 12.5px; } .ir-li.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.ir-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.ir-card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; } .ir-card-h b { font-family: var(--book-font, Georgia), Georgia, serif; font-size: 20px; } .ir-card-h span, .ir-from { color: var(--muted); font-size: 13px; }
.ir-peek { border-left: 2px solid var(--line); padding-left: 12px; font-family: var(--book-font, Georgia), Georgia, serif; font-size: 14.5px; line-height: 1.6; display: flex; flex-direction: column; gap: 4px; }
.ir-ph { font-weight: 700; } .ir-empty { color: var(--muted); }
.ir-q { color: var(--muted); font-size: 14px; margin-top: 4px; }
.ir-two { display: flex; gap: 8px; flex-wrap: wrap; }
.ir-pick .btn[aria-pressed="true"] { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.ir-made { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); font-size: 13.5px; }
.ir-made > span { flex: 1 1 200px; min-width: 0; }
.ir-paper .ir-more-l { color: #8a857c; }
.ir-dests { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ir-dests .btn { min-height: 44px; justify-content: center; } .ir-dests .ir-out { color: var(--muted); }
.ir-nav { display: flex; justify-content: space-between; }
.ir-more { margin-top: 10px; } .ir-more > summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.ir-more > .ir-hint { margin: 2px 0 8px; }
.ir-kept { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.ir-missed { margin: 10px 0 0; padding: 9px 12px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); font-size: 13.5px; line-height: 1.45; }
.ir-names { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; display: flex; flex-direction: column; }
.ir-name { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); } .ir-name:last-child { border-bottom: 0; }
.ir-name b { flex: 1; font-weight: 500; } .ir-name span { color: var(--muted); font-size: 13px; }
/* check */
.ir-check { max-width: 760px; }
.ir-proof { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.ir-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ir-tiles div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.ir-tiles b { font-family: var(--book-font, Georgia), Georgia, serif; font-size: 26px; } .ir-tiles span { color: var(--muted); font-size: 13.5px; }
/* phones: one thing at a time */
@media (max-width: 720px) {
  .ir-head { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; } .ir-steps, .ir-book { display: none; }
  .ir-phonebar { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 0; color: var(--muted); font-size: 13px; }
  .ir-bars { display: flex; gap: 5px; } .ir-bars i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); } .ir-bars i.on { background: var(--accent); }
  .ir-welcome .ir-phonebar { display: none; }
  .ir-wel { grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 22px 16px 40px; } .ir-wel-l h1 { font-size: 26px; } .ir-lede { font-size: 17px; }
  .ir-pad { padding: 16px 16px 30px; } .ir-h { flex-direction: column; align-items: flex-start; gap: 4px; } .ir h1 { font-size: 22px; }
  .ir-split { grid-template-columns: minmax(0, 1fr); } .ir-list { display: none; }
  .ir-dests { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ir-ch-row { flex-wrap: wrap; row-gap: 4px; } .ir-ch-row .ir-w { display: none; } .ir-ch-do { padding-left: 0; }
  .ir-ch-t { order: 1; flex-basis: calc(100% - 40px); } .ir-no { order: 0; width: auto; } .ir-mv { order: 2; } .ir-ch-row [data-out] { order: 3; margin-left: auto; }
  .ir-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); flex-wrap: wrap; } .ir-foot .ir-later { order: 3; width: 100%; } .ir-foot .ir-sp { display: none; } .ir-foot .ir-next { flex: 1; }
  .ir-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ir-prog { align-items: flex-start; min-width: 0; width: 100%; } .ir-prog-bar { width: 100%; }
  .ir-remind { margin: 0 12px 8px; } .ir-remind span { min-width: 100%; }
}

.tr-cq { flex: none; font-size: 12px; margin-right: 4px; }

/* ---- Send a book out (sendout.js): the Import / Export choice and the four steps; uses the import room's .ir shell */
.so-ch { max-width: 960px; margin: 0 auto; padding: 56px 40px 40px; display: flex; flex-direction: column; gap: 28px; }
.so-ch-h { text-align: center; } .so-ch-h h1 { font-size: 34px; }
.so-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.so-card { font: inherit; text-align: left; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.so-card:hover { border-color: var(--accent); }
.so-card b { font-family: var(--book-font, Georgia), Georgia, serif; font-size: 21px; } .so-card > span:last-child { color: var(--muted); font-size: 15px; line-height: 1.55; }
.so-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, var(--panel)); color: var(--accent); }
.so-ic-out { background: color-mix(in srgb, #d9a93a 20%, var(--panel)); color: #b9851c; }
.so-incol { display: flex; flex-direction: column; gap: 12px; } .so-incol .so-card { flex: 1; }
.so-guide { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; cursor: pointer; }
.so-guide input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.so-guide span { display: flex; flex-direction: column; gap: 2px; } .so-guide small { color: var(--muted); font-size: 13.5px; }
.so-recent { display: flex; flex-direction: column; gap: 10px; } .so-foot { text-align: center; }
.so-pad { gap: 18px; }
.so-books { display: flex; flex-wrap: wrap; gap: 12px; }
.so-book { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px 12px 12px; display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: left; min-width: 200px; max-width: 100%; }
.so-book span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .so-book small { color: var(--muted); font-size: 13px; }
.so-spine { width: 34px; height: 46px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 55%, #6b2f2f); flex: none; }
.so-book.on, .so-dest.on, .so-shape.on { border: 2px solid var(--accent); }
.so-dests { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.so-dest { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer; }
.so-dest b { font-size: 16.5px; } .so-dest span { color: var(--muted); font-size: 13.5px; line-height: 1.45; } .so-dest em { font-style: normal; color: var(--accent); font-size: 12.5px; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
.so-shapes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.so-shape { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 10px; text-align: left; cursor: pointer; }
.so-shape:disabled { opacity: .55; cursor: default; }
.so-sh-t { display: flex; align-items: center; gap: 10px; } .so-sh-t b { font-size: 17px; }
.so-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); box-sizing: border-box; flex: none; } .so-shape.on .so-radio { border: 6px solid var(--accent); }
.so-sh-d { color: var(--muted); font-size: 14px; line-height: 1.5; }
.so-tree { background: var(--bg); border-radius: 10px; padding: 12px; font-size: 13px; line-height: 1.7; color: var(--muted); overflow: hidden; }
.so-tl { padding-left: calc(var(--d, 0) * 18px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .so-tl-m { opacity: .75; }
.so-rows { display: flex; flex-direction: column; gap: 8px; }
.so-row { display: grid; grid-template-columns: 24px 210px 24px minmax(0, 1fr) 120px; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 15px; cursor: pointer; }
.so-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.so-info, .so-tc { cursor: default; }
.so-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); justify-self: center; }
.so-arrow { color: var(--muted); text-align: center; } .so-what { color: var(--muted); font-size: 14px; line-height: 1.45; } .so-n { color: var(--muted); font-size: 13px; text-align: right; }
.so-what select { font: inherit; margin-left: 4px; }
.so-check { align-items: stretch; }
.so-proof { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.so-proof div { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.so-proof span, .so-proof small { color: var(--muted); font-size: 13px; } .so-proof b { font-family: var(--book-font, Georgia), Georgia, serif; font-size: 30px; }
.so-proof .ok { border-color: color-mix(in srgb, var(--good) 60%, var(--line)); } .so-proof .ok b { color: var(--good); }
.so-proof .bad { border-color: color-mix(in srgb, var(--warn, #c0392b) 60%, var(--line)); }
.so-check .ir-pend b { word-break: break-all; } .so-check .ir-pend span { font-size: 13px; }
.so-sum { color: var(--muted); font-size: 14px; }
.so-pv { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.so-pv-scriv { display: grid; grid-template-columns: 200px minmax(0, 1fr); max-width: 640px; border-radius: 10px; overflow: hidden; box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.so-pv-bind { background: #dcd8cf; color: #2a2a2a; padding: 10px; font-size: 12px; line-height: 1.7; overflow: hidden; }
.so-pv-bind .so-tl { color: #2a2a2a; } .so-pv-scriv .so-pv-page { border-radius: 0; box-shadow: none; max-width: none; background: #fff; }
.so-pv-page p { margin: 0 0 8px; }
.so-pv-md { margin: 0; max-width: 560px; white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); max-height: 240px; overflow: hidden; }
.so-sample { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; width: max-content; max-width: 100%; background: #f6f3ec; color: #2a2a2a; border-radius: 6px; padding: 6px 10px; font: 12px/1.45 var(--book-font, Georgia), Georgia, serif; box-shadow: 0 3px 10px rgba(0,0,0,.15); }
.so-sample em { font: 700 10px/1.3 system-ui, sans-serif; letter-spacing: .5px; text-transform: uppercase; color: #6b6760; font-style: normal; margin-top: 3px; }
.so-sample i { color: #999; } .so-sample u { text-decoration: none; color: #6b4fc8; }
@media (max-width: 720px) { .so-pv-scriv { grid-template-columns: minmax(0, 1fr); } .so-pv-bind { display: none; } }
@media (max-width: 1100px) { .so-dests { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .so-ch { padding: 20px 16px 30px; gap: 18px; } .so-ch-h { text-align: left; } .so-ch-h h1 { font-size: 26px; }
  .so-cards { grid-template-columns: minmax(0, 1fr); gap: 14px; } .so-card { padding: 18px; } .so-foot { text-align: left; }
  .so-dests { grid-template-columns: minmax(0, 1fr); gap: 8px; } .so-dest { padding: 12px 14px; }
  .so-book { flex: 1 1 100%; }
  .so-shapes { grid-template-columns: minmax(0, 1fr); gap: 10px; } .so-tree { display: none; } .so-shape.on .so-tree { display: block; }
  .so-row { grid-template-columns: 24px minmax(0, 1fr); row-gap: 2px; } .so-row .so-arrow, .so-row .so-n { display: none; } .so-row .so-what { grid-column: 2; font-size: 13.5px; }
  .so-sum { display: none; } .so-proof b { font-size: 24px; }
}

/* ---- fog of war (fog.js): Focus only; the chapter list becomes Done / Now / Next up and the fog */
.binder-head { display: flex; gap: 6px; align-items: center; }
.binder-head .mode-switch { flex: 1; min-width: 0; }
.fog-btn { flex: none; display: flex; align-items: center; gap: 5px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--panel-2); border: 1px solid transparent; border-radius: 8px; padding: 4px 9px; min-height: 30px; cursor: pointer; }
.fog-btn:hover { color: var(--text); }
.fog-btn.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
body.detailed .fog-btn { display: none; }
.fog-panel { display: none; }
html.fog-on .fog-panel { display: flex; flex-direction: column; gap: 4px; padding: 10px 10px 12px; overflow: auto; flex: 1; min-height: 0; }
html.fog-on #binder-tree, html.fog-on #plan-nav { display: none !important; }
html.fog-hide-total #st-project, html.fog-hide-total #st-project + .st-dot { display: none; }
.fog-cap { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--faint, var(--muted)); padding: 8px 6px 2px; }
.fog-row { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; font: inherit; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 7px 8px; cursor: pointer; }
.fog-row:hover { background: var(--panel-2); }
.fog-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; } .fog-t b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .fog-t small { color: var(--muted); font-size: 12px; }
.fog-row.done { color: var(--muted); } .fog-row.done svg { color: var(--good); flex: none; }
.fog-row.now { background: color-mix(in srgb, var(--accent) 12%, var(--paper)); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); padding: 10px; } .fog-row.now b { font-weight: 600; }
.fog-need { color: #c98a00 !important; }
.fog-row.next { opacity: .72; }
.fog-none { color: var(--muted); font-size: 13px; margin: 4px 8px; }
.fog-cloud { margin: 8px 2px; min-height: 110px; border-radius: 10px; background: repeating-linear-gradient(180deg, color-mix(in srgb, var(--muted) 14%, transparent) 0 10px, color-mix(in srgb, var(--muted) 6%, transparent) 10px 26px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 14px; color: var(--muted); font-size: 13px; }
.fog-cloud small { font-size: 12px; opacity: .85; }
.fog-panel .btn { width: 100%; justify-content: center; margin-top: 4px; }
.fog-pick { background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; padding: 8px; cursor: pointer; }
.fog-start .fog-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 10px 0 14px; }
.fog-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fog-li { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.fog-li:first-of-type { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.fog-mv { display: flex; flex-direction: column; }
.fog-li-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; } .fog-li-t input { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--text); }
.fog-add { display: flex; gap: 6px; flex-wrap: wrap; } .fog-add select { flex: 1 1 150px; min-width: 0; } .fog-add input { flex: 1 1 150px; min-width: 0; font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--text); }
.fog-opt { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.fog-opt span { display: flex; flex-direction: column; gap: 2px; } .fog-opt small { color: var(--muted); font-size: 12.5px; }
.fog-opt:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.fog-lookup { display: flex; flex-direction: column; gap: 10px; } .fog-lookup input { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--text); }
.fog-res { display: flex; flex-direction: column; gap: 4px; }
.fog-hit { display: flex; justify-content: space-between; gap: 10px; text-align: left; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; } .fog-hit span { color: var(--muted); font-size: 12.5px; }
.fog-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; } .fog-card p { margin: 0; font-size: 14px; line-height: 1.5; } .fog-card b { font-size: 16px; } .fog-card .btn { align-self: flex-start; margin-top: 6px; }
@media (max-width: 720px) {
  .fog-btn { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: 9px; }
  .fog-start .fog-cols { grid-template-columns: minmax(0, 1fr); }
  html.fog-on .fog-panel { padding: 8px 14px 14px; }
  .fog-row { padding: 11px 10px; font-size: 16px; }
}

/* Back / Forward chip at the top of the page, after following a link (beta, 20 Oct). The page moves down a little
   while it shows, so it never sits on the page's edge or its words. */
.nav-chips { position: sticky; top: 8px; height: 0; z-index: 6; }
.nav-chips[hidden] { display: none; }
.nav-in { position: relative; width: min(var(--page-width, 760px), calc(100% - 48px)); margin: 0 auto; display: flex; gap: 8px; pointer-events: none; }
.nav-chip { pointer-events: auto; display: inline-flex; align-items: center; gap: 7px; max-width: min(360px, 100%); min-height: 32px; box-sizing: border-box; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--paper)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 99px; padding: 5px 13px 5px 11px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.08); white-space: nowrap; }
.nav-chip:hover { border-color: var(--accent); }
.nav-chip i { font-style: normal; font-size: 15px; }
.nav-chip span { color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nav-list { pointer-events: auto; position: absolute; top: 38px; left: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; min-width: 200px; max-width: 320px; }
.nav-list button { font: inherit; font-size: 13.5px; text-align: left; background: none; border: 0; color: var(--text); padding: 7px 10px; border-radius: 7px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-list button:hover { background: color-mix(in srgb, var(--accent) 10%, var(--paper)); }
.nav-chips:not([hidden]) + .page { margin-top: 52px; }
@media (max-width: 640px) { .nav-in { width: calc(100% - 24px); } .nav-chip { max-width: calc(100vw - 32px); } .nav-chips:not([hidden]) + .page { margin-top: 48px; } }
body.writer .nav-chips { top: 14px; }
/* the import screen on a phone (beta, 20 Oct): the round ✕ stands in for Cancel, the split box and the book's name
   take the full width instead of running off the edge or squashing "As a new book called" */
@media (max-width: 640px) {
  #bi .bi-head [data-x] { visibility: hidden; }
  #bi .bi-row { flex-wrap: wrap; gap: 6px; }
  #bi .bi-row select { width: 100%; max-width: 100%; min-width: 0; }
  #bi .bi-radio { flex-wrap: wrap; }
  #bi #bi-ptitle { width: 100%; flex: 1 1 100%; box-sizing: border-box; }
}

/* holding a row on an iPhone opens Unwip's menu, not the phone's text selection (beta, 20 Oct: a blue selection bar
   and handle showed down the side) */
#binder-tree, #binder-tree * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#binder-tree input { -webkit-user-select: text; user-select: text; }
/* the menu that opens under a finger held on a row: the same hold mustn't go on to select its words (beta, 20 Oct:
   "Change icon…" got selected, with Copy / Look Up / Translate). Buttons never select as text anywhere. */
#menu, #menu * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Edit the binder (iPhone and iPad, binderedit.js) */
.be-btn[hidden] { display: none; }
#be-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
#be-top b { font-size: 15px; } #be-top .be-hint { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.bedit .binder-foot > :not(#be-bar) { display: none !important; }
#be-bar { display: flex; align-items: center; gap: 8px; flex: 1; }
#be-bar .be-trash { color: var(--danger, #c0392b); }
html.bedit .fav-head, html.bedit .fav-row, html.bedit .tree-unsorted { display: none; }
html.bedit #binder-tree { position: relative; }
.be-ck { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 70%, transparent); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--paper); box-sizing: border-box; margin-right: 4px; }
.be-ck.on { background: var(--accent); border-color: var(--accent); }
.be-ck.in { background: color-mix(in srgb, var(--accent) 45%, transparent); border-color: transparent; }
.be-grip { margin-left: auto; flex: none; padding: 8px 6px 8px 14px; font-size: 20px; line-height: 1; color: var(--muted); touch-action: none; cursor: grab; }
html.bedit .tree-row .tr-count { display: none; }
/* with a mouse (owner, 1 Nov): smaller circles and ≡, so the names keep their room */
@media (pointer: fine) { .be-ck { width: 17px; height: 17px; font-size: 10px; } .be-grip { font-size: 16px; padding: 4px 4px 4px 10px; } }
.tree-row.be-into { outline: 2px solid var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tree-row.be-moving { opacity: .35; }
#be-line { position: absolute; right: 8px; height: 3px; border-radius: 2px; background: var(--accent); pointer-events: none; z-index: 5; }
#be-line::before { content: ''; position: absolute; left: -6px; top: -4px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); }
#be-ghost { z-index: 960; pointer-events: none; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.35); opacity: .95; display: flex; align-items: center; gap: 6px; box-sizing: border-box; }
#be-ghost .be-count { background: var(--accent); color: var(--paper); border-radius: 99px; font-size: 12px; font-weight: 700; padding: 1px 8px; margin-left: 6px; }

/* iPhone: the formatting row sits just under the top bar while you type (mobile.js), taking its own space so the page
   and its title start below it; the font panel opens under it */
@media (max-width: 720px) {
  .m-fbar { position: relative; bottom: auto; transform: none !important; border-top: 0; border-bottom: 1px solid var(--line); flex-shrink: 0; z-index: 29; }
  .m-fsheet { top: var(--m-row-bottom, 110px); bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
}

/* A page from a word, on a phone (phonepage.js): ＋ Page in the formatting row, and its panel from the bottom */
.m-fbar button.m-fpage { background: var(--accent); border-color: var(--accent); color: var(--paper); font-family: var(--ui); font-weight: 700; font-size: 14px; padding: 0 10px; }
.m-fbar button.m-fpage[hidden] { display: none; }
.pp-back { position: fixed; inset: 0; z-index: 940; background: rgba(10,10,14,.45); display: flex; align-items: flex-end; }
.pp-sheet { width: 100%; max-height: 88vh; overflow-y: auto; box-sizing: border-box; background: var(--panel); color: var(--text); border-radius: 18px 18px 0 0; padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 -12px 30px rgba(0,0,0,.3); }
.pp-cap { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.pp-field { font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--text); width: 100%; box-sizing: border-box; }
.pp-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pp-kinds .btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; min-height: 64px; font-size: 15px; }
.pp-kinds .btn em { font-style: normal; font-size: 20px; }
.pp-kinds .btn span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.pp-msg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, var(--paper)); font-size: 14px; }
.pp-msg[hidden] { display: none; }
.pp-msg > span { flex: 1 1 100%; }
.pp-list { display: flex; flex-direction: column; }
.pp-li { font: inherit; font-size: 15px; display: flex; align-items: center; gap: 10px; text-align: left; padding: 11px 4px; min-height: 44px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--text); }
.pp-li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-li small { color: var(--muted); font-size: 13px; flex: none; }
.pp-none { color: var(--muted); font-size: 14px; margin: 4px 0; }
.pp-cancel { align-self: stretch; }
/* while typing on a phone the ← Back chip stays out of the way (it floated over the words under the row) */
@media (max-width: 720px) { html.m-editing .nav-chips { display: none !important; } html.m-editing .nav-chips + .page { margin-top: revert-layer; } }

/* Record (owner, 1 Nov): ‹ Recordings in the player and the video window, and where videos and reports are saved */
.pf-backto { display: inline-flex; align-items: center; gap: 2px; margin-right: 10px; padding: 4px 11px 4px 8px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.2; cursor: pointer; vertical-align: middle; }
.pf-backto:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.pf-save { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.pf-save-row { display: flex; gap: 8px; align-items: center; }
.pf-path { flex: 1; min-width: 0; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-head .pf-backto { color: #fff; border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.12); }
.pf-head .pf-backto + b { flex: 1; }

/* Dictation mode (dictate.js): raspberry while it's on, so it never reads as Record (red) or Revise (purple) */
.statusbar .dict-btn { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; height: 22px; padding: 0 11px 0 9px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); font-weight: 600; font-size: 12.5px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.statusbar .dict-btn svg { width: 13px; height: 13px; }
.statusbar .dict-btn:hover { background: var(--hover, rgba(127, 127, 127, .12)); color: var(--text); }
.statusbar .dict-btn.on { background: #c2185b; border-color: #c2185b; color: #fff; font-variant-numeric: tabular-nums; }
.statusbar .dict-btn.on:hover { background: #a8134e; }
#btn-dict.on { background: #c2185b; color: #fff; }
#btn-dict.on:hover { background: #a8134e; }
html.dictating #editor-wrap { box-shadow: inset 0 4px 0 #c2185b; }
html.dictating #editor { caret-color: #c2185b; }
::highlight(dictated) { text-decoration: underline 2px rgba(194, 24, 91, .45); text-underline-offset: 4px; }
.m-fbar button.m-fdict { display: inline-flex; align-items: center; gap: 5px; font-family: var(--ui); font-weight: 600; font-size: 14px; padding: 0 10px; }
.m-fbar button.m-fdict svg { width: 15px; height: 15px; }
.m-fbar button.m-fdict.on { background: #c2185b; border-color: #c2185b; color: #fff; }
html.dictating .m-phead { box-shadow: inset 0 -3px 0 #c2185b; }
/* Dictate listening (dictate.js): what's being heard, before it's put in */
.dict-live { position: fixed; left: 50%; transform: translateX(-50%); top: 64px; z-index: 860; max-width: min(560px, calc(100vw - 32px));
  background: var(--paper); color: var(--text); border: 2px solid #c2185b; border-radius: 999px; padding: 6px 16px; font: 14px var(--ui);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .15); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.dict-live[hidden] { display: none; }
@media (max-width: 720px) { .dict-live { top: calc(var(--vv-top, 0px) + 118px); } }
/* the left panel's bottom row fits on one line (owner, 6 Nov: on an iPad + New hung off the edge, 30 px past it) */
.binder-foot { gap: 2px; padding-left: 6px; padding-right: 6px; flex-wrap: nowrap; }
.binder-foot > * { flex-shrink: 0; }
.binder-foot .icon-btn.small { width: 32px; min-width: 0; }
.binder-foot .btn.small { padding-left: 9px; padding-right: 9px; white-space: nowrap; }
