#reader.pdf-editor{width:min(1380px,97vw);height:94vh;max-height:94vh;padding:0;border-radius:12px;overflow:hidden;color:var(--ink)}
#reader.pdf-editor[open]{display:flex;flex-direction:column}
.pdf-editor .reader-header{padding:14px 20px;flex-shrink:0;border-bottom:1px solid var(--line)}
.pdf-editor .reader-header small{font-size:12px}
.editor-toolbar,.editor-navigation,.editor-footer{display:flex;align-items:center;gap:10px;padding:10px 16px;flex-wrap:wrap;background:#fff9f5;flex-shrink:0}
.pdf-editor button,.pdf-editor select,.pdf-editor input{font:inherit;font-size:12px}
.pdf-editor button,.editor-import{min-height:38px;border:1px solid #e8cfc3;border-radius:6px;background:white;color:var(--ink);padding:8px 12px;cursor:pointer}
.pdf-editor button:disabled,.pdf-editor input:disabled,.pdf-editor select:disabled{opacity:.45;cursor:default}
.pdf-editor button[aria-pressed=true],.pdf-editor .primary{background:var(--primary);color:white;border-color:var(--primary)}
.editor-tools{display:flex;gap:4px}.editor-toolbar label,.editor-navigation label{display:flex;align-items:center;gap:6px;font-size:12px}
.pdf-editor select{padding:8px;border-radius:5px;max-width:160px}
#editor-color{padding:2px;width:36px;height:34px;border:1px solid #e8cfc3;border-radius:5px;background:white}
.editor-navigation{border-top:1px solid var(--line);border-bottom:1px solid var(--line);justify-content:space-between;background:white}
.editor-navigation>div{display:flex;align-items:center;gap:8px;font-size:12px}
#editor-page{width:54px;padding:8px 4px;border:1px solid #e8cfc3;border-radius:5px;color:var(--ink)}
#editor-status{margin:0;padding:8px 18px;font-size:12px;line-height:1.5;background:#fff4ec;flex-shrink:0}
#editor-workspace{overflow:auto;overflow-y:scroll;scrollbar-gutter:stable;flex:1;min-height:80px;background:#e9e1db;padding:22px;position:relative;overscroll-behavior:contain}
#editor-page-stack{position:relative;margin:0 auto;background:white;box-shadow:0 4px 18px #482b2926}
#editor-page-stack[hidden]{display:none}
#editor-pdf-canvas{display:block}
#editor-overlay{position:absolute;inset:0}
#editor-overlay canvas{touch-action:none}
.editor-footer{font-size:12px;border-top:1px solid var(--line)}
#editor-help{flex:1;min-width:180px;line-height:1.5}
.editor-footer button,.editor-import{font-size:12px}.editor-import{display:inline-flex;align-items:center;position:relative}
.editor-import input{position:absolute;width:1px;height:1px;opacity:0}
.editor-import:focus-within{outline:3px solid #b75732;outline-offset:2px}
.editor-import:has(input:disabled){opacity:.45;cursor:default}
@media(max-width:650px){#reader.pdf-editor{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border-radius:0}.pdf-editor .reader-header{padding:10px;gap:8px}.pdf-editor .reader-header small{display:none}.editor-toolbar,.editor-navigation,.editor-footer{padding:8px;gap:6px}.pdf-editor button{padding:8px;min-height:40px}#editor-workspace{padding:10px}.editor-tools{width:100%}.editor-tools button{flex:1}.editor-footer{max-height:110px;overflow:auto}#editor-help{width:100%;flex-basis:100%}.editor-navigation{justify-content:flex-start}#editor-download{margin-left:auto}#editor-status{padding:6px 10px}}

.editor-landscape-menu{display:none}
/* Short touch screens in landscape: keep the page visible and every tool reachable. */
@media (orientation:landscape) and (max-height:500px) and (max-width:1100px) and (any-pointer:coarse){
 #reader.pdf-editor{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border-radius:0}
 .pdf-editor .reader-header{padding:4px 12px;gap:8px}
 .pdf-editor .reader-header small{display:none}
 .pdf-editor button{min-height:34px;padding:6px 10px}
 .editor-toolbar{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;padding:4px 10px;gap:8px;scrollbar-width:thin;overscroll-behavior-x:contain}
 .editor-toolbar>*{flex-shrink:0;white-space:nowrap}
 .editor-toolbar .editor-tools{width:auto;flex-basis:auto}
 .pdf-editor select{padding:5px;max-width:150px}
 .editor-navigation{position:relative;flex-wrap:nowrap;padding:4px 10px;gap:8px;justify-content:flex-start;z-index:5}
 .editor-navigation>div{gap:5px}
 #editor-page{padding:5px;width:48px}
 #editor-status{padding:3px 10px;line-height:16px;white-space:nowrap;overflow-x:auto}
 #editor-workspace{padding:8px;min-height:60px}
 .editor-footer{display:none}
 .editor-landscape-menu{display:block;position:relative;font-size:12px;flex-shrink:0}
 .editor-landscape-menu:first-of-type{margin-left:auto}
 .editor-landscape-menu summary{display:flex;align-items:center;justify-content:center;min-height:34px;padding:6px 10px;border:1px solid #e8cfc3;border-radius:6px;cursor:pointer;list-style:none;background:#fff9f5}
 .editor-landscape-menu summary::-webkit-details-marker{display:none}
 .editor-landscape-menu summary:focus-visible{outline:3px solid #b75732;outline-offset:2px}
 .editor-landscape-menu[open] summary{background:var(--primary);color:white}
 .editor-landscape-popup{position:absolute;top:calc(100% + 5px);right:0;width:min(290px,70vw);max-height:calc(100dvh - 150px);overflow:auto;padding:12px;background:white;border:1px solid #e8cfc3;border-radius:8px;box-shadow:0 8px 24px #482b2940;display:flex;flex-direction:column;gap:8px}
 .editor-landscape-popup #editor-help{min-width:0;width:auto;flex:auto;line-height:1.6}
 .editor-landscape-popup #editor-download{margin:0}
 .editor-landscape-popup .editor-import{min-height:34px;justify-content:center}
}

/* Fabric's invisible input must not enlarge or scroll the modal while typing. */
#reader textarea[data-fabric="textarea"]{padding:0!important;margin:0!important;border:0!important;width:1px!important;height:1px!important;min-height:0!important;font-size:16px!important;line-height:1!important;resize:none;pointer-events:none}

.editor-size-menu summary{cursor:pointer;font-size:13px;border:1px solid #e5c8be;border-radius:6px;padding:9px 10px;list-style:none;white-space:nowrap}
.editor-size-menu summary::-webkit-details-marker{display:none}
.editor-size-menu summary:focus-visible{outline:2px solid #c32328;outline-offset:2px}
.editor-size-panel{position:fixed;z-index:20;padding:16px;background:#fff9f5;border:1px solid #e5c8be;border-radius:12px;box-shadow:0 8px 24px #39272930;white-space:normal}
.editor-toolbar .editor-size-panel label{display:flex;justify-content:space-between;font-size:13px;gap:12px}
.editor-size-panel output{font-variant-numeric:tabular-nums;white-space:nowrap}
.editor-size-panel input[type=range]{display:block;width:100%;height:28px;padding:0;margin:8px 0 16px;accent-color:#c32328;cursor:pointer}
.editor-size-panel input[type=range]:last-child{margin-bottom:0}
