:root{--ink:#18243a;--muted:#78849a;--blue:#1769ee;--line:#e6eaf1;--surface:#fff;--soft:#f5f7fb;--shadow:0 4px 20px #2033590b;font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--ink);font-size:14px;font-synthesis:none}
*{box-sizing:border-box}body{margin:0;overflow:hidden;background:#f8fafd}button,input,textarea,select{font:inherit}button,a,input,textarea,select{-webkit-tap-highlight-color:transparent}button{cursor:pointer;color:inherit}button{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;background:transparent}button:disabled{cursor:default;opacity:.38}a{color:var(--blue)}button,button svg{flex-shrink:0}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,[tabindex]:focus-visible{outline:3px solid #90bafa;outline-offset:3px}input,textarea,select{border:1px solid #dce3ee;background:#fff;color:var(--ink);border-radius:8px;padding:11px 12px;outline:none;max-width:100%}input:focus,textarea:focus,select:focus{border-color:#83aef5;box-shadow:0 0 0 3px #1769ee0e}input::placeholder,textarea::placeholder{color:#a0a9bb}textarea{resize:vertical}svg{vertical-align:middle}h1,h2,h3,p{margin:0}.app-shell{height:100dvh;display:flex}.sidebar{width:214px;min-width:214px;background:#fbfcfe;border-right:1px solid var(--line);display:flex;flex-direction:column;padding:25px 16px 15px;position:relative;z-index:5}.brand{display:flex;gap:10px;align-items:center;padding:0 5px;text-decoration:none;color:var(--ink);margin-bottom:36px}.brand img{width:31px;height:31px}.brand>span{font-size:17px;font-weight:730;letter-spacing:-.6px}.brand>span>span{font-weight:440}.workspace-tag{font-size:9px;letter-spacing:1.6px;font-weight:700;color:#8e98aa;display:flex;justify-content:space-between;padding:0 9px}.workspace-tag>span{font-size:14px;color:#adc3e4}.new-board{background:#fff;border:1px solid #dce3ee;border-radius:9px;justify-content:flex-start;padding:11px 12px;margin:13px 0 30px;font-weight:560;box-shadow:0 2px 3px #18243a03}.new-board:hover{border-color:#8fb7f9;color:var(--blue)}.side-heading{font-size:11px;font-weight:650;color:#8a94a6;padding:0 11px;margin-bottom:11px}.board-item{display:flex;text-align:left;width:100%;gap:10px;padding:12px 10px;border-radius:8px;margin-bottom:4px;font-size:12px;color:#7b8496;line-height:1.45}.board-item>span:nth-child(2){flex:1;overflow:hidden;text-overflow:ellipsis}.board-item small{font-size:10px;opacity:.5}.board-item.active{background:#eaf1ff;color:#1555c3;font-weight:580}.board-item:hover:not(.active){background:#f0f3f8}.board-dot{height:7px;width:7px;border-radius:3px;background:#74a3ed;flex-shrink:0}.board-dot.purple{background:#a594e9}.side-divider{height:1px;background:var(--line);margin:25px 10px 17px}.nav-item{width:100%;padding:11px 10px;justify-content:flex-start;border-radius:8px;color:#68758c;font-size:12px}.nav-item:hover,.nav-item.active{color:var(--blue);background:#eef4ff}.count{margin-left:auto;font-size:11px}.sidebar-bottom{margin-top:auto}.space-note{margin:30px 10px;color:#9ba6b8;line-height:1.8;font-size:12px}.space-note .tiny-spark{font-size:25px;line-height:2;color:#bacbe3}.space-note strong{font-weight:500;color:#6b7b94}.save-status{color:#8f9aab;justify-content:flex-start;gap:6px;font-size:10px;margin:15px 9px 2px;white-space:nowrap}.save-status svg{color:#55a080}.save-status.save-error{color:#b8484e;white-space:normal}.main-app{flex:1;min-width:0;display:flex;flex-direction:column}.topbar{height:75px;min-height:75px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;padding:0 26px;gap:22px;justify-content:space-between;z-index:6}.board-heading{display:flex;align-items:center;min-width:100px;flex:1;gap:10px}.board-glyph{color:#6d7f9d;display:flex}.board-heading button{font-size:14px;font-weight:630;letter-spacing:-.3px;max-width:270px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;padding:5px 0}.view-tabs{padding:4px;border:1px solid #e7ebf3;border-radius:11px;display:flex;background:#f7f9fc;gap:3px}.view-tabs button{padding:9px 16px;border-radius:7px;font-size:12px;color:#8290a6;white-space:nowrap;gap:7px;transition:background .15s}.view-tabs button.active{background:#fff;color:#195ecd;box-shadow:0 1px 5px #23365d12;font-weight:600}.header-actions{display:flex;align-items:center;gap:3px;flex:1;justify-content:flex-end}.icon-button{height:32px;width:32px;border-radius:7px;color:#8090a8;padding:0}.icon-button:hover:not(:disabled){background:#eef3fb;color:var(--blue)}.action-divider{width:1px;height:20px;background:var(--line);margin:0 9px}.button{border:1px solid #dfe5ef;background:#fff;color:#4b5e79;border-radius:8px;padding:10px 14px;font-size:12px;font-weight:580;line-height:1.4}.button:hover{background:#f4f7fc;border-color:#c5d2e5}.button.primary{background:var(--blue);border-color:var(--blue);color:#fff;box-shadow:0 3px 6px #1769ee17}.button.primary:hover{background:#0958d5}.build-button{white-space:nowrap}.button.danger{background:#c84654;color:white;border-color:#c84654}.danger-text{color:#b44952!important}.contextbar{height:47px;min-height:47px;border-bottom:1px solid #eaf0f6;background:#ffffffad;display:flex;align-items:center;justify-content:space-between;padding:0 27px;color:#8290a5;font-size:11px}.contextbar>#view-description{display:flex;gap:9px;align-items:center}.contextbar svg{color:#95a8c7}.context-right{display:flex;align-items:center;gap:18px}.badge{display:inline-flex;align-items:center;border-radius:5px;font-size:10px;padding:4px 7px;background:#edf5f1;color:#7b968b}.badge.example{color:#8d7ec3;background:#f0ecfa}.quiet-button{font-size:10px;color:#8494ac;gap:5px}.workspace{position:relative;flex:1;min-height:0;display:flex}.main-view{position:relative;flex:1;min-width:0;overflow:hidden}.canvas-viewport{position:absolute;inset:0;overflow:hidden;background-color:#f9fbff;background-image:radial-gradient(#cbd7e7 0.85px,transparent 0.85px);touch-action:none}.canvas-viewport.tool-hand,.canvas-viewport.panning{cursor:grab}.canvas-viewport.tool-hand:active,.canvas-viewport.panning:active{cursor:grabbing}.canvas-viewport.tool-connect [data-node]{cursor:crosshair}.canvas-viewport.file-hover{box-shadow:inset 0 0 0 5px #8bb4f6;background-color:#eef5ff}.canvas-world{position:absolute;transform-origin:0 0;left:0;top:0}.edge-layer{position:absolute;overflow:visible;pointer-events:none}.edge{pointer-events:stroke;cursor:pointer}.edge-line{fill:none;stroke:#afc4eb;stroke-width:1.8}.edge.alternative .edge-line{stroke:#60b9ab;stroke-dasharray:7 6}.edge-hit{fill:none;stroke:transparent;stroke-width:16}.edge:hover .edge-line{stroke:var(--blue);stroke-width:2.5}.edge rect{fill:#f9fbff;stroke:#dbe5f4;stroke-width:1}.edge text{font-size:11px;fill:#5d769d;stroke:none}.node{width:240px;position:absolute;border:1px solid #d7e2f3;border-radius:11px;background:#fff;box-shadow:0 3px 6px #34476b06,0 7px 19px #34476b05;cursor:grab;user-select:none;touch-action:none;transition:box-shadow .15s,border-color .15s;color:#334c74}.node:active{cursor:grabbing}.node:hover{box-shadow:0 6px 20px #34507413;border-color:#acc9f3}.node.selected,.node.connecting{outline:2px solid #3985ff;outline-offset:2px;box-shadow:0 5px 25px #1769ee13}.node .node-content{padding:17px 19px 21px}.node-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:13px}.node-kind{display:flex;align-items:center;gap:7px;color:#5b8bcc;font-size:10px;font-weight:550}.node-kind span{text-transform:capitalize}.node h3{font-size:15px;font-weight:620;line-height:1.5;letter-spacing:-.23px;color:#2c4468;overflow-wrap:anywhere}.node p{font-size:12px;line-height:1.75;color:#6a7f9c;margin-top:8px;white-space:pre-wrap;overflow-wrap:anywhere;max-height:170px;overflow:hidden}.node.color-blue{background:linear-gradient(140deg,#f7faff,#edf4ff);border-color:#d2e1f8}.node.color-yellow{background:linear-gradient(120deg,#fffdf1,#fff8dc);border-color:#efdea9}.node.color-yellow h3{color:#64583b}.node.color-yellow p{color:#928465}.node.color-yellow .node-kind{color:#b09b60}.node.color-purple{background:linear-gradient(125deg,#faf8ff,#f0ebfd);border-color:#e0d4f5}.node.color-purple h3{color:#5c4c85}.node.color-purple p{color:#8a7aa7}.node.color-purple .node-kind{color:#a58dd7}.node.color-mint{background:linear-gradient(125deg,#f4fdf9,#e9f8f3);border-color:#c2e5d8}.node.color-mint h3{color:#3c756a}.node.color-mint p{color:#6a998e}.node.color-mint .node-kind{color:#65a99a}.node.question{width:260px}.node.question h3{font-size:18px;line-height:1.45}.node.question .node-content{padding:20px 22px 24px}.node.image,.node.video{width:256px}.image-preview{display:block;width:100%;height:164px;border-radius:10px 10px 0 0;overflow:hidden;padding:0;background:#eef2f8;cursor:zoom-in}.image-preview img{height:100%;width:100%;object-fit:cover;object-position:top}.node.image .node-content,.node.video .node-content{padding:13px 17px 18px}.node.image .node-top,.node.video .node-top{margin-bottom:6px}.node.image p,.node.video p{font-size:11px}.timeline-pin{width:21px;height:21px;border-radius:50%;position:absolute;right:-7px;bottom:-7px;background:#fff;border:1px solid #dce6f5;color:#7898c3;display:grid;place-items:center}.node-link{font-size:11px;display:flex;gap:8px;align-items:center;margin-top:13px;text-decoration:none}.card-video video{width:100%;max-height:200px;border-radius:10px 10px 0 0;background:#eaf0f8}.node audio{width:216px;height:34px;margin:17px 11px 0}.audio-empty{height:50px;margin:23px 15px 0;display:flex;align-items:center;justify-content:center;gap:5px}.audio-empty i{width:3px;background:#b0a0df;border-radius:5px}.media-empty{height:140px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;color:#99acc5;background:#eff4fb}.media-empty span{font-size:12px}.canvas-tools{position:absolute;left:17px;top:50%;transform:translateY(-50%);display:flex;align-items:center;flex-direction:column;gap:3px;padding:7px;border:1px solid #e2e8f1;background:#ffffffee;box-shadow:0 3px 15px #283f6908;border-radius:12px;z-index:3}.tool-button{height:34px;width:34px;border-radius:7px;padding:0;color:#8392aa}.tool-button:hover{color:var(--blue);background:#eef4ff}.tool-button.active{background:#eaf2ff;color:var(--blue)}.tool-divider{height:1px;width:24px;background:var(--line);margin:5px 0}.canvas-hint{position:absolute;bottom:18px;left:26px;font-size:9px;letter-spacing:.1px;color:#a6b0c1;pointer-events:none}.zoom-controls{position:absolute;bottom:17px;right:20px;background:#fff;border:1px solid #e3e9f2;box-shadow:0 3px 8px #26375805;border-radius:9px;display:flex;align-items:center;padding:3px 4px;gap:0;font-size:10px;color:#7e8fa8}.zoom-controls>span:not(#zoom-label){height:18px;width:1px;background:var(--line);margin:0 3px}.zoom-controls #zoom-label{width:39px;text-align:center;font-variant-numeric:tabular-nums}.zoom-controls .icon-button{width:29px;height:28px}.selection-box{position:absolute;background:#1769ee0e;border:1px solid #76a7f3;pointer-events:none}.selection-actions{position:absolute;left:90px;top:18px;display:flex;align-items:center;gap:8px;background:#fff;border:1px solid #d9e3f3;box-shadow:var(--shadow);padding:6px 9px;border-radius:9px;z-index:4}.selection-actions>span{font-size:11px;color:#89a0c0;margin-right:5px}.selection-actions>button:not(.icon-button){font-size:10px;padding:6px;color:#5779a8;gap:5px}.selection-actions>button:hover{background:#f1f6ff}.canvas-empty{position:absolute;top:45%;left:50%;transform:translate(-50%,-50%);text-align:center;width:80%;pointer-events:none}.canvas-empty>span{color:#b2c9ee;background:#f0f5fd;padding:20px;border-radius:25px;display:inline-flex;margin-bottom:24px}.canvas-empty h1{font-size:27px;letter-spacing:-1px;font-weight:530}.canvas-empty p{font-size:13px;line-height:1.9;color:#8b98ad;margin:12px 0 23px}.canvas-empty .button{pointer-events:auto}.canvas-empty small{display:block;font-size:10px;color:#a1adc0;margin-top:20px}.inspector-host{display:none;width:325px;min-width:325px;border-left:1px solid var(--line);background:#fff;overflow:auto}.inspector-host.open{display:block}.mode-lessons{overflow:auto;background:#f9fbfe;padding:30px}.mode-timeline{background:#f9fbfe;overflow:auto}
#overlay:empty{display:none}#overlay.visible{position:fixed;inset:0;z-index:30}.modal-scrim{position:absolute;inset:0;background:#2738513b;backdrop-filter:blur(5px);display:flex;align-items:center;justify-content:center;padding:25px}.dialog{background:#fff;border:1px solid #e7edf5;box-shadow:0 28px 100px #15284529;border-radius:18px;width:470px;max-height:92dvh;overflow:auto;padding:27px 28px 24px}.dialog.wide{width:770px}.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:17px}.dialog h2{font-size:20px;letter-spacing:-.65px;font-weight:620}.dialog-intro{color:#8390a5;font-size:12px;line-height:1.9;margin-bottom:22px}.field-label{display:flex;flex-direction:column;gap:8px;font-size:11px;color:#718098;font-weight:550;margin:16px 0}.field-label input{width:100%;font-size:13px;font-weight:400}.field-hint{font-size:10px;line-height:1.7;color:#94a0b4;margin-top:-5px}.dialog-actions{display:flex;gap:9px;justify-content:flex-end;margin-top:25px}.check-row{display:flex;align-items:center;gap:8px;font-size:12px;color:#7a8aa4;margin-top:18px}.check-row input{accent-color:var(--blue)}.menu-list{display:flex;flex-direction:column;gap:4px}.menu-list>button{width:100%;text-align:left;justify-content:flex-start;padding:14px 10px;border-radius:10px;gap:15px;color:#7187a8}.menu-list>button:hover{background:#f3f7ff}.menu-list>button>span{color:#435978;font-size:13px}.menu-list small{display:block;font-size:10px;color:#94a1b4;font-weight:400;margin-top:5px}.upload-zone{width:100%;padding:29px;min-height:156px;border:1px dashed #c5d7f0;border-radius:12px;flex-direction:column;gap:10px;background:#f7faff;color:#84a4ce}.upload-zone strong{font-size:13px;color:#4b72a5;font-weight:550}.upload-zone span{font-size:10px;color:#99adc8}.upload-zone:hover{border-color:#5f98eb;background:#eef5ff}.record-button{margin:15px auto 0;display:flex}.record-button.recording{color:#c45467;background:#fff1f4;border-color:#f0c4cd}.record-status{text-align:center;margin-top:10px;font-size:11px;color:#a37a89}.or-rule{display:flex;align-items:center;gap:12px;color:#a6b0c0;margin:24px 0 10px;font-size:10px}.or-rule:before,.or-rule:after{content:'';height:1px;background:var(--line);flex:1}.full-image{max-width:100%;max-height:72dvh;object-fit:contain;display:block;margin:auto}.guide-grid{display:grid;grid-template-columns:1fr 1fr;gap:25px;padding:12px 0}.guide-grid>div>svg{color:#8daee0;margin-bottom:12px}.guide-grid h3{font-size:14px;font-weight:600;margin-bottom:8px}.guide-grid p{font-size:12px;line-height:1.9;color:#7c8ba2}.guide-footer{margin-top:20px;border-top:1px solid var(--line);padding-top:22px;font-size:11px;color:#7e8fa6;line-height:1.8}.guide-footer strong{font-weight:600;color:#526985}.guide-footer>span{display:block;margin-top:10px;font-size:10px;color:#a1afc3}#toast{position:fixed;bottom:28px;left:50%;transform:translate(-50%,12px);padding:12px 19px;color:#fff;background:#263b59;box-shadow:0 5px 25px #17273f24;border-radius:10px;z-index:100;font-size:12px;max-width:90vw;opacity:0;pointer-events:none;transition:opacity .18s,transform .18s}#toast.show{opacity:1;transform:translate(-50%,0)}.boot{height:100dvh;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:15px;padding:30px;text-align:center}.boot-mark{font-size:40px;color:#9fbbe8}.boot h1{font-size:25px;font-weight:550;letter-spacing:-.8px}.boot p{font-size:13px;color:#8898af;max-width:500px;line-height:1.8}
@media(min-width:1700px){.sidebar{width:236px;min-width:236px}.topbar{padding:0 35px}.board-heading button{max-width:380px}}
@media(max-width:1200px){.sidebar{width:184px;min-width:184px;padding-left:12px;padding-right:12px}.topbar{padding:0 17px;gap:10px}.board-heading button{max-width:180px;font-size:12px}.view-tabs button{padding:9px 11px}.header-actions>.icon-button:not([data-action="board-menu"]):not([data-action="sync-status"]){display:none}.action-divider{display:none}.build-button{padding:9px 10px}.build-button span{font-size:11px}.inspector-host{width:295px;min-width:295px}}
@media(max-width:950px){.topbar{height:67px;min-height:67px}.board-heading button{max-width:180px}.header-actions{flex:0}.contextbar{padding:0 20px}.context-right .quiet-button{display:none}.inspector-host{position:absolute;right:0;top:0;bottom:0;z-index:8;box-shadow:-8px 0 30px #2a426914}.canvas-hint{display:none}.zoom-controls{bottom:86px}.canvas-tools{left:11px}}
@media(max-width:700px){.app-shell:not(.sidebar-collapsed) .sidebar{position:absolute;inset:0 auto 0 0;z-index:20;width:230px;min-width:230px;box-shadow:10px 0 40px #273d6120}.app-shell:not(.sidebar-collapsed) .sidebar-toggle{position:fixed;left:237px;top:15px;z-index:21;background:#fff}.topbar{flex-wrap:wrap;gap:5px;height:110px;padding:12px 15px}.board-heading{flex-basis:0;min-width:0;order:0}.board-heading button{max-width:230px;font-size:13px}.view-tabs{order:2;flex:1;justify-content:center;margin-top:5px}.view-tabs button{flex:1}.header-actions{order:1}.build-button span{display:none}.contextbar{height:40px;min-height:40px;padding:0 14px;font-size:10px}.context-right{gap:0}.badge{font-size:8px}.canvas-tools{padding:5px;gap:0;border-radius:9px;left:8px}.tool-button{height:32px;width:31px}.zoom-controls{right:12px;bottom:83px}.selection-actions{left:62px;top:10px;gap:3px;padding:4px;max-width:calc(100% - 70px)}.selection-actions>span{display:none}.selection-actions>button:not(.icon-button){font-size:9px;padding:5px}.selection-actions .icon-button{height:27px;width:27px}.inspector-host{width:min(340px,100%);min-width:0}.modal-scrim{padding:12px}.dialog{padding:20px;border-radius:14px}.dialog h2{font-size:18px}.guide-grid{grid-template-columns:1fr;gap:18px}.mode-lessons{padding:18px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

.timeline-picker{font-size:11px;padding:5px 10px;max-width:340px;border-color:#e3eaf4;background:#fff;color:#6e84a3}
.sidebar-toggle{flex-shrink:0;color:#7e90ac}.sidebar-collapsed .sidebar{display:none}.node-kind{width:27px;height:27px;padding:4px;border-radius:6px;margin:-4px;color:#7194c3}.node-kind:hover{background:#fff9;box-shadow:0 1px 4px #45628a15;color:var(--blue)}.node.media-image,.node.media-video{width:256px}.node.media-image .node-content,.node.media-video .node-content{padding:13px 17px 18px}.node.media-image .node-top,.node.media-video .node-top{margin-bottom:6px}.canvas-viewport.tool-hand [data-node]{cursor:grab}.canvas-viewport.tool-hand [data-node].selected{cursor:move}.type-picker-layer{position:absolute;inset:0}.type-picker{position:absolute;background:#fff;border:1px solid #dfe7f3;border-radius:13px;width:290px;padding:14px;box-shadow:0 12px 45px #263e7029;max-height:calc(100dvh - 20px);overflow:auto}.type-picker-heading{display:flex;align-items:center;justify-content:space-between;color:#8a99af;font-size:10px;margin-bottom:11px}.type-picker-heading .icon-button{width:22px;height:22px}.type-picker-heading .icon-button svg{width:15px}.type-picker-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}.type-picker-grid>button{padding:12px 2px 9px;flex-direction:column;gap:9px;font-size:9px;color:#8296b5;border:1px solid transparent;border-radius:8px}.type-picker-grid>button:hover{background:#f4f7fc;border-color:#e0e8f5;color:#2867c9}.type-picker-grid>button.active{background:#edf4ff;border-color:#d5e4fb;color:#1769ee}.type-picker-footer{margin-top:13px;padding-top:12px;border-top:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;font-size:9px;color:#9aa7bc}.type-picker-footer>div{display:flex;gap:5px}.type-picker-footer button{width:28px;height:28px;border-radius:6px;color:#92a4be}.type-picker-footer button:hover{color:#1769ee;background:#eff5ff}

/* Writing belongs on the card. Its optional heading stays next to the type icon. */
.node-top{gap:8px;align-items:flex-start}.node-kind{flex:0 0 27px}.node-heading{width:0;flex:1;min-width:0;border:0;border-radius:4px;background:transparent;padding:3px 0;font-size:17px;font-weight:700;line-height:1.35;color:inherit;white-space:pre-wrap;overflow-wrap:anywhere;resize:none;overflow:hidden;field-sizing:content;box-shadow:none;cursor:text}.node-heading::placeholder{color:#99aac1;font-weight:400;opacity:0}.node:hover .node-heading::placeholder,.node.selected .node-heading::placeholder,.node-heading:focus::placeholder{opacity:1}.node-heading:focus{border:0;box-shadow:none;outline:1px solid #8eb5ef;outline-offset:3px;background:#ffffff55}.node-writing{font-size:14px;font-weight:400;line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere;max-height:360px;overflow:hidden;color:inherit}.node-writing:empty{min-height:1.65em}.node.writing .node-writing{max-height:none;overflow:visible;cursor:text;user-select:text}.node-inline-editor{display:block;width:100%;min-height:64px;margin:0;padding:0;border:0!important;border-radius:0;background:transparent!important;color:inherit;font:inherit;line-height:inherit;letter-spacing:inherit;resize:none;box-shadow:none!important;outline:none!important;white-space:pre-wrap;overflow-wrap:anywhere;cursor:text;user-select:text;touch-action:auto}.node-inline-editor::placeholder{color:#7d94b4}.node.writing{cursor:text!important;outline:2px solid #3985ff;outline-offset:2px;box-shadow:0 5px 25px #1769ee13}

/* Board names are edited in place without covering or rebuilding the canvas. */
.board-heading .board-title-editor{width:270px;max-width:100%;min-width:0;border:1px solid transparent;border-radius:5px;background:transparent;padding:5px 2px;font-size:14px;font-weight:630;line-height:1.4;letter-spacing:-.3px;box-shadow:none;text-overflow:ellipsis;cursor:text}
.board-heading .board-title-editor:hover{background:#f7f9fd}
.board-heading .board-title-editor:focus{background:#fff;border-color:#8fb5ef;outline:none;box-shadow:0 0 0 3px #1769ee0b}
@media(min-width:1700px){.board-heading .board-title-editor{width:380px}}
@media(max-width:1200px){.board-heading .board-title-editor{width:180px;font-size:12px}}
@media(max-width:700px){.board-heading .board-title-editor{width:230px;font-size:13px}}

/* Use the header for tools, leaving the sides of the canvas clear. */
.topbar{height:60px;min-height:60px;gap:16px;padding:0 20px}
.contextbar{height:44px;min-height:44px;padding:0 18px;gap:16px}
.canvas-context #view-description{min-width:0;overflow-x:auto;scrollbar-width:thin}
.canvas-context .canvas-tools{position:static;transform:none;flex-direction:row;border:0;box-shadow:none;background:transparent;border-radius:0;padding:0;gap:3px;flex-shrink:0}
.canvas-tools .tool-divider{height:20px;width:1px;margin:0 5px}
.canvas-context .context-right{flex-shrink:0;gap:12px}
.canvas-context .badge:not(.example){display:none}
.selection-actions{left:18px;top:14px}
.node audio{width:calc(100% - 22px)}
/* Resizing uses canvas units so it behaves consistently at every zoom level. */
.node-resize{position:absolute;padding:0;z-index:2;touch-action:none;opacity:0;border:0;background:transparent}
.node:hover>.node-resize,.node.selected>.node-resize,.node.resizing>.node-resize,.node-resize:focus-visible{opacity:1}
.node-resize.resize-e{width:12px;height:calc(100% - 32px);right:-6px;top:16px;cursor:ew-resize}
.node-resize.resize-s{height:12px;width:calc(100% - 32px);bottom:-6px;left:16px;cursor:ns-resize}
.node-resize.resize-se{width:20px;height:20px;right:0;bottom:0;cursor:nwse-resize;border-radius:0 0 10px 0}

.node.resizing{outline:2px solid #3985ff;outline-offset:2px;transition:none}
.canvas-viewport.resizing-card *{cursor:inherit!important}
@media(max-width:700px){.topbar{height:94px;min-height:94px;padding:8px 12px;gap:5px}.contextbar{padding:0 10px;gap:8px}.canvas-context .context-right .quiet-button{display:none}.canvas-context .badge.example{max-width:75px;font-size:8px;text-align:center}.canvas-context .tool-button{height:32px;width:30px}.selection-actions{left:10px;max-width:calc(100% - 20px)}}

/* The type icon is the card's only visible control. Edges stay draggable. */
.node-top{gap:12px}
.node-kind{margin:0;align-self:flex-start;cursor:pointer}
.card-options-colors{display:flex;gap:10px;padding:14px 3px 0}
.card-color-choice{width:24px;height:24px;border-radius:50%;border:1px solid #cfd8e7;padding:0;color:#5277ac}
.card-color-choice[aria-pressed="true"]{outline:2px solid #80a9e6;outline-offset:2px}
.card-color-choice[data-card-color="blue"]{background:#e9f2ff}.card-color-choice[data-card-color="yellow"]{background:#fff3c3}.card-color-choice[data-card-color="purple"]{background:#eee4ff}.card-color-choice[data-card-color="mint"]{background:#daf4e9}.card-color-choice[data-card-color="white"]{background:#fff}
.card-options-actions{display:flex;flex-direction:column;border-top:1px solid var(--line);margin-top:10px;padding-top:7px;gap:2px}
.card-options-actions>button{justify-content:flex-start;padding:9px 8px;font-size:12px;border-radius:6px;color:#597397;gap:10px}
.card-options-actions>button:hover{background:#f0f5fd}

/* Keep card options close to the card, with compact, readable rows. */
.type-picker.card-options{width:264px;padding:10px;border-radius:10px}
.card-options .type-picker-heading{margin-bottom:6px;font-size:11px}
.card-options .type-picker-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:3px}
.card-options .type-picker-grid>button{flex-direction:row;justify-content:flex-start;padding:6px 8px;gap:7px;font-size:11px;border-radius:6px;min-height:30px}
.card-options .type-picker-grid>button svg{width:16px;height:16px}
.card-options .card-options-colors{gap:9px;padding:10px 4px 0}
.card-options .card-color-choice{width:20px;height:20px}
.card-options .type-picker-footer{margin-top:9px;padding-top:7px;font-size:10px}
.card-options .type-picker-footer button{width:25px;height:25px}
.card-options .type-picker-footer svg{width:16px;height:16px}
.card-options .card-options-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));margin-top:7px;padding-top:6px;gap:3px}
.card-options .card-options-actions>button{min-height:30px;padding:5px 4px;font-size:11px;gap:6px;text-align:left;line-height:1.25}
.card-options .card-options-actions>button svg{width:14px;height:14px}
.card-options .type-picker-heading>div{display:flex;gap:8px;align-items:center}
.clear-card-role{padding:2px;font-size:10px;color:#7d90ab}
.card-more-types{margin-top:8px;border-bottom:1px solid var(--line);padding-bottom:7px;color:#8092ad;font-size:10px}
.card-more-types>summary{cursor:pointer;padding:3px 0}
.card-more-types[open] .type-picker-grid{margin-top:5px}
.node-role{position:absolute;top:-11px;left:12px;height:20px;max-width:calc(100% - 115px);padding:2px 8px;border-radius:6px;border:1px solid #ccdcf3;background:#edf4ff;color:#55749c;font-size:10px;font-weight:600;line-height:1;z-index:5;box-shadow:0 2px 4px #34507408;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.node-role:hover{filter:brightness(.97)}
.node-role.role-emotion,.node-role.role-reflection{background:#f1eafb;border-color:#ded2f1;color:#8162a1}
.node-role.role-decision{background:#fff5d5;border-color:#e8d797;color:#947021}
.node-role.role-outcome{background:#e8f7f0;border-color:#c3e2d4;color:#498471}
.node-role.role-context{background:#eff1f5;border-color:#d9dfe8;color:#748197}

/* Connection points appear only when working with a card. */
.node-connect{position:absolute;width:22px;height:22px;padding:0;border:0;background:transparent;border-radius:50%;z-index:4;opacity:0;pointer-events:none;cursor:crosshair;touch-action:none}
.node-connect:after{content:'';width:8px;height:8px;display:block;background:#fff;border:2px solid #4289ed;border-radius:50%;box-shadow:0 0 0 2px #f9fbff}
.node:hover>.node-connect,.node.selected>.node-connect,.node.connecting>.node-connect,.node-connect:focus-visible,.tool-connect .node-connect{opacity:1;pointer-events:auto}
.node-connect:hover:after,.node-connect:focus-visible:after{background:#4289ed;transform:scale(1.25)}
.connect-top{left:calc(50% - 11px);top:-11px}.connect-right{right:-11px;top:calc(50% - 11px)}.connect-bottom{left:calc(50% - 11px);bottom:-11px}.connect-left{left:-11px;top:calc(50% - 11px)}
.node.connection-target{outline:3px solid #3985ff;outline-offset:4px;box-shadow:0 0 0 8px #3985ff16}
.edge-preview{fill:none;stroke:#3985ff;stroke-width:2;stroke-dasharray:5 4;pointer-events:none}.edge-preview.snapped{stroke-dasharray:none}
.canvas-viewport.drawing-connection,.canvas-viewport.drawing-connection *{cursor:crosshair!important}
.canvas-viewport.drawing-connection .node-connect{opacity:1;pointer-events:auto}
.canvas-viewport.panning .node-connect{pointer-events:none}

/* The image and writing share the card height; their boundary is the resize target. */
.node.media-image{display:flex;flex-direction:column}
.node.media-image>.image-preview{height:var(--image-height,220px);flex:none;background:#eef2f6}
.node.media-image>.image-preview img{display:block;width:100%;height:100%;object-fit:contain;object-position:center}
.node.media-image>.node-content{position:relative;flex:1;min-height:100px}
.media-divider{position:absolute;left:0;top:-6px;width:100%;height:12px;z-index:3;cursor:ns-resize;touch-action:none}
.media-divider:after{content:'';position:absolute;left:0;right:0;top:5px;height:1px;background:#b9c8dc80;pointer-events:none}
.media-divider:hover:after,.media-divider:focus-visible:after,.resizing-media .media-divider:after{height:2px;background:#3985ff}
.media-divider:focus-visible{outline:0}

/* Image nodes have no writing section; the picture fills the resizable node. */
.node.image-only{background:#eef2f6}
.node.image-only>.image-preview{position:absolute;inset:0;width:100%;height:100%;border-radius:10px;cursor:inherit}
.node.image-only>.node-kind{position:absolute;right:10px;top:10px;z-index:3;background:#ffffffed;border:1px solid #d8e1ed;box-shadow:0 2px 7px #233a621a;color:#5f7fae;width:30px;height:30px}
.node.image-only>.media-empty{position:absolute;inset:0;width:100%;height:100%;border-radius:10px}

/* The top surface grabs the card directly, without an extra move handle. */
.node-grab{position:absolute;top:0;left:0;right:0;height:22px;z-index:1;cursor:grab;touch-action:none;border-radius:10px 10px 0 0}
.node.media-image>.node-grab,.node.media-video>.node-grab{height:48px}
.node-top[data-node-grab],.node-heading[readonly]{cursor:grab;touch-action:none}
.node-heading[readonly]{user-select:none}
.node.writing .node-grab{cursor:grab!important}
.canvas-viewport.dragging-card,.canvas-viewport.dragging-card *{cursor:grabbing!important;user-select:none!important}
.node-time{display:flex;align-items:center;gap:5px;min-height:28px;margin:0;padding:2px 8px;color:#345f94;font-size:14px;font-weight:600;font-variant-numeric:tabular-nums;border:1px solid #c9d9ef;border-radius:9px;background:#fff;box-shadow:0 2px 7px #284b7812}
.node-time-button{padding:2px 3px;margin:0;color:inherit;font:inherit;border-radius:5px;background:transparent;cursor:pointer}
.node-time-button:hover,.node-time-button:focus-visible{background:#ffffffaa;color:#1769ee}
.node-time-button[aria-label="Add time"]{color:#6e84a4}
.node-time:has(>[aria-label="Add time"]){opacity:0;pointer-events:none}
:is(.node,.dm-map-card):hover>.node-time,.node-time.editing,.node-time:has(>.node-time-button:focus-visible){opacity:1;pointer-events:auto}
.node-time input{width:116px;min-width:0;height:29px;padding:2px 5px;background:#ffffffd9;border:1px solid #afc7e7;border-radius:5px;color:#324f79;font:inherit;box-shadow:none}
.node-time-clear{height:27px;width:27px;padding:0;font-size:20px;color:#6380a5;background:#ffffffbb;border-radius:5px;cursor:pointer}
/* The time stays attached just outside the node’s upper-right corner. */
.node>.node-time,.dm-map-card>.node-time,.dm-map-card>.dm-map-time{position:absolute;bottom:calc(100% - 8px);right:-12px;top:auto;left:auto;z-index:5;white-space:nowrap}
.node:has(>.node-time.editing),.dm-map-card:has(>.node-time.editing){z-index:6}

/* A real clock face, anchored to the badge at a readable size at any canvas zoom. */
.node-time-button{gap:5px}
.node-clock{position:fixed;z-index:1000;box-sizing:border-box;width:min(288px,calc(100vw - 16px));max-height:calc(100dvh - 16px);overflow:auto;padding:15px;border:1px solid #cfddf0;border-radius:16px;background:#fff;color:#314b72;box-shadow:0 12px 40px #263c6b24;user-select:none;font:14px/1.4 Inter,system-ui,sans-serif}
.node-clock-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:13px}
.node-clock-top strong{font-size:14px;font-weight:650}
.node-clock-close{padding:0;width:27px;height:27px;border-radius:6px;color:#7389a7;font-size:23px}
.node-clock-close:hover{background:#edf3fb}
.node-clock-readout{display:flex;align-items:center;justify-content:center;gap:7px;margin-bottom:15px}
.node-clock-part{display:flex;flex-direction:column;align-items:center;gap:4px;color:#8091a9;font-size:10px}
.node-clock-part input{box-sizing:border-box;width:66px;height:54px;padding:4px;border:1px solid transparent;border-radius:9px;background:#f0f4fa;color:#41618d;font:600 30px/1.2 Inter,system-ui,sans-serif;text-align:center;font-variant-numeric:tabular-nums;box-shadow:none;outline:none;cursor:text}
.node-clock-part.active input,.node-clock-part input:focus{background:#e9f2ff;border-color:#7ba8ed;color:#1769ee;box-shadow:0 0 0 2px #1769ee0b}
.node-clock-part input[aria-invalid="true"]{border-color:#ce6464}
.node-clock-colon{font-size:27px;padding-top:16px;color:#7290b7}
.node-clock-period{display:flex;flex-direction:column;align-self:flex-end;border:1px solid #d8e3f3;border-radius:8px;overflow:hidden;margin-left:3px}
.node-clock-period button{height:27px;width:42px;padding:0;font-size:11px;font-weight:650;color:#7388a7}
.node-clock-period button[aria-pressed="true"]{background:#e9f2ff;color:#1769ee}
.node-clock-face{position:relative;width:100%;aspect-ratio:1;border-radius:50%;background:#f2f6fc;touch-action:none;cursor:crosshair;outline-offset:4px}
.node-clock-dial{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.node-clock-ticks{stroke:#b9cae2;stroke-width:1}
.node-clock-hand line{stroke:#2278ee;stroke-width:2}
.node-clock-hand circle,.node-clock-center{fill:#2278ee}
.node-clock-number{position:absolute;transform:translate(-50%,-50%);width:34px;height:34px;padding:0;border-radius:50%;font-size:15px;font-weight:550;color:#3e587b;background:transparent;cursor:pointer;touch-action:none}
.node-clock-number[aria-pressed="true"]{color:#fff}
.node-clock-number:focus-visible{outline:2px solid #1769ee;outline-offset:2px}
.node-clock-hint{min-height:17px;margin:12px -5px 10px;font-size:11px;text-align:center;color:#7388a5}
.node-clock-footer{display:flex;align-items:center;justify-content:space-between;gap:12px}
.node-clock-clear{font-size:12px;color:#7b8da8;padding:8px 2px}
.node-clock-save{font-size:13px;font-weight:650;padding:9px 15px;border-radius:8px;background:#1769ee;color:#fff}
.node-clock-save:disabled{opacity:.4;cursor:default}

/* Quiet, centred cards; details take space only once written or opened. */
.node:not(.image-only){display:flex;flex-direction:column}
.node:not(.image-only)>.node-content{display:flex;flex:1;flex-direction:column;justify-content:center;gap:12px;min-height:100px;padding:24px 26px;text-align:center}
.node:not(.image-only) .node-top{display:block;margin:0}
.node .node-heading{display:block;width:100%;text-align:center}
.node:not(.writing) .node-top:has(.node-heading:placeholder-shown){display:none}
.node .node-writing:empty{display:none}
.node .node-writing,.node .node-inline-editor{text-align:center}
.node.writing:has([data-inline-writing]) .node-writing{padding-top:9px;border-top:1px solid #a9bddc55}
.node>.node-kind{position:absolute;top:8px;right:8px;z-index:3;opacity:0;pointer-events:none}
.node:hover>.node-kind,.node.selected>.node-kind,.node:focus-within>.node-kind{opacity:1;pointer-events:auto}
.node .node-link{justify-content:center}

/* Video owns the resizable area. Writing is optional and only uses its content height. */
.node.media-video>.card-video{position:relative;flex:1 1 auto;min-height:70px;overflow:hidden;border-radius:10px;background:#121923}
.node.media-video>.card-video video{position:absolute;inset:0;width:100%;height:100%;max-height:none;display:block;object-fit:contain;border-radius:inherit;background:#121923}
.node.media-video>.node-content{flex:0 1 auto;min-height:0;max-height:50%;overflow:auto;justify-content:flex-start;padding:16px 20px;gap:10px}
.node.media-video:not(.writing):has(.node-heading:placeholder-shown):has(.node-writing:empty)>.node-content{display:none}

/* Free canvas drawings: only the outline captures the pointer. */
.drawing-layer{position:absolute;overflow:visible;pointer-events:none;z-index:2}
.drawing{outline:none;pointer-events:none}
.drawing-line{fill:none;stroke:#397fe3;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;pointer-events:none}
.drawing-hit{fill:none;stroke:transparent;stroke-width:16;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:stroke;cursor:grab}
.drawing:hover .drawing-line,.drawing.selected .drawing-line,.drawing:focus-visible .drawing-line{stroke:#1769ee;stroke-width:3}
.drawing-handle{fill:#fff;stroke:#1769ee;stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:all;cursor:crosshair}
.drawing-preview{opacity:.7}.drawing-preview *{pointer-events:none}
.canvas-viewport:is(.tool-arrow,.tool-circle,.tool-rectangle,.tool-triangle,.tool-diamond,.tool-star,.tool-pencil){cursor:crosshair}
.canvas-viewport:is(.tool-arrow,.tool-circle,.tool-rectangle,.tool-triangle,.tool-diamond,.tool-star,.tool-pencil) .canvas-world *{pointer-events:none!important;cursor:crosshair!important}
.canvas-viewport.drawing-shape,.canvas-viewport.drawing-shape *{cursor:crosshair!important}
.canvas-viewport.panning .drawing-hit,.canvas-viewport.panning .drawing-handle{pointer-events:none}

/* Pencil marks keep a graphite edge; shape texture never distorts the geometry. */
.hand-drawn{color:#4e6074}
.drawing-grain{fill:none;stroke:currentColor;stroke-width:.75;stroke-dasharray:.5 2.3;stroke-linecap:round;opacity:.3;vector-effect:non-scaling-stroke;pointer-events:none}
.pencil-ink{fill:currentColor;stroke:none;opacity:.8;pointer-events:none}
.hand-drawn:is(:hover,.selected,:focus-visible){color:#344b65}
.graphite-shape,.graphite-shape:is(:hover,.selected,:focus-visible){color:#505052}
.graphite-pigment{pointer-events:none}
.graphite-shape .pencil-ink{opacity:1}
.graphite-fibre{fill:none;stroke:currentColor;stroke-width:.5;stroke-linecap:round;stroke-linejoin:round;opacity:.18;pointer-events:none}

@font-face{font-family:'Canvas Pencil';src:url('./assets/fonts/Caveat.ttf') format('truetype');font-style:normal;font-weight:400 700;font-display:swap}
.pencil-text-ink{font-family:'Canvas Pencil',cursive;font-weight:500;fill:currentColor;stroke:none;pointer-events:none;white-space:pre}
.text-drawing-hit{fill:transparent;stroke:transparent;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:all;cursor:grab}
.text-drawing:is(:hover,.selected,:focus-visible) .text-drawing-hit{stroke:#aac5ef;stroke-dasharray:4 4}
.canvas-viewport.tool-text{cursor:text}
.canvas-viewport.tool-text .canvas-world *{pointer-events:none!important}
.pencil-text-editor{max-width:none!important;position:absolute;z-index:10;margin:0;padding:0;border:0!important;border-radius:0!important;outline:1px dashed #aac5ef!important;outline-offset:5px;box-shadow:none!important;background:transparent!important;resize:none;overflow:hidden;font-family:'Canvas Pencil',cursive!important;font-weight:500!important;line-height:1.25!important;white-space:pre;min-height:0!important}
.drawing-options input[type=number]{width:65px;border:1px solid #d0d9e7;border-radius:6px;padding:5px;font:inherit;font-size:12px;color:#38577d;background:#fff}

/* Browse saved clips without leaving the map. */
.canvas-tools .clip-library-button{width:auto;padding:0 10px;gap:6px;font-size:13px;font-weight:550}
.dialog.clip-dialog{width:1000px;max-width:100%}
#clip-picker [hidden]{display:none!important}
.clip-search-row{display:flex;gap:12px;margin-bottom:16px}
.clip-search{display:flex;align-items:center;gap:10px;border:1px solid #dce3ee;border-radius:10px;padding-left:13px;flex:1;min-width:0;color:#7b8ca6}
.clip-search:focus-within{border-color:#83aef5}
.clip-search input{border:0;box-shadow:none;background:transparent;width:100%;min-width:0;font-size:15px}
.clip-search-row select{max-width:230px;font-size:14px}
.clip-browser{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:22px;height:min(460px,60dvh)}
.clip-results{overflow:auto;min-height:0;padding:3px 5px 5px 3px}
.clip-status{font-size:14px;color:#677b99;line-height:1.7;margin:0 0 13px}
.clip-retry{display:inline;padding:0;color:var(--blue);text-decoration:underline;font-size:inherit}
.clip-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:13px}
.clip-tile{display:flex;flex-direction:column;align-items:stretch;gap:7px;min-width:0;padding:6px;border:1px solid #e3eaf5;border-radius:12px;text-align:left;background:#fff}
.clip-tile:hover{background:#f4f8ff;border-color:#9bbcf1}
.clip-tile.selected{border-color:#1769ee;box-shadow:0 0 0 1px #1769ee;background:#f0f6ff}
.clip-thumbnail{position:relative;display:flex;justify-content:center;height:148px;border-radius:7px;overflow:hidden;background:#edf1f7}
.clip-thumbnail img{height:100%;width:100%;object-fit:contain}
.clip-no-thumbnail:before{content:'Preview unavailable';font-size:12px;align-self:center;color:#718098}
.clip-duration{position:absolute;bottom:6px;right:6px;background:#152238d9;color:white;padding:3px 5px;border-radius:5px;font-size:11px}
.clip-tile strong{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;font-size:14px;line-height:1.4;font-weight:550;color:#354d70;padding:0 3px}
.clip-tile small{font-size:11px;line-height:1.4;color:#7a8aa4;padding:0 3px 3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.clip-more{margin:16px auto 4px;display:flex}
.clip-preview{display:flex;flex-direction:column;gap:12px;min-height:0;overflow:auto;border-left:1px solid #e7edf5;padding-left:21px}
.clip-preview-empty{margin:auto;text-align:center;color:#8b9bb3;font-size:15px;line-height:1.5}
.clip-preview-empty svg{margin-bottom:14px}
.clip-preview video{width:100%;height:min(240px,32dvh);flex-shrink:0;object-fit:contain;background:#eef2f8;border-radius:10px}
.clip-preview h3{font-size:16px;line-height:1.4;color:#354d70;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;flex-shrink:0}
.clip-caption{font-size:13px;line-height:1.6;color:#6f819b;max-height:64px;overflow:auto;white-space:pre-line;flex-shrink:0}
.clip-playback-error{font-size:13px;line-height:1.6;color:#8c5c52}
.clip-preview>.button{flex-shrink:0;min-height:42px;margin-top:auto;font-size:14px;position:sticky;bottom:0}
.clip-picker-footer{display:flex;justify-content:space-between;gap:12px;margin-top:18px;padding-top:14px;border-top:1px solid #e7edf5;font-size:12px;color:#8795aa}
.clip-picker-footer a{display:inline-flex;align-items:center;gap:6px;text-decoration:none}
@media(max-width:700px){.clip-browser{grid-template-columns:minmax(0,1fr) 170px;gap:12px}.clip-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.clip-thumbnail{height:120px}.clip-preview{padding-left:12px}.clip-preview video{height:210px}.clip-search-row{flex-wrap:wrap}.clip-search-row select{max-width:100%;width:100%;padding:8px}.clip-picker-footer>span{display:none}}
@media(max-width:460px){.clip-browser{grid-template-columns:minmax(0,1fr) 145px;gap:10px}.clip-grid{grid-template-columns:1fr}.clip-preview h3{font-size:14px}.clip-preview>.button{padding:10px 7px;font-size:12px}}

/* Reusable frames sit behind the canvas cards. */
.canvas-group{position:absolute;border:1.5px solid #becdeb;border-radius:14px;background:rgba(230,238,251,.22);pointer-events:none;color:#35517b;box-sizing:border-box}
.group-header{height:52px;display:flex;align-items:center;gap:7px;padding:5px 14px;cursor:grab;pointer-events:auto;border-bottom:1px solid #dce5f3;background:#edf3fc;border-radius:13px 13px 0 0;box-sizing:border-box}
.group-header input{min-width:0;width:100%;border:0;background:transparent;font-family:inherit;font-size:22px;font-weight:600;line-height:1.3;color:#30496d;padding:5px 7px;outline:none;border-radius:6px;cursor:text}
.group-header input:focus{background:#fff;box-shadow:0 0 0 2px #90b5ff}
.group-header button{width:28px;height:28px;flex:none;display:grid;place-items:center;padding:3px;background:transparent;border:0;border-radius:6px;color:#6882aa;cursor:pointer}
.group-header button:hover{background:#fff;color:#1767ec}
.group-count{position:absolute;bottom:8px;right:18px;font-size:12px;color:#8193ae}
.group-resize{position:absolute;right:-5px;bottom:-5px;width:20px;height:20px;background:transparent;border:0;cursor:nwse-resize;pointer-events:auto}
.canvas-group.collapsed{background:#fff;box-shadow:0 5px 18px #385e8810;pointer-events:auto}
.group-preview{display:block;width:100%;height:196px;padding:15px 18px;border:0;background:none;color:#4b6489;text-align:left;cursor:pointer}
.group-thumbnails{height:132px;display:flex;align-items:center;justify-content:center;gap:8px;overflow:hidden;border-radius:8px;background:#f1f5fb}
.group-thumbnails img{width:calc((100% - 16px)/3);height:100%;object-fit:cover;border-radius:5px}
.group-preview>span{display:flex;align-items:center;justify-content:space-between;margin-top:12px;font-size:14px;font-weight:600}
.group-preview small{display:flex;align-items:center;gap:5px;font-size:11px;font-weight:400;color:#8294ae}
.object-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:10px;max-height:55vh;overflow:auto;margin-bottom:20px}
.object-choice{display:flex;align-items:center;gap:12px;padding:18px;background:#f7faff;border:1px solid #d9e4f6;border-radius:10px;color:#35517b;text-align:left;cursor:pointer}
.object-choice>span{flex:1}.object-choice strong,.object-choice small{display:block}.object-choice small{font-size:12px;margin-top:6px;color:#8294ae}.object-choice:hover{border-color:#357cff;background:#edf4ff}
.group-new-board{width:100%;padding:12px;border:1px solid #d5e0f2;border-radius:8px;font:inherit}
.saved-caption{max-height:60vh;overflow:auto;white-space:pre-wrap;font-size:16px;line-height:1.65;margin-bottom:20px}
.clip-notes-button{position:absolute;right:10px;top:45px;z-index:5;border:1px solid #d8e2f2;border-radius:6px;background:#fffffff0;padding:6px;color:#526c94;opacity:0;cursor:pointer}.node:hover .clip-notes-button,.node:focus-within .clip-notes-button{opacity:1}

.group-back{position:absolute;top:12px;left:18px;z-index:12;background:white;box-shadow:0 3px 14px #54729616}

.group-jump{max-width:190px;margin-left:8px;padding:6px 24px 6px 9px;font-size:13px;background:#fff;border:1px solid #dce5f3}.group-header input{padding-left:0;text-overflow:ellipsis}.group-preview>span{font-size:16px}.group-preview small{font-size:12px}

/* Full board names remain available when the sidebar is opened. */
.board-item{position:relative}
.board-initials{display:none}

/* Spaces are the top-level organiser; the sidebar only lists their boards. */
.space-switcher{gap:8px;max-width:190px;min-width:0;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:#f7f9fc;font-size:13px;font-weight:600;flex-shrink:0}
.space-switcher>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.space-switcher>svg:last-child{transform:rotate(90deg)}
#overlay.spaces-popover-layer{pointer-events:none}
.spaces-popover{pointer-events:auto;position:fixed;width:280px;max-width:calc(100vw - 16px);overflow:auto;background:#fff;border:1px solid #dce3ee;border-radius:9px;padding:6px;box-shadow:0 5px 22px #263e7026}
.spaces-list{display:grid;gap:2px;margin:0}
.space-row{display:flex;align-items:center;gap:2px}
.space-choice{flex:1;min-width:0;justify-content:flex-start;text-align:left;padding:9px 10px;border-radius:5px;font-size:13px}
.space-choice>span{flex:1;overflow-wrap:anywhere}
.space-choice.active{background:#eaf1ff;color:#1555c3}
.space-choice:hover{background:#f0f4fa}
.spaces-footer{display:flex;align-items:center;justify-content:space-between;gap:6px;border-top:1px solid var(--line);margin-top:6px;padding-top:6px}
.spaces-footer>div{display:flex;gap:0}
.spaces-footer #new-space{padding:8px 10px;border-radius:5px;font-size:12px;white-space:nowrap}
.spaces-footer #new-space:hover{background:#f0f4fa}
.spaces-popover .icon-button{height:30px;width:30px}
@media(pointer:coarse){.spaces-popover button{min-height:44px}.spaces-popover .icon-button{width:40px}.spaces-footer #new-space{padding:8px}}
.empty-space .board-heading,.empty-space .view-tabs,.empty-space .build-button,.empty-space [data-action="board-menu"],.empty-space .contextbar,.empty-space .sidebar [data-action="lessons"],.empty-space .sidebar .side-divider,.empty-space .sidebar .space-note{display:none}
.space-empty{height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:24px;background:#f8fafd}
.space-empty h1{font-size:24px;font-weight:600;color:#485d79}
@media(max-width:1200px){.space-switcher{max-width:145px;font-size:12px;padding:7px 8px}}
@media(max-width:700px){.topbar{height:auto;min-height:110px}.space-switcher{max-width:150px}.board-heading{order:2;flex-basis:100%}.view-tabs{order:3;flex-basis:100%}.empty-space .topbar{min-height:67px}.spaces-footer{flex-wrap:wrap}}

/* Authentication failures stay actionable in the clip instead of a blank player. */
.clip-access-host{position:relative}
.clip-access-notice{position:absolute;inset:0;z-index:2;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:20px;background:#f5f8fd;color:#3c5375;text-align:center;font-size:16px;line-height:1.4}
.clip-access-notice strong{font-weight:600}.clip-access-notice a{padding:8px 15px;border-radius:7px;background:#1769ee;color:#fff;text-decoration:none;white-space:nowrap}.clip-access-notice button{font-size:14px;color:#597498;padding:4px 12px}

.hand-drawn,.hand-drawn:is(:hover,.selected,:focus-visible){color:var(--drawing-ink,#505052)}
.compact-popover-layer{background:transparent;display:block}
.compact-popover{position:fixed;width:280px;padding:12px;border:1px solid var(--line,#d7e0ee);border-radius:14px;background:white;box-shadow:0 8px 30px #203c6420;display:flex;flex-direction:column;gap:12px;pointer-events:auto;overflow:auto}
.compact-popover small{color:#7788a3;font-size:12px}
.shape-choices{display:grid;grid-template-columns:repeat(3,1fr);gap:4px}
.shape-choices button{display:flex;align-items:center;flex-direction:column;gap:6px;padding:12px 5px;border:0;background:none;border-radius:8px;color:#38577d;font:inherit;font-size:12px;cursor:pointer}
.shape-choices button:hover{background:#edf3ff}
.drawing-colours{display:flex;align-items:center;gap:6px}
.drawing-colours .ink-swatch{min-width:22px;width:22px;height:22px;border-radius:50%;background:var(--ink);padding:0;border:2px solid white;box-shadow:0 0 0 1px #d0d9e7}
.drawing-colours .ink-swatch[aria-pressed="true"]{box-shadow:0 0 0 2px #2868d7}
.drawing-colours input{width:28px;height:28px;border:0;padding:0;background:none;cursor:pointer}
.drawing-options select{border:1px solid #d0d9e7;background:white;color:#38577d;border-radius:6px;padding:5px;font:inherit;font-size:12px}
.sync-indicator[data-state="synced"]{color:#7386a4}.sync-indicator[data-state="locked"],.sync-indicator[data-state="offline"]{color:#bd7527}
.sync-indicator[data-state="syncing"] svg{animation:sync-turn 2s linear infinite}
@keyframes sync-turn{to{transform:rotate(360deg)}}
.connection-direction{font-size:12px;line-height:1.5;max-height:60px;overflow:auto;color:#647b9b;overflow-wrap:anywhere}
.connection-actions{display:flex;justify-content:space-between;align-items:center}
.compact-popover:has(#edge-arrow){gap:10px;width:290px}
.compact-popover:has(#edge-arrow) .field-label{margin:0;font-size:12px;gap:5px}
.compact-popover:has(#edge-arrow) input:not([type=checkbox]),.compact-popover:has(#edge-arrow) select{padding:7px;font-size:13px;width:100%}
.compact-popover:has(#edge-arrow) .check-row{font-size:12px;margin:0}
.compact-popover:has(#edge-arrow)>button{justify-content:flex-start;padding:5px;font-size:12px;color:#5375a6}

/* Mobile embeds are images until tapped, not hundreds of idle video decoders. */
.video-preview{position:relative;width:100%;height:100%;min-height:80px;aspect-ratio:16/9;overflow:hidden;border-radius:inherit;background:#121923;color:#fff}
.node.media-video>.card-video>.video-preview{position:absolute;inset:0;aspect-ratio:auto}
.video-preview>.video-preview-button{position:absolute;inset:0;display:block;width:100%;height:100%;border:0;padding:0;border-radius:inherit;background:#121923;color:#fff;cursor:pointer;touch-action:manipulation}
.video-preview>.video-preview-button[hidden],.video-preview img[hidden],.video-preview-status[hidden]{display:none!important}
.video-preview>.video-preview-button>img,.video-preview>video{position:absolute;inset:0;display:block;width:100%;height:100%;max-height:none;object-fit:contain;background:#121923;border-radius:inherit}
.video-preview-prompt{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:8px;background:linear-gradient(transparent,#0003);font:600 14px/1.4 system-ui,sans-serif;text-shadow:0 1px 4px #000}
.video-preview-play{display:grid;place-items:center;width:52px;height:52px;border-radius:50%;background:#09121cbd;border:1px solid #ffffffa8;box-shadow:0 2px 12px #0004}
.video-preview-button:focus-visible{outline:3px solid #80bdff;outline-offset:-4px}
.video-preview>.video-preview-close{position:absolute;right:8px;top:clamp(4px,calc(100% - 48px),52px);z-index:3;display:grid;place-items:center;width:44px;height:44px;padding:0;border:1px solid #ffffff80;border-radius:50%;background:#09121ce6;color:white;cursor:pointer;touch-action:manipulation}
.video-preview>.video-preview-status{position:absolute;left:8px;right:8px;top:8px;z-index:1;padding:8px;border-radius:6px;background:#09121cd9;color:#fff;text-align:center;font:13px/1.4 system-ui,sans-serif;pointer-events:none}
.dm-tl-media-video>.video-preview{min-height:110px}
.replay-media>.video-preview{min-height:80px}
.inspector-media>.video-preview{height:auto;min-height:160px}
.inspector-media>.video-preview>.video-preview-close{top:8px}

/* Canvas movement is controlled by pan/zoom, never browser focus scrolling. */
.canvas-viewport{overflow:clip}

/* YouTube stays a thumbnail until the user starts its embedded player. */
.youtube-preview>iframe{position:absolute;inset:0;width:100%;height:100%;border:0;border-radius:inherit;background:#121923}
.youtube-preview .youtube-open{position:absolute;left:8px;top:8px;z-index:3;display:grid;place-items:center;width:32px;height:32px;background:#172338dc;color:white;border-radius:7px;opacity:0;pointer-events:none}
.youtube-preview:is(:hover,:focus-within) .youtube-open{opacity:1;pointer-events:auto}
.youtube-preview>.video-preview-close{width:32px;height:32px;top:8px;right:8px;opacity:0;pointer-events:none}
.youtube-preview:is(:hover,:focus-within)>.video-preview-close{opacity:1;pointer-events:auto}
@media(pointer:coarse){.youtube-preview .youtube-open,.youtube-preview>.video-preview-close{opacity:1;pointer-events:auto}}
.canvas-viewport.tool-text .text-drawing,.canvas-viewport.tool-text .text-drawing-hit{pointer-events:all!important}
.text-drawing-hit{cursor:text}

.node-fold{position:absolute;left:8px;top:-14px;z-index:4;display:flex;align-items:center;gap:4px;min-width:38px;height:27px;padding:3px 8px;border:1px solid #cbdcf7;border-radius:8px;background:#fff;color:#3973c7;box-shadow:0 2px 6px #17273f0b;font-size:11px;opacity:0;pointer-events:none}
.node-fold.is-collapsed,.node:is(:hover,:focus-within,.selected)>.node-fold{opacity:1;pointer-events:auto}
.youtube-preview .youtube-open{left:48px}
.youtube-preview>.video-preview-close{right:auto;left:8px}
.node-fold{left:50%;top:-43px;transform:translateX(-50%)}
.node[data-fold-state="collapsed"]::after{content:"";position:absolute;inset:5px;border:1px solid color-mix(in srgb,var(--card-border,#8aa6ce),var(--card-ink,#264b7f) 25%);border-radius:7px;pointer-events:none}
.canvas-viewport.fold-animating,.canvas-viewport.fold-animating *{pointer-events:none!important}
.canvas-viewport.fold-animating .node{transform-origin:center center}
/* Controls sit outside the picture and disappear quickly after leaving it. */
.youtube-preview,.node.media-video>.card-video:has(.youtube-preview){overflow:visible}
.youtube-preview .youtube-open{top:-37px;left:auto;right:0;background:#fff;color:#46648d;border:1px solid #d7e2f3;transition:opacity .1s}
.youtube-preview.is-playing>.youtube-open{display:none}
.youtube-controls{position:absolute;z-index:8;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:3px;width:max-content;max-width:100%;height:32px;padding:3px 5px;border:1px solid #d7e2f3;border-radius:9px;background:#fff;color:#46648d;box-shadow:0 3px 12px #22375512;opacity:0;pointer-events:none;transition:opacity .1s}
.youtube-preview.show-controls>.youtube-controls,.youtube-controls:hover,.youtube-controls:has(:focus-visible){opacity:1;pointer-events:auto}
.youtube-controls button{width:25px;height:25px;padding:0;border-radius:5px}
.youtube-controls button:hover{background:#edf3fe}
.youtube-controls input{width:95px;min-width:30px;padding:0;margin:0 4px;height:15px;accent-color:#1769ee;cursor:pointer}
.node:has(.youtube-preview.is-playing)>.node-fold{top:-80px}

/* Only the map list scrolls. The brand, New board button, heading and footer
   stay in place while the list consumes the remaining viewport height. */
.sidebar{
  height:100%;
  max-height:100dvh;
  min-height:0;
  overflow:hidden;
}
.sidebar>*{flex-shrink:0}
#board-list{
  flex:1 1 0;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior-y:contain;
  touch-action:pan-y pinch-zoom;
  -webkit-overflow-scrolling:touch;
  scroll-padding-block:8px;
}
.sidebar-bottom{margin-top:0}

/* Give the list priority over decorative whitespace on phones and short
   windows. Keep all functional footer controls available without scrolling. */
@media(max-width:900px),(max-height:700px){
  .sidebar{padding-top:16px;padding-bottom:max(10px,env(safe-area-inset-bottom))}
  .sidebar .brand{margin-bottom:16px}
  .sidebar .new-board{margin:8px 0 18px}
  .sidebar .space-note{display:none}
  .sidebar .side-divider{margin:10px 10px 6px}
  .sidebar .save-status{margin-top:8px}
}
@media(max-height:480px){
  .sidebar{padding-top:8px}
  .sidebar .brand{margin-bottom:4px}
  .sidebar .new-board{margin:4px 0 8px;padding-block:8px}
  .sidebar .side-heading{margin-bottom:6px}
  .sidebar .side-divider{margin-block:4px}
  .sidebar .nav-item{padding-block:7px}
  .sidebar .save-status{margin-top:4px}
}

/* The mobile canvas is an app frame, not a scrollable page. Follow the visual
   viewport when the keyboard pans it, without disabling browser pinch zoom. */
@media(max-width:900px),(pointer:coarse){
  html,body{height:100%;overflow:hidden}
  #app{position:fixed;left:0;top:0;width:var(--dm-viewport-width,100%);height:var(--dm-viewport-height,100dvh);transform:translate(var(--dm-viewport-left,0px),var(--dm-viewport-top,0px));overflow:clip}
  #app>.app-shell{height:100%;min-height:0;overflow:clip}
  .node-inline-editor{font-size:16px}
}

/* Mobile Decisions header: two compact rows rather than three stacked bars.
   Keep the editable map title and sync control visible; Social has its own UI. */
@media(max-width:700px){
  .app-shell:not(.social-space) .topbar{
    display:grid;
    grid-template-columns:40px minmax(0,1fr) auto;
    grid-template-rows:40px 36px;
    grid-template-areas:"boards title actions" "space space views";
    height:88px;
    min-height:88px;
    padding:4px 8px;
    gap:4px;
  }
  .app-shell:not(.social-space) .sidebar-toggle{grid-area:boards;width:40px;height:40px}
  .app-shell:not(.social-space) .board-heading{grid-area:1 / 2 / 2 / 4;min-width:0;gap:0;margin-right:128px}
  .app-shell:not(.social-space) .board-glyph{display:none}
  .app-shell:not(.social-space) .board-title-editor{width:100%;max-width:none;height:36px;font-size:16px;padding:4px 0}
  .app-shell:not(.social-space) .header-actions{grid-area:actions;justify-self:end;gap:2px}
  .app-shell:not(.social-space) .header-actions>.icon-button,
  .app-shell:not(.social-space) .build-button{width:40px;height:40px;padding:0}
  .app-shell:not(.social-space) .space-switcher{grid-area:space;justify-self:start;max-width:100%;height:36px;padding:6px 8px;gap:6px;font-size:12px}
  .app-shell:not(.social-space) .space-switcher>svg:first-child{display:none}
  .app-shell:not(.social-space) .view-tabs{grid-area:views;justify-self:end;min-width:0;height:36px;margin:0;padding:2px;border-radius:8px;gap:2px}
  .app-shell:not(.social-space) .view-tabs button{flex:0 1 auto;padding:4px 6px;gap:4px;font-size:11px;border-radius:6px}
  .app-shell:not(.social-space) .view-tabs svg{display:none}
  .app-shell:not(.social-space) .contextbar{height:40px;min-height:40px;padding:0 8px;gap:6px}
  .app-shell:not(.social-space) .canvas-context #view-description{flex:1;overscroll-behavior-x:contain;touch-action:pan-x pinch-zoom;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .app-shell:not(.social-space) .canvas-context #view-description::-webkit-scrollbar{display:none}
  .app-shell:not(.social-space) .canvas-context .canvas-tools{gap:2px}
  .app-shell:not(.social-space) .canvas-context .tool-button{height:36px;width:36px}
  .app-shell:not(.social-space) .canvas-context .clip-library-button{width:auto;padding-inline:8px;font-size:12px}
  .app-shell:not(.social-space).empty-space .topbar{grid-template-areas:"boards space actions";grid-template-rows:40px;height:48px;min-height:48px}
}
