
.ink-editor{margin:8px 0}.ink-tools{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin:8px 0}.ink-tools button,.ink-tools select{min-height:44px;border:1px solid #737e9e;border-radius:9px;padding:6px 10px;background:#30374b;color:#fff;font:600 13px system-ui;touch-action:manipulation;cursor:pointer}.ink-tools button[aria-pressed=true]{box-shadow:0 0 0 2px #a5afff;border-color:#a5afff}.ink-tools button:disabled{opacity:.45}.ink-tools .ink-color{width:30px;min-height:30px;border:2px solid #ddd;padding:0;border-radius:50%}.ink-panel[hidden]{display:none!important}.ink-canvas{display:block;width:100%;aspect-ratio:720/440;background:#fffdf8;border:1px solid #b4bbd2;border-radius:8px;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:crosshair}.ink-help,.ink-status{font:13px/1.5 system-ui;color:inherit;margin:6px 0}.ink-status:empty{display:none}.ink-finger{display:flex!important;align-items:center;gap:8px;min-height:44px}.ink-finger input{width:21px;height:21px;accent-color:#a5afff}.handwritten-preview{display:block;width:100%;max-height:300px;object-fit:contain;background:#fffdf8;border-radius:7px;margin:8px 0}.pdf-comment-overlay:has(.ink-active){justify-items:end}.pdf-comment-overlay .comment-form.ink-active{width:min(760px,100%)}#readerView .margin-gutter .comment-form.ink-active{width:min(620px,calc(100vw - 64px));right:0;left:auto;max-height:75dvh;z-index:40}.ink-editor button:focus-visible,.ink-editor select:focus-visible{outline:3px solid #a5afff;outline-offset:3px}@media(max-width:600px){.pdf-comment-overlay:has(.ink-active){padding:8px}.pdf-comment-overlay .comment-form.ink-active{padding:12px}.ink-tools{gap:5px}.ink-tools button{font-size:12px;padding:5px 8px}.ink-canvas{border-radius:5px}}

.pdf-paragraph-note{right:-40px;min-width:36px;min-height:36px;border-radius:50%;padding:2px;font-size:17px;touch-action:manipulation}.pdf-page-note-list{right:-40px;top:4px;transform:translateY(-100%)}
.ink-canvas{width:min(100%,calc(40dvh * 1.63636));height:auto;margin-inline:auto}#readerView .margin-gutter .comment-form.ink-active{position:fixed;top:calc(var(--appbar-height,58px) + 54px);bottom:auto;right:16px;left:auto;max-height:calc(100dvh - var(--appbar-height,58px) - 72px)}

.ink-pager{font:600 12px system-ui}.ink-pager span{margin:0 4px;white-space:nowrap}.ink-pager button,.ink-pager select{font-size:12px}.ink-tools select{max-width:155px}.ink-canvas{width:min(100%,calc(32dvh * 1.63636))}.ink-expanded .ink-canvas{width:min(100%,calc(48dvh * 1.63636))}#readerView .margin-gutter .comment-form.ink-active.ink-expanded,.pdf-comment-overlay .comment-form.ink-active.ink-expanded{position:fixed;top:calc(var(--appbar-height,58px) + 46px);right:16px;left:auto;width:calc(100vw - 32px);max-width:1100px;max-height:calc(100dvh - var(--appbar-height,58px) - 60px);z-index:101;box-sizing:border-box}.ink-editor select{min-height:44px}.ink-tools .ink-color{margin:3px}

.ink-tools .ink-color{width:28px;min-height:28px;margin:0}.ink-tools{gap:5px}.ink-active .row{position:sticky;bottom:0;z-index:3;background:var(--panel,#292e32);padding:8px 0;margin-bottom:0}.ink-canvas{width:min(100%,calc(28dvh * 1.63636))}.ink-expanded .ink-canvas{width:min(100%,calc(43dvh * 1.63636))}

.ink-page-stack{position:relative;width:min(100%,calc(28dvh * 1.63636));height:calc(28dvh + 24px);margin-inline:auto;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;touch-action:pan-y;border:1px solid #aeb7ce;border-radius:8px;background:#d7dbe4;scroll-behavior:auto}.ink-expanded .ink-page-stack{width:min(100%,calc(43dvh * 1.63636));height:calc(43dvh + 24px)}.ink-page-slot{position:relative;margin:0 0 14px;background:#fffdf8;color:#253047}.ink-page-caption{display:block;height:24px;padding:3px 10px;font:600 12px/18px system-ui;box-sizing:border-box;background:#e9edf4}.ink-page-stack .ink-canvas,.ink-page-preview{display:block;width:100%!important;max-width:none;height:auto;aspect-ratio:720/440;object-fit:contain;border:0;border-radius:0;margin:0;background:#fffdf8}.ink-ruled-preview{background:repeating-linear-gradient(to bottom,#fffdf8 0,#fffdf8 6.9%,#b4c4d8 7%,#fffdf8 7.2%)}.ink-end-add{display:block;margin:12px auto;min-height:44px;border:1px solid #737e9e;border-radius:9px;background:#30374b;color:#fff;padding:8px 18px;font:600 13px system-ui;cursor:pointer}

/* Zoom only the sheet, keeping writing controls within reach. */
.ink-page-stack{overflow:auto;touch-action:none}.ink-zoom-surface{width:100%;min-width:100%;transform-origin:top left}.ink-zoom-tools{justify-content:center}.ink-zoom-tools button{min-width:44px}.ink-zoom-tools button:nth-child(2){min-width:72px;font-variant-numeric:tabular-nums}

/* The comment keeps a preview; handwriting lives on its own top-layer sheet. */
.ink-editor.ink-hand-draft>.ink-panel{display:none!important}.ink-draft[hidden]{display:none!important}.ink-draft{margin:10px 0}.ink-draft button{min-height:44px;padding:8px 14px;border:1px solid var(--line,#737e9e);border-radius:10px;background:var(--panel2,#30374b);color:inherit;font:600 14px system-ui;cursor:pointer}.ink-draft .handwritten-preview{max-height:180px;object-fit:contain}
.ink-sheet-dialog{position:fixed;inset:0;width:calc(100vw - 32px);height:calc(100dvh - 32px);max-width:1440px;max-height:none;margin:auto;padding:0;border:1px solid #68738e;border-radius:20px;background:#252a34;color:#f2f4fa;box-sizing:border-box;box-shadow:0 24px 90px #0008;overflow:hidden;overscroll-behavior:none;font:14px/1.4 system-ui}.ink-sheet-dialog[open]{display:flex;flex-direction:column}.ink-sheet-dialog::backdrop{background:#10141bb8;backdrop-filter:blur(3px)}.ink-sheet-header,.ink-sheet-footer{flex:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;background:#252a34}.ink-sheet-header h2{margin:0;font:600 18px system-ui}.ink-sheet-header button,.ink-sheet-footer button{min-height:44px;border:1px solid #737e9e;border-radius:10px;padding:8px 14px;background:#343c50;color:#fff;font:600 14px system-ui;cursor:pointer}.ink-sheet-footer{justify-content:flex-end;border-top:1px solid #424b61}.ink-sheet-footer .ink-save-note{background:#a5afff;color:#171b2a;border-color:#a5afff}.ink-sheet-dialog>.ink-panel{display:flex;flex-direction:column;min-height:0;flex:1;padding:0 12px;overflow:hidden}.ink-sheet-dialog .ink-tools{flex:none;margin:4px 0;gap:5px}.ink-sheet-dialog .ink-tools button,.ink-sheet-dialog .ink-tools select{min-height:40px}.ink-sheet-dialog .ink-zoom-tools{position:absolute;right:24px;bottom:78px;z-index:2;background:#252a34e8;padding:5px;border-radius:12px;border:1px solid #68738e}.ink-sheet-dialog .ink-page-stack{flex:1;width:100%;height:auto;min-height:100px;margin:6px 0 0;border:0;border-radius:10px 10px 0 0;overflow:hidden;scrollbar-gutter:auto;touch-action:none;background:radial-gradient(#626a7b55 1px,transparent 1px) 0 0 / 20px 20px,#171c25}.ink-sheet-dialog .ink-zoom-surface{position:absolute;top:0;left:0;min-width:0;will-change:transform;transform-origin:0 0}.ink-sheet-dialog .ink-page-slot{box-shadow:0 8px 28px #0006;border-radius:4px;overflow:hidden}.ink-sheet-dialog .ink-canvas{cursor:crosshair;outline-offset:-3px}.ink-sheet-dialog .ink-help{flex:none;font-size:12px;margin:4px 0}.ink-sheet-dialog .ink-finger{flex:none;min-height:32px;font-size:12px}.ink-sheet-dialog .ink-finger input{width:18px;height:18px}.ink-sheet-dialog .ink-status{flex:none;margin:3px 0;color:#ffe2b5}.ink-sheet-dialog button:focus-visible,.ink-sheet-dialog select:focus-visible{outline:2px solid #b8c0ff;outline-offset:2px}
@media(max-width:600px){.ink-sheet-dialog{width:100vw;height:100dvh;border-radius:0;border:0}.ink-sheet-header,.ink-sheet-footer{padding:8px 10px}.ink-sheet-header h2{font-size:16px}.ink-sheet-header button{font-size:12px;padding:7px 10px}.ink-sheet-dialog>.ink-panel{padding:0 8px}.ink-sheet-dialog .ink-tools button,.ink-sheet-dialog .ink-tools select{min-height:40px;font-size:12px;padding:5px 8px}.ink-sheet-dialog .ink-help{display:none}.ink-sheet-dialog .ink-zoom-tools{right:14px;bottom:76px}.ink-sheet-dialog .ink-tools .ink-color{width:26px;min-height:26px}.ink-sheet-dialog .ink-pager{gap:4px}}

/* Keep the complete paper at the comment width instead of shrinking it into a fixed-height thumbnail. */
.handwritten-preview,.ink-draft .handwritten-preview{width:100%;height:auto;max-height:none;object-fit:initial}.handwritten-preview[role=button]{cursor:zoom-in}.handwritten-preview[role=button]:focus-visible{outline:3px solid #a5afff;outline-offset:3px}.pdf-notes-card:has(.handwritten-preview){width:min(900px,calc(100vw - 32px));box-sizing:border-box}

/* Existing handwritten comments remain live canvases in their form. */
.ink-editor.ink-hand-draft>.ink-panel{display:flex!important;flex-direction:column}.ink-editor .ink-draft{display:none!important}.ink-work-area{position:relative;min-width:0}.ink-editor .ink-page-stack{width:100%;height:min(55dvh,500px);margin:6px 0}.ink-sheet-dialog .ink-work-area{display:flex;flex:1;min-height:0;position:relative}.ink-sheet-dialog .ink-page-stack{height:auto;min-height:100px;margin:6px 0 0}.ink-sheet-header-actions{display:flex;gap:8px;align-items:center}.ink-reference{position:absolute;right:10px;top:16px;z-index:5;display:flex;flex-direction:column;width:min(340px,55%);max-height:min(65%,420px);overflow:hidden;box-sizing:border-box;border:1px solid #7c88a0;border-radius:12px;background:#fffdf8;color:#25272d;box-shadow:0 6px 24px #0005;font:14px/1.55 system-ui}.ink-reference[hidden],.ink-reference-toggle[hidden]{display:none!important}.ink-editor .ink-reference{display:none}.ink-reference-header{display:flex;align-items:center;gap:8px;flex:none;padding:7px 10px;background:#e9edf4;border-bottom:1px solid #d4dae6}.ink-reference-header strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}.ink-reference-header button,.ink-reference-nav button{min-width:36px;min-height:36px;padding:3px 8px;border:1px solid #bac3d4;border-radius:8px;background:#f4f6fa;color:#25272d;font:600 20px system-ui;cursor:pointer}.ink-reference-body{overflow:auto;overscroll-behavior:contain;touch-action:pan-y;padding:10px 13px;min-height:50px;user-select:text;-webkit-user-select:text;white-space:pre-wrap}.ink-reference-body p{margin:0 0 12px}.ink-reference-body [data-reference-anchor]{border-left:3px solid #9ba9f5;padding-left:8px}.ink-reference-body mark{background:#eee8bd;color:inherit}.ink-reference-nav{display:flex;align-items:center;justify-content:space-between;gap:6px;flex:none;padding:4px 8px;border-top:1px solid #d4dae6;background:#e9edf4;font-size:12px}.ink-reference-nav button:disabled{opacity:.4}.ink-sheet-header .ink-reference-toggle{font-size:13px;background:#343c50;border-color:#7c88a0}.ink-reference-body:focus-visible{outline:2px solid #6475bb;outline-offset:-2px}
@media(max-width:600px){.ink-sheet-header-actions{gap:5px}.ink-sheet-header .ink-reference-toggle{font-size:0;padding:6px 10px}.ink-sheet-header .ink-reference-toggle::before{content:'▤';font:20px system-ui}.ink-reference{width:min(280px,75%);max-height:55%;right:6px}.ink-reference-body{font-size:13px;padding:8px 10px}.ink-editor .ink-page-stack{height:min(50dvh,450px)}}

.ink-reference-body{overflow-wrap:anywhere}

.ink-reference-header .ink-reference-follow{font-size:18px}.ink-reference-header .ink-reference-follow[aria-pressed=true]{border-color:#7d8cc8;background:#e0e5ff;color:#334887}.ink-reference-body .ink-reference-sentence{background:#efecc9}.ink-reference-body .ink-reference-word{background:#ffe477;color:#172a26;box-shadow:inset 0 -2px #9c7c20}.ink-reference-nav span{line-height:1.3;text-align:center}.ink-tools .ink-tool-return{white-space:nowrap;border-color:#a5afff;background:#3b4159}

/* Reference audio and browsing stay independent from the writing surface. */
.ink-reference-controls{display:flex;gap:6px;flex:none;padding:6px 8px;background:#f2f4fa;border-bottom:1px solid #d4dae6}.ink-reference-controls button{flex:1;min-height:38px;border:1px solid #bac3d4;border-radius:8px;background:#f4f6fa;color:#25272d;font:600 12px system-ui;padding:5px 7px;cursor:pointer}.ink-reference-controls .ink-reference-audio{background:#e0e5ff;border-color:#7d8cc8;color:#26386d}.ink-reference-controls .ink-reference-follow{font-size:12px}.ink-reference-controls .ink-reference-follow[aria-pressed=true]{background:#e5eee8;border-color:#7e9c8c}.ink-reference-page-label{font:600 11px system-ui;color:#687082;padding:8px 0;margin-bottom:8px;border-bottom:1px solid #d4dae6}.ink-reference-page:first-child .ink-reference-page-label{padding-top:0}.ink-reference-body{overflow-anchor:none;scroll-behavior:auto}.ink-reference-page p{white-space:pre-wrap}
