:root{--text:#3b3a40;--text-h:#08060d;--text-muted:#8a8894;--bg:#f4f3f7;--surface:#fff;--border:#e2e0e6;--accent:#4a6fa5;--accent-hover:#3d5c8a;--danger:#d64545;--shadow:#00000014 0 4px 16px;--sans:system-ui, "Segoe UI", Roboto, sans-serif;font:16px/1.5 var(--sans);--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light dark;color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){:root{--lightningcss-light: ;--lightningcss-dark:initial;--text:#d7d5db;--text-h:#f5f4f7;--text-muted:#918f99;--bg:#17161c;--surface:#1f1e25;--border:#322f3a;--accent:#7c9fd9;--accent-hover:#97b3e2;--shadow:#0006 0 4px 16px}}*{box-sizing:border-box}body{min-height:100svh;margin:0}#root{min-height:100svh}h1,h2,h3{color:var(--text-h);margin:0;font-weight:600}button,input{font:inherit;color:inherit}button{cursor:pointer}a{color:var(--accent)}.auth-page{justify-content:center;align-items:center;min-height:100svh;padding:24px;display:flex}.auth-card{background:var(--surface);border:1px solid var(--border);width:100%;max-width:360px;box-shadow:var(--shadow);border-radius:12px;padding:32px}.auth-logo{text-align:center;color:var(--accent);margin-bottom:24px;font-size:22px;font-weight:700}.auth-card h1{text-align:center;margin-bottom:20px;font-size:20px}.field{flex-direction:column;gap:6px;margin-bottom:16px;display:flex}.field label{color:var(--text-muted);font-size:13px}.field input{border:1px solid var(--border);background:var(--bg);border-radius:8px;outline:none;padding:10px 12px}.field input:focus{border-color:var(--accent)}.auth-error{color:var(--danger);margin-bottom:16px;font-size:13px}.submit-btn{background:var(--accent);color:#fff;border:none;border-radius:8px;width:100%;margin-top:4px;padding:11px;font-weight:600}.submit-btn:hover:not(:disabled){background:var(--accent-hover)}.submit-btn:disabled{opacity:.6;cursor:not-allowed}.switch-link{text-align:center;color:var(--text-muted);margin-top:18px;font-size:14px}.nb-card{cursor:pointer;width:160px}.nb-cover{width:160px;height:200px;box-shadow:var(--shadow);border-radius:6px 10px 10px 6px;transition:transform .15s;position:relative}.nb-card:hover .nb-cover{transform:translateY(-3px)}.nb-cover-spine{background:#0000002e;border-radius:6px 0 0 6px;width:10px;position:absolute;top:0;bottom:0;left:0}.nb-menu-btn{color:#fff;background:#00000040;border:none;border-radius:50%;width:26px;height:26px;line-height:1;position:absolute;top:8px;right:8px}.nb-menu-btn:hover{background:#0006}.nb-menu{background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow);z-index:10;border-radius:8px;min-width:150px;position:absolute;top:38px;right:8px;overflow:hidden}.nb-menu button{text-align:left;background:var(--surface);width:100%;color:var(--text);border:none;padding:10px 14px;font-size:13px;display:block}.nb-menu button:hover{background:var(--bg)}.nb-menu button.danger{color:var(--danger)}.nb-title{color:var(--text-h);text-overflow:ellipsis;white-space:nowrap;margin-top:10px;font-size:14px;font-weight:600;overflow:hidden}.nb-meta{color:var(--text-muted);margin-top:2px;font-size:12px}.modal-backdrop{z-index:100;background:#00000073;justify-content:center;align-items:center;padding:16px;display:flex;position:fixed;inset:0}.modal-box{background:var(--surface);width:100%;max-width:420px;max-height:90svh;box-shadow:var(--shadow);border-radius:12px;padding:24px;overflow-y:auto}.modal-header{justify-content:space-between;align-items:center;margin-bottom:20px;display:flex}.modal-header h2{font-size:18px}.modal-close{color:var(--text-muted);background:0 0;border:none;padding:4px;font-size:16px;line-height:1}.modal-close:hover{color:var(--text-h)}.nb-field{margin-bottom:18px}.nb-field>label{color:var(--text-muted);margin-bottom:8px;font-size:13px;display:block}.nb-field input[type=text]{border:1px solid var(--border);background:var(--bg);border-radius:8px;outline:none;width:100%;padding:10px 12px}.nb-field input[type=text]:focus{border-color:var(--accent)}.nb-swatches{flex-wrap:wrap;gap:8px;display:flex}.nb-swatch{border:2px solid #0000;border-radius:50%;width:28px;height:28px;padding:0}.nb-swatch.selected{border-color:var(--text-h)}.nb-paper-options{grid-template-columns:repeat(3,1fr);gap:8px;display:grid}.nb-paper-option{border:2px solid var(--border);background:var(--bg);color:var(--text-muted);border-radius:8px;flex-direction:column;align-items:center;gap:6px;padding:6px;font-size:11px;display:flex}.nb-paper-option.selected{border-color:var(--accent);color:var(--text-h)}.nb-paper-preview{background:#fff;border-radius:4px;width:100%;height:36px;display:block;position:relative}.nb-paper-option.lined .nb-paper-preview{background-image:repeating-linear-gradient(#fff 0 7px,#cfd3da 7px 8px)}.nb-paper-option.lined_wide .nb-paper-preview{background-image:repeating-linear-gradient(#fff 0 11px,#cfd3da 11px 12px)}.nb-paper-option.lined_narrow .nb-paper-preview{background-image:repeating-linear-gradient(#fff 0 4px,#cfd3da 4px 5px)}.nb-paper-option.grid .nb-paper-preview{background-image:repeating-linear-gradient(#fff 0 7px,#cfd3da 7px 8px),repeating-linear-gradient(90deg,#fff 0 7px,#cfd3da 7px 8px)}.nb-paper-option.dotted .nb-paper-preview{background-image:radial-gradient(#cfd3da 1px,#fff 1px);background-size:8px 8px}.nb-paper-option.seyes .nb-paper-preview{background-image:repeating-linear-gradient(#fff 0 3px,#cfd3da 3px 4px),repeating-linear-gradient(90deg,#fff 0 7px,#eec9c9 7px 8px)}.nb-paper-option.checklist .nb-paper-preview{background-image:repeating-linear-gradient(#fff 0 7px,#cfd3da 7px 8px)}.nb-paper-option.checklist .nb-paper-preview:before{content:"";background:#fff;border:1px solid #9aa0ab;width:8px;height:8px;position:absolute;top:4px;left:4px}.nb-paper-option.cornell .nb-paper-preview{background-image:repeating-linear-gradient(#fff 0 7px,#cfd3da 7px 8px),linear-gradient(90deg,#0000 0 24%,#e3a9a9 24% calc(24% + 1px),#0000 calc(24% + 1px) 100%),linear-gradient(#0000 0 74%,#e3a9a9 74% calc(74% + 1px),#0000 calc(74% + 1px) 100%)}.nb-error{color:var(--danger);margin-bottom:12px;font-size:13px}.nb-submit{background:var(--accent);color:#fff;border:none;border-radius:8px;width:100%;padding:11px;font-weight:600}.nb-submit:hover:not(:disabled){background:var(--accent-hover)}.nb-submit:disabled{opacity:.6;cursor:not-allowed}.library-page{flex-direction:column;min-height:100svh;display:flex}.library-header{border-bottom:1px solid var(--border);background:var(--surface);justify-content:space-between;align-items:center;padding:16px 32px;display:flex}.library-logo{color:var(--accent);font-size:18px;font-weight:700}.library-user{color:var(--text-muted);align-items:center;gap:12px;font-size:14px;display:flex}.library-user button{border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:6px;padding:6px 12px}.library-main{flex:1;width:100%;max-width:1100px;margin:0 auto;padding:32px}.library-toolbar{justify-content:space-between;align-items:center;margin-bottom:24px;display:flex}.library-new-btn{background:var(--accent);color:#fff;border:none;border-radius:8px;padding:10px 18px;font-weight:600}.library-new-btn:hover{background:var(--accent-hover)}.library-status{color:var(--text-muted)}.library-status.error{color:var(--danger)}.library-grid{flex-wrap:wrap;gap:24px;display:flex}.editor-layout{flex-direction:column;height:100svh;display:flex}.editor-topbar{border-bottom:1px solid var(--border);background:var(--surface);flex-shrink:0;align-items:center;gap:20px;padding:10px 16px;display:flex}.editor-back{white-space:nowrap;font-size:14px}.editor-title{color:var(--text-h);text-overflow:ellipsis;white-space:nowrap;font-weight:600;overflow:hidden}.editor-toolbar-slot{flex:1;justify-content:center;display:flex}.editor-save-slot{text-align:right;flex-shrink:0;min-width:90px}.editor-body{flex:1;min-height:0;display:flex}.editor-canvas-area{background:var(--bg);flex-direction:column;flex:1;align-items:center;padding:32px;display:flex;overflow:auto}.text-box-layer{cursor:text;width:100%;height:100%;position:absolute;top:0;left:0}.text-box-static{white-space:pre-wrap;word-break:break-word;cursor:move;touch-action:none;outline:1px dashed #0000;font-family:system-ui,sans-serif;line-height:1.3;position:absolute}.text-box-static.selected{outline-color:var(--accent)}.text-box-editing{border:1px dashed var(--accent);resize:none;background:#ffffffe6;outline:none;min-height:1.6em;padding:2px;font-family:system-ui,sans-serif;line-height:1.3;position:absolute}.image-layer{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.image-box{pointer-events:none;outline:1px dashed #0000;position:absolute}.image-box.interactive{cursor:move;pointer-events:auto;touch-action:none}.image-box.selected{outline-color:var(--accent)}.image-box img{object-fit:fill;pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%}.image-resize-handle{background:var(--accent);cursor:nwse-resize;touch-action:none;border:2px solid #fff;border-radius:50%;width:12px;height:12px;position:absolute;bottom:-6px;right:-6px}.selection-layer{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.selection-layer.active{pointer-events:auto;cursor:crosshair;touch-action:none}.selection-lasso-svg{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;overflow:visible}.selection-lasso-path{fill:#4a6fa51f;stroke:var(--accent);stroke-width:1.5px;stroke-dasharray:5 4}.selection-frame{border:1.5px dashed var(--accent);cursor:move;pointer-events:none;background:#4a6fa514;position:absolute}.ruler-overlay{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.ruler-bar{pointer-events:none;background:#ffd6784d;border:1px solid #b2841ea6;border-radius:6px;position:absolute}.ruler-move-handle,.ruler-rotate-handle{background:var(--accent);pointer-events:auto;touch-action:none;border:2px solid #fff;border-radius:50%;width:18px;height:18px;margin:-9px;position:absolute}.ruler-move-handle{cursor:move}.ruler-rotate-handle{cursor:grab}.page-wrapper{box-shadow:var(--shadow);background:#fff;flex-shrink:0;position:relative}.page-layer{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.page-layer-live{pointer-events:auto;touch-action:none}.page-layer-pan{cursor:grab}.page-layer-pan:active{cursor:grabbing}.color-picker{background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow);z-index:30;border-radius:8px;align-items:center;gap:6px;margin-top:4px;padding:6px;display:flex;position:absolute;top:100%;left:0}.color-picker input[type=color]{cursor:pointer;background:0 0;border:none;border-radius:6px;width:28px;height:28px;padding:0}.color-picker-hex{border:1px solid var(--border);background:var(--bg);width:84px;color:var(--text);border-radius:6px;padding:5px 6px;font-family:monospace;font-size:12px}.toolbar-color-add{border:1px dashed var(--border);background:var(--bg);width:22px;height:22px;color:var(--text-muted,#888);border-radius:50%;padding:0;font-size:13px;line-height:1;position:relative}.toolbar-settings-panel{background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow);z-index:30;border-radius:8px;min-width:220px;margin-top:4px;padding:10px;position:absolute;top:100%;right:0}.toolbar-settings-title{color:var(--text-h);margin-bottom:6px;font-size:12px;font-weight:600}.toolbar-settings-row{justify-content:space-between;align-items:center;gap:8px;padding:4px 0;display:flex}.toolbar-settings-row label{color:var(--text);align-items:center;gap:6px;font-size:13px;display:flex}.toolbar-settings-move{gap:2px;display:flex}.toolbar-settings-move button{border:1px solid var(--border);background:var(--bg);width:20px;height:20px;color:var(--text);border-radius:4px;font-size:11px;line-height:1}.toolbar-settings-move button:disabled{opacity:.3}.toolbar{align-items:center;gap:18px;display:flex}.toolbar-2row{flex-direction:column;align-items:stretch;gap:6px}.toolbar-row{align-items:center;gap:18px;display:flex}.toolbar-row-primary{justify-content:center}.toolbar-contextual{justify-content:center;align-items:center;gap:10px;min-height:30px;display:flex}.toolbar-contextual-hint{color:var(--text-muted,#888);font-size:13px}.toolbar-contextual button{border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:8px;padding:5px 10px;font-size:13px}.toolbar-contextual button:disabled{opacity:.35;cursor:not-allowed}.toolbar-selection-count{color:var(--text-h);white-space:nowrap;font-size:13px}.toolbar-tools{align-items:center;gap:4px;display:flex}.toolbar-settings{margin-left:4px;position:relative}.toolbar-settings>button{border:1px solid var(--border);background:var(--bg);width:26px;height:26px;color:var(--text-muted,#888);border-radius:8px;font-size:13px;line-height:1}.toolbar-tool{border:1px solid var(--border);background:var(--bg);border-radius:8px;width:34px;height:34px;font-size:16px;line-height:1}.toolbar-tool.active{border-color:var(--accent);background:var(--accent-bg,#4a6fa526)}.toolbar-colors{gap:6px;display:flex}.toolbar-color{border:2px solid #0000;border-radius:50%;width:22px;height:22px;padding:0}.toolbar-color.selected{border-color:var(--text-h)}.toolbar-size{align-items:center;display:flex}.toolbar-size input[type=range]{width:100px}.toolbar-size-presets,.toolbar-pen-styles{gap:4px;display:flex}.toolbar-size-presets button,.toolbar-pen-styles button{border:1px solid var(--border);background:var(--bg);min-width:26px;height:26px;color:var(--text);border-radius:6px;padding:0 6px;font-size:12px;line-height:1}.toolbar-size-presets button.selected,.toolbar-pen-styles button.selected{border-color:var(--accent);background:var(--accent-bg,#4a6fa526)}.toolbar-text-format{align-items:center;gap:4px;display:flex}.toolbar-text-format button,.toolbar-text-align button{border:1px solid var(--border);background:var(--bg);width:26px;height:26px;color:var(--text);border-radius:6px;font-size:12px;line-height:1}.toolbar-text-format button.selected,.toolbar-text-align button.selected{border-color:var(--accent);background:var(--accent-bg,#4a6fa526)}.toolbar-text-format select{border:1px solid var(--border);background:var(--bg);height:26px;color:var(--text);border-radius:6px;padding:0 4px;font-size:12px}.toolbar-text-align{gap:4px;display:flex}.toolbar-eraser-options{align-items:center;gap:10px;display:flex}.toolbar-eraser-modes{gap:4px;display:flex}.toolbar-eraser-modes button{border:1px solid var(--border);background:var(--bg);height:26px;color:var(--text);border-radius:6px;padding:0 8px;font-size:12px}.toolbar-eraser-modes button.selected{border-color:var(--accent);background:var(--accent-bg,#4a6fa526)}.toolbar-eraser-toggle{color:var(--text);white-space:nowrap;align-items:center;gap:4px;font-size:12px;display:flex}.toolbar-undo{gap:4px;display:flex}.toolbar-undo button{border:1px solid var(--border);background:var(--bg);border-radius:8px;width:30px;height:30px;font-size:15px;line-height:1}.toolbar-undo button:disabled{opacity:.35;cursor:not-allowed}.toolbar-zoom select{border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:8px;padding:6px 8px}.toolbar-more{position:relative}.toolbar-more>button{border:1px solid var(--border);background:var(--bg);border-radius:8px;width:30px;height:30px;font-size:16px;line-height:1}.toolbar-more-menu{background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow);z-index:20;border-radius:8px;min-width:140px;margin-top:4px;position:absolute;top:100%;right:0;overflow:hidden}.toolbar-more-menu button{text-align:left;background:var(--surface);width:100%;color:var(--text);border:none;padding:9px 14px;font-size:13px;display:block}.toolbar-more-menu button:hover{background:var(--bg)}.save-indicator{color:var(--text-muted);white-space:nowrap;font-size:13px}.save-indicator.saved{color:#3aaf6f}.save-indicator.error{color:var(--danger)}.save-retry-btn{color:var(--accent);background:0 0;border:none;padding:0;font-size:13px;text-decoration:underline}.page-thumb{border:2px solid var(--border);background:var(--surface);border-radius:6px;flex-direction:column;align-items:center;gap:4px;padding:4px;display:flex}.page-thumb.active{border-color:var(--accent)}.page-thumb canvas{background:#fff;border:1px solid #d5d5d5;display:block}.page-thumb-number{color:var(--text-muted);font-size:11px}.page-sidebar{border-right:1px solid var(--border);background:var(--surface);flex-direction:column;flex-shrink:0;align-items:center;gap:10px;width:100px;padding:12px 8px;display:flex;overflow-y:auto}.page-add-wrapper{width:100%;position:relative}.page-add-btn{border:1px dashed var(--border);background:var(--bg);width:100%;color:var(--text-muted);border-radius:6px;padding:8px 4px;font-size:12px}.page-add-btn:hover{color:var(--text);border-color:var(--accent)}.pdf-import{flex-direction:column;gap:14px;display:flex}.pdf-file-picker{border:1px dashed var(--border);text-align:center;color:var(--text-muted);cursor:pointer;border-radius:8px;padding:20px;font-size:13px;display:block}.pdf-file-picker input{display:none}.pdf-progress{color:var(--text-muted);margin:0;font-size:13px}.pdf-error{color:var(--danger);margin:0;font-size:13px}.pdf-import-btn{background:var(--accent);color:#fff;border:none;border-radius:8px;padding:11px;font-weight:600}.pdf-import-btn:disabled{opacity:.6;cursor:not-allowed}.ocr-panel-backdrop{z-index:100;background:#0000004d;justify-content:flex-end;display:flex;position:fixed;inset:0}.ocr-panel{background:var(--surface);width:100%;max-width:380px;height:100%;box-shadow:var(--shadow);flex-direction:column;animation:.18s ease-out ocr-slide-in;display:flex}@keyframes ocr-slide-in{0%{opacity:0;transform:translate(24px)}to{opacity:1;transform:translate(0)}}.ocr-panel-header{border-bottom:1px solid var(--border);flex-shrink:0;justify-content:space-between;align-items:center;padding:20px 20px 16px;display:flex}.ocr-panel-header h2{font-size:17px}.ocr-panel-close{color:var(--text-muted);background:0 0;border:none;padding:4px;font-size:16px;line-height:1}.ocr-panel-close:hover{color:var(--text-h)}.ocr-panel-body{flex-direction:column;flex:1;gap:14px;padding:20px;display:flex;overflow-y:auto}.ocr-source-tabs{border:1px solid var(--border);border-radius:8px;display:flex;overflow:hidden}.ocr-source-tabs button{color:var(--text-muted);border-right:1px solid var(--border);background:0 0;flex:1;padding:9px;font-size:13px}.ocr-source-tabs button:last-child{border-right:none}.ocr-source-tabs button.active{background:var(--accent);color:#fff}.ocr-source-tabs button:disabled{opacity:.6}.ocr-file-picker{border:1px dashed var(--border);text-align:center;color:var(--text-muted);cursor:pointer;border-radius:8px;padding:16px;font-size:13px;display:block}.ocr-file-picker input{display:none}.ocr-hint{color:var(--text-muted);margin:0;font-size:12px}.ocr-recognize-btn{background:var(--accent);color:#fff;border:none;border-radius:8px;padding:11px;font-weight:600}.ocr-recognize-btn:disabled{opacity:.6;cursor:not-allowed}.ocr-progress{flex-direction:column;gap:8px;display:flex}.ocr-progress-bar{background:var(--bg);border-radius:3px;height:6px;overflow:hidden}.ocr-progress-fill{background:var(--accent);height:100%;transition:width .15s ease-out}.ocr-progress-row{color:var(--text-muted);justify-content:space-between;align-items:center;font-size:12px;display:flex}.ocr-cancel-btn{border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:6px;padding:4px 10px;font-size:12px}.ocr-cancel-btn:hover{background:var(--bg)}.ocr-error{color:var(--danger);margin:0;font-size:13px}.ocr-result{flex-direction:column;gap:10px;display:flex}.ocr-result textarea{border:1px solid var(--border);background:var(--bg);width:100%;color:var(--text);resize:vertical;border-radius:8px;padding:10px;font-family:inherit;font-size:13px}.ocr-result-actions{gap:8px;display:flex}.ocr-result-actions button{border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:8px;flex:1;padding:9px;font-size:13px}.ocr-result-actions button:hover:not(:disabled){background:var(--bg)}.ocr-result-actions button:disabled{opacity:.6;cursor:not-allowed}.ocr-insert-btn{font-weight:600;background:var(--accent)!important;color:#fff!important;border:none!important}.conflict-banner{border:1px solid var(--danger);width:100%;max-width:900px;color:var(--text);background:#d645451f;border-radius:8px;align-items:center;gap:12px;margin-bottom:16px;padding:10px 16px;font-size:14px;display:flex}.conflict-banner button{border:1px solid var(--border);background:var(--surface);color:var(--text);white-space:nowrap;border-radius:6px;padding:6px 12px}.conflict-banner button:hover{background:var(--bg)}
