#bookEditor:has(#chapterWorkspace[hidden]) #chapterFormatToolbar{display:none!important}
.chapter-photo-frame{position:relative;display:block;box-sizing:border-box;max-width:100%;line-height:0;user-select:none;-webkit-user-drag:none;cursor:grab;touch-action:none;break-inside:avoid;page-break-inside:avoid}
.chapter-photo-frame.is-dragging{opacity:.55;cursor:grabbing}
.chapter-photo-frame.is-page-panning{cursor:move;outline:3px solid #356de0;outline-offset:-3px}
.chapter-body-paragraph:has(.chapter-photo-frame){text-indent:0!important;break-inside:avoid;page-break-inside:avoid}
.chapter-photo-text-entry{min-height:1.55em;text-indent:0!important;cursor:text}
.chapter-photo-text-entry:has(> br:only-child){height:0;min-height:0;font-size:0;line-height:0;overflow:hidden}
.chapter-page-body>.chapter-body-paragraph:has(> .chapter-photo-frame):not(:has(~ .chapter-body-paragraph:not(:has(> br:only-child))))>.chapter-photo-frame{margin-bottom:0!important}
.chapter-page-body>.chapter-body-paragraph:has(> .chapter-photo-frame)~.chapter-body-paragraph:has(> br:only-child):not(:has(~ .chapter-body-paragraph:not(:has(> br:only-child)))){height:0;min-height:0;font-size:0;line-height:0;overflow:hidden}
.chapter-photo-frame>img{display:block;max-width:100%;max-height:none;border-radius:2px;object-fit:contain;pointer-events:none;-webkit-user-drag:none}
.chapter-photo-frame.is-selected{outline:2px solid #356de0;outline-offset:2px;cursor:grab}
.chapter-photo-frame.is-fixed-crop{overflow:hidden}
.chapter-photo-frame.is-fixed-crop .chapter-photo-resize{right:2px;bottom:2px}
.chapter-body-paragraph:has(> .chapter-photo-frame.is-side-photo){display:flex;align-items:flex-start;justify-content:center;gap:8px;flex-wrap:wrap}
.chapter-body-paragraph>.chapter-photo-frame.is-side-photo{flex:0 1 auto;margin:12px 0!important;min-width:0}
.chapter-body-paragraph:has(> .chapter-photo-frame):has(+ .chapter-body-paragraph:has(> br:only-child) + .chapter-body-paragraph:has(> .chapter-photo-frame))>.chapter-photo-frame,
.chapter-body-paragraph:has(> .chapter-photo-frame):has(+ .chapter-body-paragraph:has(> .chapter-photo-frame))>.chapter-photo-frame{margin-bottom:4px!important}
.chapter-body-paragraph:has(> .chapter-photo-frame)+.chapter-body-paragraph:has(> br:only-child)+.chapter-body-paragraph:has(> .chapter-photo-frame)>.chapter-photo-frame,
.chapter-body-paragraph:has(> .chapter-photo-frame)+.chapter-body-paragraph:has(> .chapter-photo-frame)>.chapter-photo-frame{margin-top:4px!important}
.chapter-body-paragraph:has(> .chapter-photo-frame)+.chapter-body-paragraph:has(> br:only-child):has(+ .chapter-body-paragraph:has(> .chapter-photo-frame)){display:none}
.chapter-full-photo-page{padding:0!important;overflow:hidden}
.chapter-full-photo-page>.chapter-page-body{position:absolute;inset:0;width:100%;height:100%;overflow:hidden}
.chapter-full-photo-page .chapter-photo-frame{width:100%!important;height:100%!important;margin:0!important;border-radius:0}
.chapter-full-photo-page .chapter-photo-frame>img{border-radius:0}
.chapter-full-photo-page .chapter-photo-resize{display:none!important}
.chapter-full-photo-page .chapter-page-number{display:none!important}
.chapter-photo-drop-before,.chapter-photo-drop-after,.chapter-photo-drop-side{position:relative}
.chapter-photo-drop-before:before,.chapter-photo-drop-after:after{content:'';position:absolute;left:0;right:0;height:4px;border-radius:4px;background:#356de0;z-index:5;pointer-events:none}
.chapter-photo-drop-before:before{top:-4px}.chapter-photo-drop-after:after{bottom:-4px}
.chapter-photo-drop-side{outline:3px solid #356de0;outline-offset:4px}
.chapter-photo-frame.is-cropping{outline:2px solid #356de0;overflow:hidden;touch-action:none}
.chapter-photo-frame.is-cropping .chapter-photo-resize{display:none!important}
.chapter-photo-crop-selection{position:absolute;z-index:3;box-sizing:border-box;border:2px solid #356de0;box-shadow:0 0 0 9999px #14253b42;pointer-events:auto;cursor:move;background:linear-gradient(90deg,transparent 33%,#ffffffa8 33.3%,#ffffffa8 33.7%,transparent 34%,transparent 66%,#ffffffa8 66.3%,#ffffffa8 66.7%,transparent 67%),linear-gradient(transparent 33%,#ffffffa8 33.3%,#ffffffa8 33.7%,transparent 34%,transparent 66%,#ffffffa8 66.3%,#ffffffa8 66.7%,transparent 67%)}
.chapter-photo-crop-selection .crop-handle{position:absolute;display:block;width:13px;height:13px;box-sizing:border-box;padding:0;border:2px solid #fff;border-radius:50%;background:#356de0;box-shadow:0 1px 4px #17223880;pointer-events:auto;touch-action:none;appearance:none}
.chapter-photo-crop-selection .crop-handle.n,.chapter-photo-crop-selection .crop-handle.s{left:0;width:100%;height:16px;border:0;border-radius:0;background:transparent;box-shadow:none;cursor:ns-resize}.chapter-photo-crop-selection .crop-handle.n{top:-8px}.chapter-photo-crop-selection .crop-handle.s{bottom:-8px}
.chapter-photo-crop-selection .crop-handle.e,.chapter-photo-crop-selection .crop-handle.w{top:0;width:16px;height:100%;border:0;border-radius:0;background:transparent;box-shadow:none;cursor:ew-resize}.chapter-photo-crop-selection .crop-handle.e{right:-8px}.chapter-photo-crop-selection .crop-handle.w{left:-8px}
.chapter-photo-crop-selection .crop-handle.n:after,.chapter-photo-crop-selection .crop-handle.s:after{content:'';position:absolute;left:calc(50% - 6px);top:1px;width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:#356de0;box-shadow:0 1px 4px #17223880}.chapter-photo-crop-selection .crop-handle.s:after{top:3px}
.chapter-photo-crop-selection .crop-handle.e:after,.chapter-photo-crop-selection .crop-handle.w:after{content:'';position:absolute;left:1px;top:calc(50% - 6px);width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:#356de0;box-shadow:0 1px 4px #17223880}.chapter-photo-crop-selection .crop-handle.e:after{left:3px}
.chapter-photo-crop-selection .crop-handle.nw{top:-7px;left:-7px;cursor:nwse-resize}.chapter-photo-crop-selection .crop-handle.ne{top:-7px;right:-7px;cursor:nesw-resize}.chapter-photo-crop-selection .crop-handle.sw{bottom:-7px;left:-7px;cursor:nesw-resize}.chapter-photo-crop-selection .crop-handle.se{bottom:-7px;right:-7px;cursor:nwse-resize}
.chapter-photo-crop-tools{position:absolute;z-index:4;top:5px;left:5px;right:5px;display:flex;align-items:center;gap:4px;flex-wrap:wrap;padding:4px;border-radius:6px;background:#163450db;color:#fff;font:11px/1.3 Arial,sans-serif;pointer-events:auto}
.chapter-photo-crop-tools>span{flex:1;min-width:80px}.chapter-photo-crop-tools button{border:1px solid #ffffff88;border-radius:4px;background:#fff;color:#1d3447;padding:3px 5px;font:11px Arial,sans-serif;cursor:pointer}
.chapter-photo-resize{position:absolute;right:-7px;bottom:-7px;width:14px;height:14px;border:2px solid #fff;border-radius:50%;background:#356de0;box-shadow:0 1px 5px #17223855;cursor:nwse-resize;display:none;pointer-events:auto}
.chapter-photo-frame.is-selected .chapter-photo-resize{display:block}
.chapter-photo-frame.will-move-page{outline-style:dashed}
.chapter-photo-context-menu{position:fixed;z-index:800;display:grid;min-width:210px;padding:5px;border:1px solid #d4dce5;border-radius:8px;background:#fff;box-shadow:0 10px 30px #17223840}
.chapter-photo-context-menu[hidden]{display:none}.chapter-photo-context-menu button{border:0;border-radius:5px;background:transparent;padding:9px 10px;color:#253a4d;text-align:left;font:13px Arial,sans-serif;cursor:pointer}.chapter-photo-context-menu button:hover{background:#e9f0ff}
.chapter-photo-context-menu button.is-disabled{position:relative;color:#9ba4ad;cursor:not-allowed}.chapter-photo-context-menu button.is-disabled:hover{background:#f4f5f6}.chapter-photo-context-menu button.is-disabled:hover:after,.chapter-photo-context-menu button.is-disabled:focus-visible:after{content:attr(data-disabled-help);position:absolute;z-index:2;right:calc(100% + 9px);top:0;width:250px;padding:9px 10px;border-radius:7px;background:#253a4d;color:#fff;box-shadow:0 7px 20px #17223835;font:12px/1.4 Arial,sans-serif;white-space:normal;pointer-events:none}
.chapter-photo-context-menu .chapter-photo-menu-divider{display:block;height:1px;margin:4px 6px;background:#dfe5ec}.chapter-photo-context-menu .chapter-photo-menu-divider[hidden]{display:none}
.chapter-photo-modal-preview{display:flex;align-items:center;justify-content:center;min-height:150px;max-height:320px;overflow:auto;margin:10px 0;padding:12px;background:#f3f5f4;border:1px solid #e1e5e2;border-radius:9px}
.chapter-photo-modal-preview img{display:block;max-width:100%;max-height:280px;object-fit:contain}
.chapter-photo-picker{display:inline-flex!important;align-items:center;justify-content:center;min-height:36px;padding:8px 12px!important;border:1px solid #d6dee8;border-radius:8px;background:#fff;cursor:pointer}
.chapter-photo-picker input{display:none}
.chapter-photo-modal-actions{display:flex;justify-content:space-between;gap:8px;margin-top:16px}
.chapter-photo-modal-actions button{border:1px solid #d6dee8;border-radius:8px;background:#fff;padding:9px 12px;color:#46515e;cursor:pointer}
.chapter-photo-modal-actions button.primary{background:#356de0;border-color:#356de0;color:#fff}
.chapter-photo-modal-actions button.danger{color:#b84242}
.chapter-toolbar-group [data-photo-add] svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
@media print{.chapter-photo-resize,.chapter-photo-crop-tools,.chapter-photo-context-menu,.chapter-photo-crop-selection{display:none!important}.chapter-photo-frame.is-selected,.chapter-photo-frame.is-cropping{outline:0}}

.chapter-full-photo-page .chapter-collage-grid{position:absolute;inset:0;display:grid;width:100%;height:100%;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));overflow:hidden}.chapter-collage-tile{display:block;min-width:0;min-height:0;overflow:hidden}.chapter-collage-tile img{display:block;width:100%;height:100%;object-fit:cover;max-width:none;max-height:none}.chapter-collage-choices{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:5px}.chapter-collage-choices button{font-size:11px}
