:root {
  --ink: #26231f;
  --muted: #8a847b;
  --paper: #f6f3ed;
  --line: #ded8cc;
  --accent: #a85d45;
  --sidebar: #eeeae1;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Newsreader", Georgia, serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 296px; height: 100vh; position: sticky; top: 0; padding: 34px 24px 24px; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--line); overflow-y: auto; }
.brand-lockup { display: flex; align-items: center; gap: 12px; margin: 0 8px 42px; }
.brand-mark { color: var(--accent); font-size: 20px; line-height: 1; }
.brand-name { font-size: 22px; letter-spacing: .02em; }
.brand-subtitle { color: var(--muted); font: 11px/1.2 "DM Mono", monospace; letter-spacing: .03em; margin-top: 3px; }
.new-button, .save-button, .new-page-button { border: 0; border-radius: 7px; transition: background .2s ease, transform .2s ease; }
.new-button { width: 100%; padding: 12px 14px; text-align: left; color: #fff8f2; background: var(--accent); font-size: 16px; }
.new-button span, .new-page-button span { font-family: Arial, sans-serif; font-size: 19px; vertical-align: -1px; margin-right: 5px; }
.new-button:hover, .new-page-button:hover { background: #914b36; transform: translateY(-1px); }
.library-heading { display: flex; justify-content: space-between; align-items: center; margin: 38px 8px 13px; color: var(--muted); font: 11px "DM Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.count { color: var(--accent); }
.book-list { display: flex; flex-direction: column; gap: 5px; }
.book-item { border-radius: 6px; padding: 4px; color: var(--ink); background: transparent; }
.book-item:hover, .book-item.active { background: rgba(255, 255, 255, .55); }
.book-item-main { width: 100%; border: 0; border-radius: 4px; padding: 7px 8px; text-align: left; color: inherit; background: transparent; }
.book-item-main:hover { background: rgba(255, 255, 255, .55); }
.book-title-sidebar-input { width: 100%; border: 0; outline: 0; padding: 0; color: var(--ink); background: transparent; font-size: 17px; }
.book-title-sidebar-input:focus { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.book-item-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.book-item-meta { display: block; color: var(--muted); font: 10px "DM Mono", monospace; margin-top: 4px; }
.page-list { display: flex; flex-direction: column; gap: 2px; padding: 3px 0 4px 9px; border-left: 1px solid var(--line); margin: 0 0 3px 12px; }
.page-item { width: 100%; display: flex; align-items: baseline; gap: 8px; border: 0; border-radius: 4px; padding: 6px 7px; text-align: left; color: var(--muted); background: transparent; }
.page-item:hover, .page-item.active { color: var(--ink); background: rgba(255, 255, 255, .6); }
.page-item { cursor: default; touch-action: auto; }
.page-open { cursor: pointer; min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 8px; border: 0; padding: 0; color: inherit; background: transparent; text-align: left; font: inherit; }
.page-move-actions { display: flex; gap: 1px; opacity: .8; transition: opacity .15s ease; }
.page-item:hover .page-move-actions, .page-item.active .page-move-actions, .page-item.move-source .page-move-actions { opacity: 1; }
.move-page-button { width: 17px; height: 17px; border: 0; border-radius: 3px; padding: 0; color: var(--muted); background: transparent; font: 12px/17px "DM Mono", monospace; cursor: pointer; }
.move-page-button:hover:not(:disabled) { color: var(--ink); background: rgba(168, 93, 69, .14); }
.move-page-button:disabled { opacity: .2; cursor: default; }
.page-item.dragging { opacity: .35; cursor: grabbing; }
.page-item.drag-over { outline: 1px dashed var(--accent); outline-offset: 2px; background: rgba(168, 93, 69, .08); }
.page-item.move-source { outline: 1px solid var(--accent); background: rgba(168, 93, 69, .12); }
.page-grip { flex: 0 0 10px; color: var(--accent); cursor: grab; touch-action: none; user-select: none; font: 13px/1 "DM Mono", monospace; opacity: .75; }
.page-grip:active { cursor: grabbing; }
.page-grip:hover, .page-grip:focus { opacity: 1; color: var(--ink); outline: 0; }
.page-number { color: var(--accent); font: 10px "DM Mono", monospace; }
.page-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.empty-library { color: var(--muted); font-size: 15px; line-height: 1.5; padding: 7px 8px; }
.sidebar-footer { margin-top: auto; color: #a39d92; font: 10px "DM Mono", monospace; letter-spacing: .02em; }
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { min-height: 84px; position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(30px, 7vw, 112px); background: rgba(246, 243, 237, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.topbar-context { display: flex; flex-direction: column; gap: 5px; }
.book-title-bar, .save-state, .word-count { color: var(--muted); font: 11px "DM Mono", monospace; letter-spacing: .02em; }
.book-title-bar { width: min(260px, 34vw); border: 0; outline: 0; padding: 0; color: var(--ink); background: transparent; }
.book-title-bar::placeholder { color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 24px; }
.pdf-button { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; color: var(--muted); background: transparent; font: 11px "DM Mono", monospace; }
.pdf-button:hover { color: var(--ink); border-color: var(--ink); }
.save-button { padding: 9px 17px; color: #fff8f2; background: var(--ink); font: 12px "DM Mono", monospace; }
.save-button:hover { background: #11100e; transform: translateY(-1px); }
.editor-wrap { width: min(760px, calc(100% - 60px)); margin: clamp(70px, 12vh, 140px) auto 0; }
.chapter-title-input, .body-input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; resize: none; }
.chapter-title-input { padding: 0; font-size: clamp(38px, 5vw, 66px); line-height: 1.05; font-weight: 500; letter-spacing: -.03em; }
.chapter-title-input::placeholder { color: #bcb5aa; }
.page-meta { display: flex; align-items: center; gap: 12px; margin-top: 24px; color: var(--muted); font: 10px "DM Mono", monospace; letter-spacing: .04em; text-transform: uppercase; }
.page-rule { height: 1px; flex: 1; background: var(--line); }
.body-input { min-height: 390px; margin-top: 34px; padding: 0; font-size: 23px; line-height: 1.6; }
.body-input::placeholder { color: #b7b0a5; }
.editor-footer { padding-top: 22px; border-top: 1px solid var(--line); }
.page-controls { display: flex; align-items: center; gap: 10px; }
.page-button, .new-page-button { border: 0; border-radius: 6px; padding: 8px 11px; color: var(--muted); background: transparent; font: 11px "DM Mono", monospace; }
.page-button:hover { color: var(--ink); background: rgba(255, 255, 255, .55); }
.new-page-button { margin-left: auto; color: #fff8f2; background: var(--accent); }
.editor-note { color: #aaa398; font: 10px "DM Mono", monospace; letter-spacing: .02em; padding: 22px 0 40px; }
#print-book { display: none; }
@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; height: auto; min-height: auto; max-height: 48vh; padding: 22px 18px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-lockup { margin-bottom: 22px; }
  .library-heading { margin-top: 24px; }
  .book-list { max-height: 142px; overflow-y: auto; }
  .sidebar-footer { display: none; }
  .topbar { min-height: 72px; padding: 0 20px; }
  .editor-wrap { width: calc(100% - 40px); margin-top: 52px; }
  .body-input { min-height: 330px; font-size: 20px; }
  .word-count { display: none; }
  .pdf-button { padding: 8px 9px; }
  .page-controls { flex-wrap: wrap; }
  .new-page-button { margin-left: 0; }
}
@media print {
  @page { margin: 18mm 17mm; }
  body { background: #fff; }
  .app-shell { display: none !important; }
  #print-book { display: block; color: #26231f; font-family: "Newsreader", Georgia, serif; }
  .print-cover { min-height: 245mm; display: flex; flex-direction: column; justify-content: center; page-break-after: always; }
  .print-logo { width: 34px; height: 34px; margin-bottom: 22mm; }
  .print-wordmark { color: #a85d45; font: 11px "DM Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
  .print-cover h1 { max-width: 170mm; margin: 10mm 0 0; font-size: 48pt; line-height: 1.05; font-weight: 500; }
  .print-cover-meta { margin-top: 12mm; color: #8a847b; font: 9pt "DM Mono", monospace; }
  .print-chapter { min-height: 245mm; page-break-before: always; break-inside: avoid; }
  .print-chapter-kicker { color: #a85d45; font: 9pt "DM Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
  .print-chapter h2 { margin: 9mm 0 18mm; font-size: 30pt; line-height: 1.1; font-weight: 500; }
  .print-body { font-size: 15pt; line-height: 1.75; white-space: normal; }
}

/* Verses: organizer and safe backups (independent, local-first) */
.utility-button { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; color: var(--muted); background: transparent; font: 11px "DM Mono", monospace; white-space: nowrap; }
.utility-button:hover { color: var(--ink); border-color: var(--accent); background: rgba(168,93,69,.04); }
.organize-dialog { width: min(670px, calc(100vw - 32px)); max-height: min(85vh, 900px); border: 1px solid var(--line); border-radius: 12px; padding: 22px; color: var(--ink); background: var(--paper); box-shadow: 0 18px 85px rgba(0,0,0,.21); }
.organize-dialog::backdrop { background: rgba(32,26,20,.45); backdrop-filter: blur(2px); }
.organize-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.organize-eyebrow { margin-bottom: 6px; color: var(--accent); font: 10px "DM Mono",monospace; }
.organize-heading h2 { font-size: 32px; font-weight: 500; margin: 0; }
.organize-close { border: 0; background: transparent; padding: 0 6px; color: var(--muted); font: 30px/1 Georgia,serif; }
.organize-help { margin: 12px 0 18px; color: var(--muted); font: 12px/1.55 "DM Mono",monospace; }
.organize-list { max-height: min(60vh, 610px); overflow: auto; display: flex; flex-direction: column; gap: 5px; padding-right: 4px; }
.organize-row { display: flex; align-items: center; gap: 8px; min-height: 43px; border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; background: #fffdfa; }
.organize-row[draggable] { cursor: grab; }
.organize-row.drag-source { opacity: .45; }
.organize-row.drag-target { border-color: var(--accent); background: #f7ece5; }
.organize-drag-icon { color: var(--accent); font-size: 19px; }
.organize-num { color: var(--accent); width: 25px; flex-shrink: 0; font: 11px "DM Mono",monospace; }
.organize-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.organize-arrow { flex-shrink: 0; border: 1px solid var(--line); border-radius: 4px; background: transparent; width: 27px; height: 27px; font: 14px/1 "DM Mono",monospace; }
.organize-arrow:hover:not(:disabled) { background: var(--sidebar); }
.organize-arrow:disabled { opacity: .25; cursor: default; }
.organize-destination { flex-shrink: 0; border: 1px solid var(--line); border-radius: 4px; padding: 5px 2px; color: var(--ink); background: var(--paper); font: 11px "DM Mono",monospace; }
.organize-bottom { display: flex; gap: 20px; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.organize-bottom span { color: var(--muted); font: 11px "DM Mono",monospace; }
@media (max-width: 1020px) { .topbar { padding: 12px 24px; gap: 10px; } .top-actions { gap: 7px; flex-wrap: wrap; justify-content: end; } }
@media (max-width: 700px) { .utility-button { padding: 7px 8px; } .organize-dialog { padding: 14px; } .organize-name { font-size: 14px; } .organize-row { gap: 5px; } .organize-arrow { width: 23px; } .topbar { align-items: start; } }
@media print { .organize-dialog { display: none !important; } }
/* Verses 2 — restrained controls, same reading-first design */
.book-item { position: relative; }
.book-item-main { padding-right: 32px; }
.book-options-button { position:absolute; top:7px; right:3px; border:0; border-radius:4px; width:29px; height:26px; background:transparent; color:var(--muted); font:18px/20px "DM Mono",monospace; letter-spacing:-3px; }
.book-options-button:hover { background:var(--sidebar); color:var(--ink); }
.sidebar-footer button { border:0; padding:0; color:inherit; background:none; text-decoration:underline; font:inherit; }
.top-actions { gap:8px; }
.topbar { padding-left:clamp(18px,3vw,55px); padding-right:clamp(18px,3vw,55px); }
.utility-button { padding:8px 9px; font-size:10px; }
.save-state[data-state="saved"]::before { content:"● "; color:#60907b; }
.save-state[data-state="error"] { color:#ae4b3a; }
.more-wrap { position:relative; }
.more-menu { position:absolute; top:calc(100% + 9px); right:0; z-index:30; min-width:225px; max-height:75vh; overflow:auto; background:#fffdfa; border:1px solid var(--line); box-shadow:0 12px 34px rgba(35,30,24,.14); border-radius:9px; padding:7px; }
.more-menu[hidden] { display:none; }
.more-menu button { display:block; width:100%; padding:8px 10px; border:0; border-radius:5px; background:none; text-align:left; font:11px "DM Mono",monospace; color:var(--ink); }
.more-menu button:hover { background:var(--sidebar); }
.menu-divider { height:1px; background:var(--line); margin:5px; }
.more-menu .danger-text { color:#a04a38; }
.poem-status-row { display:flex; align-items:center; gap:12px; margin:14px 0 0; font:10px "DM Mono",monospace; color:var(--muted); }
.tiny-label { letter-spacing:.05em; }
.plain-select { border:1px solid var(--line); border-radius:5px; padding:6px; font:11px "DM Mono",monospace; color:var(--muted); background:transparent; }
.quiet-link { border:0; background:transparent; color:var(--muted); margin-left:auto; font:11px "DM Mono",monospace; text-decoration:underline; text-underline-offset:3px; }
.notes-panel { margin-top:12px; border:1px solid var(--line); border-radius:8px; background:rgba(255,255,255,.45); padding:12px; }
.notes-panel[hidden] { display:none; }
.notes-panel textarea { border:0; resize:vertical; background:transparent; outline:0; width:100%; min-height:74px; font:15px/1.5 "Newsreader",serif; color:var(--ink); }
.notes-hint { color:var(--muted); font:10px "DM Mono",monospace; }
.body-input { margin-top:29px; }
.utility-dialog,.preview-dialog { width:min(750px,calc(100vw - 24px)); max-height:92vh; overflow:auto; border:1px solid var(--line); border-radius:12px; padding:26px; background:var(--paper); color:var(--ink); box-shadow:0 18px 80px rgba(0,0,0,.24); }
.preview-dialog { width:min(1150px,calc(100vw - 20px)); }
.utility-dialog::backdrop,.preview-dialog::backdrop { background:rgba(40,33,25,.44); backdrop-filter:blur(2px); }
.utility-content { margin-top:17px; max-height:67vh; overflow:auto; }
.utility-footer { padding-top:14px; display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:10px; }
.utility-content p, .utility-content label { font-size:16px; line-height:1.5; }
.utility-content .subtle { color:var(--muted); font-size:14px; }
.utility-content input[type="text"], .utility-content input[type="url"], .utility-content input[type="search"],.utility-content textarea,.utility-content select { border:1px solid var(--line); border-radius:6px; background:#fffdfa; padding:10px; color:var(--ink); width:100%; font:15px "Newsreader",serif; }
.utility-content textarea { min-height:105px; resize:vertical; }
.utility-content .field { margin-bottom:14px; }
.utility-content .field label { display:block; color:var(--muted); font:11px "DM Mono",monospace; margin-bottom:7px; }
.utility-content .stack { display:flex; flex-direction:column; gap:9px; }
.utility-content .item-result { padding:11px 10px; border-bottom:1px solid var(--line); }
.utility-content .item-result button { background:none; border:none; font:16px "Newsreader",serif; text-align:left; width:100%; padding:0; color:var(--ink); }
.utility-content .item-result button:hover { color:var(--accent); }
.utility-content .item-result small { display:block; color:var(--muted); font:10px "DM Mono",monospace; margin:4px 0; }
.utility-content .item-result p { margin:4px 0; font-size:13px; color:var(--muted); }
.utility-content .form-row { display:flex; gap:12px; flex-wrap:wrap; align-items:center; }
.utility-content .form-row > * { flex:1; }
.ghost-button,.danger-button { border:1px solid var(--line); background:transparent; border-radius:6px; padding:9px 13px; font:11px "DM Mono",monospace; color:var(--ink); }
.danger-button { color:#a04a38; border-color:#ccaca2; }
.ghost-button:hover,.danger-button:hover { background:var(--sidebar); }
.selection-tags { display:flex; flex-wrap:wrap; gap:7px; margin:12px 0; }
.selection-tags button { border:1px solid var(--line); border-radius:20px; background:#fffdfa; color:var(--muted); padding:6px 10px; font-size:13px; }
.selection-tags button:hover { border-color:var(--accent); color:var(--ink); }
.preview-controls { display:flex; flex-wrap:wrap; gap:20px; align-items:center; margin:16px 0; color:var(--muted); font:11px "DM Mono",monospace; }
.preview-controls label { display:flex; gap:6px; align-items:center; }
.preview-controls select { border:1px solid var(--line); padding:7px; color:var(--muted); background:transparent; border-radius:5px; font:inherit; }
.spread-stage { width:100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:3px; max-width:850px; margin:0 auto; box-shadow:0 4px 28px rgba(35,30,20,.08); }
.book-paper { background:#fffdfa; min-height:520px; padding:clamp(24px,4.8vw,53px); overflow:auto; }
.book-paper.left { border-radius:3px 0 0 3px; box-shadow:inset -8px 0 15px -15px #584b40; }
.book-paper.right { border-radius:0 3px 3px 0; box-shadow:inset 8px 0 15px -15px #584b40; }
.book-paper .folio { display:block; text-align:center; color:#aaa199; font:10px "DM Mono",monospace; margin-bottom:16px; }
.book-paper h3 { font-size:clamp(20px,3vw,31px); font-weight:500; line-height:1.15; margin:0 0 24px; overflow-wrap:anywhere; }
.book-paper .book-lines { font:clamp(12px,1.8vw,17px)/1.55 "Newsreader",Georgia,serif; white-space:pre-wrap; overflow-wrap:anywhere; }
.book-paper .book-cover-title { font-size:clamp(20px,4vw,37px); font-weight:500; padding-top:45%; }
.spread-controls { display:flex; justify-content:center; align-items:center; gap:20px; margin:15px; font:11px "DM Mono",monospace; }
.spread-controls button { border:0; background:transparent; color:var(--muted); padding:7px; }
.preview-caveat { font:10px "DM Mono",monospace; color:var(--muted); text-align:center; }
.focus-exit { position:fixed; z-index:20; top:20px; right:22px; border:1px solid var(--line); border-radius:7px; padding:9px 13px; background:var(--paper); color:var(--muted); font:11px "DM Mono",monospace; }
.focus-exit[hidden] { display:none; }
body.focus-mode .sidebar,body.focus-mode .topbar,body.focus-mode .page-controls,body.focus-mode .editor-note,body.focus-mode .poem-status-row,body.focus-mode .notes-panel { display:none; }
body.focus-mode .editor-wrap { margin:12vh auto 50px; }
body.focus-mode .body-input { min-height:70vh; }
body.dark-mode { --ink:#eae4da; --muted:#aea698; --paper:#242321; --sidebar:#2d2b28; --line:#49453f; --accent:#d79a7c; }
body.dark-mode .book-item:hover,body.dark-mode .book-item.active { background:rgba(255,255,255,.05); }
body.dark-mode .page-item:hover,body.dark-mode .page-item.active { background:rgba(255,255,255,.06); }
body.dark-mode .topbar { background:rgba(36,35,33,.93); }
body.dark-mode .more-menu, body.dark-mode .utility-content input,body.dark-mode .utility-content textarea,body.dark-mode .utility-content select,body.dark-mode .organize-row,body.dark-mode .utility-dialog,body.dark-mode .preview-dialog { background:#302d29; color:var(--ink); }
body.dark-mode .more-menu button,body.dark-mode .utility-content .item-result button { color:var(--ink); }
body.dark-mode .book-paper { background:#fcfaf6; color:#29251f; }
@media (max-width:1150px) { .topbar { padding:13px 18px; } .top-actions { flex-wrap:wrap; } .topbar-context { min-width:150px; } }
@media (max-width:700px) { .topbar { align-items:center; } .top-actions { justify-content:flex-end; } .topbar .word-count { display:none; } .book-paper { min-height:310px; padding:16px; } .utility-dialog,.preview-dialog { padding:15px; } .spread-stage { gap:1px; } .book-paper .book-lines { font-size:11px; } .utility-content .form-row { flex-direction:column; align-items:stretch; } }
@media print {
  @page { size:A5; margin:0; }
  #print-book { display:block !important; }
  .print-cover { display:none !important; }
  .print-page { width:148mm; height:210mm; padding:18mm 17mm 16mm; break-after:page; page-break-after:always; box-sizing:border-box; position:relative; background:white; overflow:hidden; }
  .print-page:last-child { break-after:auto; page-break-after:auto; }
  .print-page h2 { font:500 22pt/1.15 "Newsreader", Georgia,serif; margin:0 0 12mm; }
  .print-page .print-lines { white-space:pre-wrap; font:12pt/1.45 "Newsreader",Georgia,serif; overflow-wrap:anywhere; }
  .print-page .print-folio { position:absolute; bottom:9mm; left:0; width:100%; text-align:center; color:#918a80; font:8pt "DM Mono",monospace; }
  .print-page.cover { display:flex; flex-direction:column; justify-content:center; padding:20mm; }
  .print-page.cover h2 { font-size:29pt; }
  .print-page.blank .print-folio { display:none; }
}
body.dark-mode .save-button { background:#98614c; color:#fffaf5; }
body.dark-mode .book-options-button:hover { background:#49423a; }
body.dark-mode .organize-row { border-color:var(--line); }
body.dark-mode .page-move-actions button { color:var(--muted); }

/* Verses 2.1 — zoom real da prévia, independente do tamanho da impressão. */
.preview-dialog[open] {
  display: flex;
  flex-direction: column;
  width: min(1150px, calc(100vw - 20px));
  height: min(920px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  padding: 20px 24px 14px;
}
.preview-dialog .preview-top, .preview-dialog .preview-controls,
.preview-dialog .spread-controls, .preview-dialog .preview-caveat { flex-shrink: 0; }
.preview-dialog .preview-controls { gap: 12px 16px; margin: 12px 0; }
.preview-zoom { display: inline-flex; align-items: center; gap: 1px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; margin-left: auto; white-space: nowrap; }
.preview-zoom button { min-width: 30px; min-height: 27px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font: 15px "DM Mono",monospace; }
.preview-zoom button:hover:not(:disabled),.preview-zoom button.is-active { background: var(--sidebar); color: var(--ink); }
.preview-zoom button:disabled { opacity: .3; cursor: default; }
.preview-zoom output { min-width: 48px; text-align: center; font: 11px "DM Mono",monospace; color: var(--ink); font-variant-numeric: tabular-nums; }
.preview-zoom .zoom-fit { font-size: 10px; padding: 0 9px; min-height: 27px; }
.spread-viewport { flex: 1 1 auto; min-height: 0; width: 100%; overflow: auto; border-radius: 5px; overscroll-behavior: contain; scrollbar-gutter: stable; }
.spread-zoom-box { position: relative; margin: 0 auto; }
.spread-zoom-box .spread-stage { position: absolute; top: 0; left: 0; width: 850px; max-width: none; transform-origin: top left; }
.preview-dialog .spread-controls { margin: 7px 0 3px; }
.preview-dialog .preview-caveat { margin: 3px 0 0; }
@media (max-width: 700px) {
  .preview-dialog[open] { width: calc(100vw - 10px); height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); padding: 13px 10px 10px; }
  .preview-dialog .preview-controls { gap: 8px; }
  .preview-zoom { margin-left: 0; }
  .preview-zoom .zoom-fit { padding: 0 6px; }
  .preview-dialog .organize-heading h2 { font-size: 25px; }
}
@media print { .preview-dialog, .utility-dialog, .organize-dialog { display:none !important; } }

/* Verses 2.3 — controle imediato de tema, sem alterar a paginação editorial. */
.theme-toggle {
  min-width: 35px;
  height: 34px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  font: 21px/1 Georgia, serif;
  color: var(--muted);
  border-radius: 6px;
}
.theme-toggle:hover,
.theme-toggle:focus-visible { color: var(--accent); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.dark-mode .book-item-main:hover,
body.dark-mode .page-button:hover { background: rgba(255,255,255,.065); }
body.dark-mode .notes-panel { background: #302d29; }
body.dark-mode .organize-row.drag-target { background: #44342e; }
body.dark-mode .chapter-title-input::placeholder,
body.dark-mode .body-input::placeholder { color: #80776d; }
body.dark-mode .organize-dialog { background: var(--paper); color: var(--ink); }
body.dark-mode .organize-row { background: #302d29; color: var(--ink); }
body.dark-mode .organize-destination { background: #38352f; color: var(--ink); }
body.dark-mode .utility-content .selection-tags button { background: #38352f; color: var(--ink); }
body.dark-mode .utility-content input[type="text"],
body.dark-mode .utility-content input[type="url"],
body.dark-mode .utility-content input[type="search"],
body.dark-mode .utility-content textarea,
body.dark-mode .utility-content select { background: #302d29; color: var(--ink); }
body.dark-mode .sidebar-footer,
body.dark-mode .editor-note { color: var(--muted); }
body.dark-mode .save-button:hover { background: #b47c63; }
body.dark-mode .new-button,
body.dark-mode .new-page-button { color: #242321; }
body.dark-mode .new-button:hover,
body.dark-mode .new-page-button:hover { background: #e1ae95; }
/* The paper itself stays white in the book preview, just as it will print. */
@media print {
  body.dark-mode { background: #fff !important; color: #26231f !important; }
}

/* Verses 2.4: minimalist writing tools remain reachable in focus mode. */
.focus-tools { display: none; position: fixed; right: 20px; top: 18px; z-index: 35; align-items:center; gap:8px; flex-wrap:wrap; }
body.focus-mode .focus-tools { display: flex; }
.focus-tools .focus-exit { position: static; inset: auto; }
.focus-tool { border:1px solid var(--line); border-radius:7px; padding:9px 12px; background:var(--paper); color:var(--muted); font:11px "DM Mono",monospace; white-space:nowrap; transition:color .15s,border-color .15s; }
.focus-tool:hover,.focus-tool:focus-visible,.focus-exit:hover { color:var(--ink); border-color:var(--accent); }
.focus-tools .focus-new { color:var(--accent); }
body.dark-mode .focus-tool { background:var(--paper); color:var(--ink); }
body.focus-mode .editor-wrap { margin-top: max(115px,12vh); }
@media (max-width:680px) { .focus-tools { top:9px; right:9px; left:9px; justify-content:flex-end; gap:5px; } .focus-tool,.focus-tools .focus-exit { font-size:9px; padding:8px 7px; } }
@media print { .focus-tools { display:none !important; } }


/* Verses 2.5 — discrete musical credits, respecting the printed page. */
.poem-music-line { display:flex;align-items:center;gap:15px;min-height:21px;margin-top:12px;color:var(--muted);font:11px/1.45 "DM Mono",monospace; }
.poem-music-line button { border:0;background:transparent;color:inherit;padding:0;text-align:left;font:inherit;cursor:pointer;max-width:85%; }
.poem-music-line button:hover,.poem-music-line a:hover { color:var(--accent); }
.poem-music-line a { color:var(--muted);text-decoration:none;text-decoration-thickness:1px;text-underline-offset:3px;white-space:nowrap;font:inherit; }
.poem-music-line [hidden] { display:none !important; }
body.focus-mode .poem-music-line { display:none; }
.book-paper .book-artist { font:10px/1.45 "DM Mono",monospace;color:#93877d;margin:-15px 0 23px;letter-spacing:.02em; }
.print-page .print-artist { color:#81786e;font:9px/1.4 "DM Mono",monospace;margin:-13px 0 19px; }
.book-paper .playlist-header,.print-page .playlist-header { font:500 28px/1.15 "Newsreader",Georgia,serif;margin:14px 0 18px;color:#26231f; }
.book-paper .playlist-item,.print-page .playlist-item { font:12px/1.65 "DM Mono",monospace;color:#585049;margin:0 0 8px;overflow-wrap:anywhere; }
.book-paper .playlist-item strong,.print-page .playlist-item strong { font-weight:500;color:#35312d; }
.book-paper .playlist-item .playlist-artist,.print-page .playlist-item .playlist-artist { color:#897c70; }
@media print { .poem-music-line { display:none !important; } .print-page .print-artist { color:#736d65; } }
