:root{--bg:#e9e9ec;--toolbar:#fafafa;--border:#d4d4d8;--accent:#2563eb;--text:#18181b}*{box-sizing:border-box}html,body{background:var(--bg);height:100%;color:var(--text);-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;overscroll-behavior:none;margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;overflow:hidden}body{flex-direction:column;display:flex}[hidden]{display:none!important}body>section{flex-direction:column;flex:1;min-height:0;display:flex}#library-view{touch-action:pan-y;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;overflow-y:auto}.library-header{padding:16px 24px 0;padding-top:max(16px, env(safe-area-inset-top));justify-content:space-between;align-items:center;display:flex}.library-header h1{margin:0;font-size:28px}.library-header button{background:var(--accent);color:#fff;touch-action:manipulation;border:none;border-radius:10px;height:40px;padding:0 16px;font-size:16px;font-weight:600}#notebook-list{padding:24px;padding-bottom:max(24px, env(safe-area-inset-bottom));grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:32px 28px;margin:0;list-style:none;display:grid}.library-empty{color:#71717a;grid-column:1/-1}.notebook-item{position:relative}.notebook-card{-webkit-touch-callout:none;color:inherit;touch-action:manipulation;-webkit-tap-highlight-color:transparent;outline-offset:4px;border-radius:12px;flex-direction:column;gap:2px;text-decoration:none;display:flex}.notebook-card:focus-visible{outline:2px solid var(--accent)}.notebook-card .cover{aspect-ratio:1240/1754;background:var(--cover);border-radius:4px 10px 10px 4px;margin-bottom:10px;transition:transform .15s,box-shadow .15s;position:relative;overflow:hidden;box-shadow:inset 8px 0 #0003,0 1px 2px #0000001f,0 6px 16px #0000001f}.notebook-card .cover.has-thumbnail{background:#fff}.notebook-card .cover.has-thumbnail:before{content:"";background:var(--cover);z-index:1;width:9px;position:absolute;inset:0 auto 0 0;box-shadow:inset -2px 0 #00000026}.notebook-card .cover img{object-fit:cover;pointer-events:none;-webkit-user-drag:none;width:100%;height:100%;display:block}@media (hover:hover){.notebook-card:hover .cover{transform:translateY(-3px);box-shadow:inset 8px 0 #0003,0 2px 4px #0000001f,0 12px 24px #00000029}}.notebook-card:active .cover{transform:scale(.97)}.notebook-card .title,.notebook-card .meta{padding-right:36px}.notebook-card .title{text-overflow:ellipsis;white-space:nowrap;font-size:15px;font-weight:600;overflow:hidden}.notebook-card .meta{color:#71717a;text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.card-more{color:#52525b;touch-action:manipulation;-webkit-tap-highlight-color:transparent;background:0 0;border:none;border-radius:10px;width:40px;height:40px;font-size:22px;line-height:1;position:absolute;bottom:-4px;right:-6px}.card-more:hover,.card-more:focus-visible{background:#0000000f}.card-menu{z-index:10;background:#fff;border-radius:14px;min-width:220px;max-width:calc(100vw - 16px);padding:6px;animation:.12s ease-out card-menu-in;position:fixed;box-shadow:0 0 0 1px #0000000f,0 10px 30px #0000002e}@keyframes card-menu-in{0%{opacity:0;transform:scale(.96)}}.card-menu-title{color:#71717a;text-overflow:ellipsis;white-space:nowrap;padding:8px 12px 6px;font-size:13px;font-weight:600;overflow:hidden}.card-menu-item{width:100%;min-height:44px;color:var(--text);font:inherit;text-align:left;touch-action:manipulation;background:0 0;border:none;border-radius:8px;padding:0 12px;font-size:16px;display:block}.card-menu-item:hover,.card-menu-item:focus-visible{background:#f4f4f5;outline:none}.card-menu-item.danger{color:#dc2626}.card-menu-covers{flex-wrap:wrap;gap:8px;padding:8px 12px 10px;display:flex}.card-menu-cover{width:28px;height:28px;box-shadow:0 0 0 1px var(--border);touch-action:manipulation;border:2px solid #fff;border-radius:50%}.card-menu-cover.active{box-shadow:0 0 0 2px var(--accent)}.card-menu-sep{background:var(--border);height:1px;margin:4px 6px}#toolbar .back{height:40px;color:var(--accent);white-space:nowrap;touch-action:manipulation;align-items:center;padding:0 8px;font-size:17px;text-decoration:none;display:inline-flex}.notebook-title{text-overflow:ellipsis;white-space:nowrap;max-width:200px;font-weight:600;overflow:hidden}#toolbar{padding:8px 12px;padding-top:max(8px, env(safe-area-inset-top));background:var(--toolbar);border-bottom:1px solid var(--border);z-index:1;flex-wrap:wrap;align-items:center;gap:6px;display:flex}#toolbar button{min-width:40px;height:40px;color:var(--text);touch-action:manipulation;background:0 0;border:1px solid #0000;border-radius:8px;font-size:18px}#toolbar button.active{border-color:var(--accent);background:#dbeafe}#toolbar button:disabled{opacity:.35}.sep{background:var(--border);width:1px;height:28px;margin:0 4px}#colors,#sizes{gap:4px;display:flex}.swatch{box-shadow:0 0 0 1px var(--border);border:2px solid #fff!important;border-radius:50%!important;width:28px!important;min-width:28px!important;height:28px!important}.swatch.active{box-shadow:0 0 0 2px var(--accent)}#toolbar button.eraser-mode{padding:0 10px;font-size:14px}#sizes .sep{align-self:center}#toolbar button.text-tool{font-family:Georgia,Times New Roman,serif;font-size:19px;font-weight:700}#toolbar button.text-size{font-weight:600}.eraser-dot{border:1.5px solid var(--text);border-radius:50%;display:inline-block}.size-dot{background:var(--text);border-radius:50%;display:inline-block}.save-status{color:#71717a;white-space:nowrap;margin-left:auto;font-size:13px}.save-status.error{color:#dc2626}.finger{align-items:center;gap:4px;font-size:14px;display:flex}#stage{flex:1;position:relative;overflow:hidden}#stage>canvas{touch-action:none;width:100%;height:100%;position:absolute;inset:0}#live{pointer-events:none}.text-box-editor{z-index:1;outline:1.5px dashed var(--accent);outline-offset:4px;resize:none;white-space:pre-wrap;overflow-wrap:anywhere;transform-origin:0 0;-webkit-user-select:text;user-select:text;touch-action:manipulation;background:0 0;border:none;margin:0;padding:0;position:absolute;overflow:hidden}.selection-bar{z-index:2;touch-action:manipulation;background:#18181b;border-radius:12px;gap:2px;padding:4px;display:flex;position:absolute;top:0;left:0;box-shadow:0 6px 20px #00000040}.selection-bar button{color:#fff;min-height:40px;font:inherit;touch-action:manipulation;background:0 0;border:none;border-radius:8px;padding:0 14px;font-size:15px}.selection-bar button:hover,.selection-bar button:focus-visible{background:#ffffff1f;outline:none}.selection-bar button.danger{color:#fca5a5}#toolbar button svg{margin:auto;display:block}.template-tiles{gap:8px;padding:4px 8px 8px;display:flex}.template-tile{color:var(--text);font:inherit;touch-action:manipulation;background:0 0;border:1px solid #0000;border-radius:10px;flex-direction:column;align-items:center;gap:6px;padding:8px;font-size:13px;display:flex}.template-tile canvas{width:56px;box-shadow:0 0 0 1px var(--border), 0 1px 3px #00000014;border-radius:3px}.template-tile:hover,.template-tile:focus-visible{background:#f4f4f5;outline:none}.template-tile.active{border-color:var(--accent);background:#dbeafe}.page-overview{z-index:3;background:var(--bg);touch-action:pan-y;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;position:absolute;inset:0;overflow-y:auto}.page-overview-header{z-index:1;background:color-mix(in srgb, var(--bg) 92%, transparent);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);justify-content:space-between;align-items:center;padding:12px 24px;display:flex;position:sticky;top:0}.page-overview-header h2{margin:0;font-size:20px}.page-overview-header button{background:var(--accent);color:#fff;height:40px;font:inherit;touch-action:manipulation;border:none;border-radius:10px;padding:0 16px;font-weight:600}.page-grid{padding:8px 24px 32px;padding-bottom:max(32px, env(safe-area-inset-bottom));grid-template-columns:repeat(auto-fill,minmax(130px,150px));justify-content:center;gap:24px 28px;margin:0;list-style:none;display:grid}.page-tile{-webkit-touch-callout:none;position:relative}.page-thumb{aspect-ratio:1240/1754;touch-action:manipulation;-webkit-tap-highlight-color:transparent;background:#fff;border:none;border-radius:4px;width:100%;padding:0;display:block;overflow:hidden;box-shadow:0 1px 2px #0000001f,0 4px 12px #0000001a}.page-thumb canvas,.page-thumb img{pointer-events:none;-webkit-user-drag:none;width:100%;height:100%;display:block}.page-tile.current .page-thumb{box-shadow:0 0 0 3px var(--accent), 0 4px 12px #0000001a}.page-label{color:#52525b;justify-content:center;align-items:center;min-height:40px;font-size:14px;display:flex;position:relative}.page-tile.current .page-label{color:var(--accent);font-weight:600}.page-more{bottom:0;right:-8px}.page-add .page-thumb{box-shadow:none;color:#71717a;background:0 0;border:2px dashed #a1a1aa;font-size:32px}.page-tile.placeholder{opacity:.25}.page-ghost{z-index:20;pointer-events:none;transform-origin:0 0;filter:drop-shadow(0 12px 24px #00000040);margin:0;list-style:none;position:fixed;top:0;left:0}.library-actions{align-items:center;gap:8px;display:flex}.library-header button.library-more{color:#52525b;background:0 0;width:40px;padding:0;font-size:22px}.library-header button.library-more:hover,.library-header button.library-more:focus-visible{background:#0000000f}.card-menu-note{color:#71717a;max-width:260px;margin:0;padding:6px 12px 8px;font-size:13px;line-height:1.4}.file-ready{left:50%;bottom:max(24px, env(safe-area-inset-bottom));z-index:20;color:#fff;background:#18181b;border-radius:14px;align-items:center;gap:8px;max-width:calc(100vw - 32px);padding:8px 8px 8px 16px;font-size:15px;display:flex;position:fixed;transform:translate(-50%);box-shadow:0 6px 20px #00000040}.file-ready span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.file-ready button{background:var(--accent);color:#fff;height:36px;font:inherit;touch-action:manipulation;border:none;border-radius:9px;padding:0 14px;font-weight:600}.file-ready button.file-ready-close{background:0 0;padding:0 10px}.library-heading{min-width:0}.library-back{color:var(--accent);touch-action:manipulation;margin-bottom:2px;font-size:16px;text-decoration:none;display:inline-block}.library-title-row{align-items:center;gap:4px;min-width:0;display:flex}.library-header h1{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.library-header button.folder-more{color:#52525b;background:0 0;width:40px;padding:0;font-size:22px}.library-header button.folder-more:hover,.library-header button.folder-more:focus-visible{background:#0000000f}.library-search{padding:16px 24px 0}.library-search input{border:1px solid var(--border);width:100%;max-width:420px;height:40px;color:var(--text);font:inherit;-webkit-user-select:text;user-select:text;background:#fff;border-radius:10px;padding:0 14px;font-size:16px}.library-search input:focus{outline:2px solid var(--accent);outline-offset:-1px}.notebook-card .cover.folder-cover{background:linear-gradient(#93c5fd,#60a5fa);border-radius:4px 12px 12px;justify-content:center;align-items:center;display:flex;overflow:visible;box-shadow:0 1px 2px #0000001f,0 6px 16px #0000001f}.notebook-card .cover.folder-cover:before{content:"";background:#93c5fd;border-radius:8px 8px 0 0;width:42%;height:16px;position:absolute;top:-12px;left:0}.folder-count{color:#fff;text-shadow:0 1px 2px #00000026;font-size:34px;font-weight:700}.notebook-card .snippet{color:#3f3f46;-webkit-line-clamp:3;-webkit-box-orient:vertical;margin-top:2px;padding-right:36px;font-size:13px;line-height:1.35;display:-webkit-box;overflow:hidden}.sync-status{color:#71717a;white-space:nowrap;cursor:pointer;padding:4px 6px;font-size:13px}.sync-status.error{color:#dc2626}#toolbar .sync-status{margin-left:4px}.sync-dialog{width:min(400px,100vw - 32px);color:var(--text);background:#fff;border:none;border-radius:14px;padding:20px;box-shadow:0 20px 50px #00000040}.sync-dialog::backdrop{background:#0000004d}.sync-dialog h2{margin:0 0 6px;font-size:20px}.sync-dialog .sync-help{color:#71717a;margin:0 0 16px;font-size:14px;line-height:1.4}.sync-dialog label{flex-direction:column;gap:4px;margin-bottom:12px;font-size:14px;font-weight:500;display:flex}.sync-dialog input{font:inherit;border:1px solid var(--border);border-radius:8px;padding:9px 10px;font-size:16px;font-weight:400}.sync-dialog .sync-error{color:#dc2626;margin:0 0 12px;font-size:14px}.sync-dialog .sync-buttons{align-items:center;gap:8px;display:flex}.sync-dialog .spacer{flex:1}.sync-dialog button{font:inherit;min-height:40px;color:var(--text);background:#f4f4f5;border:none;border-radius:8px;padding:0 14px;font-size:15px}.sync-dialog button.primary{background:var(--accent);color:#fff}.sync-dialog button.danger{color:#dc2626;background:0 0;padding:0 4px}
