:root {
  color-scheme: light;
  --paper:#eeeef3;
  --panel:#ffffff;
  --chrome:#f7f6fb;
  --ink:#2e2838;
  --muted:#61586d;
  --border:#d9d9e3;
  --border-strong:#c9c2d2;
  --branch:#af50c8;
  --accent:#694888;
  --accent-soft:#f0e8f8;
  --accent-raised:#e8dbf4;
  --gold:#ffe17c;
  --gold-soft:#fff3c9;
  --gold-ink:#684518;
  --danger:#962f47;
  --danger-soft:#fbecef;
  --lift:0 2px 0 #dfdfe9;
  --floating:0 8px 24px #30223f1c;
  font: 14px/1.45 -apple-system, "PingFang TC", sans-serif; color:var(--ink); background:var(--paper);
}
* { box-sizing:border-box }
[hidden] { display:none !important }
body { margin:0; overflow:hidden }
button,input,textarea,select { font:inherit }
button { cursor:pointer; color:inherit; border:0; background:none }
button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,[tabindex]:focus-visible { outline:2px solid var(--accent); outline-offset:2px }
button:disabled { opacity:.4; cursor:default }
input,textarea { color:var(--ink) }
.app { height:100dvh; display:grid; grid-template-columns:248px minmax(0,1fr) }
.library {
  color-scheme:dark;
  --chrome:#121212;
  --panel:#222222;
  --ink:#f5f5f5;
  --muted:#c7c7c7;
  --border:#373737;
  --border-strong:#555555;
  --branch:#bcbcbc;
  --accent:#eeeeee;
  --accent-soft:#2c2c2c;
  --accent-raised:#3a3a3a;
  --danger:#ffb4ab;
  --lift:0 2px 0 #080808;
  display:flex; flex-direction:column; color:var(--ink); background:var(--chrome); border-right:1px solid var(--border); padding:23px 14px 16px; min-height:0
}
.brand { display:flex; gap:12px; align-items:center; margin:0 9px 24px; font-size:20px; line-height:1.1; font-weight:700 }
.brand-name { display:flex; align-items:baseline; flex-wrap:wrap; gap:3px 7px }
.brand small { font-size:11px; color:var(--muted); font-weight:500; font-variant-numeric:tabular-nums }
.brand i { width:32px; height:32px; flex:none; border-radius:9px; background:#f5f5f5; box-shadow:var(--lift); border:1px solid var(--border-strong); position:relative }
.brand i::before,.brand i::after { content:""; position:absolute; width:10px; height:10px; border:2px solid #383838; border-radius:3px }
.brand i::before { left:6px; top:6px }
.brand i::after { right:5px; bottom:5px; background:var(--gold) }
.library-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px }
.library-actions button:not(.new-note) { background:var(--panel) }
.library-actions button { border:1px solid var(--border-strong); border-radius:7px; padding:7px 2px; font-size:12px; white-space:nowrap }
.library-actions button:not(.new-note):hover { background:var(--accent-soft) }
.new-note { background:var(--gold); color:var(--gold-ink); font-weight:700; text-align:center; border-color:#d7ab4b }
.new-note:hover { background:#ffecab }
.find-note { display:flex; align-items:center; gap:6px; margin:16px 0 10px; padding:0 9px; background:var(--panel); border:1px solid var(--border); border-radius:8px; color:var(--muted) }
.find-note input { width:100%; height:34px; background:transparent; color:var(--ink); border:0; outline:0 }
.find-note input::placeholder { color:var(--muted) }
.find-note:focus-within { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-soft) }
#note-list { overflow:auto; flex:1; padding-top:4px }
.library-row { display:flex; position:relative; min-width:0; border-radius:6px }
.library-row > .nav-note { flex:1; min-width:0; color:var(--ink); font-size:12px }
.library-row.note > .nav-note { gap:5px; padding-inline:5px }
.library-row.note > .nav-note:first-child { margin-inline-start:17px }
.row-menu { padding:0 6px; font-weight:700; border-radius:6px; color:var(--muted); opacity:.68 }
.library-row:hover > .row-menu,.library-row:focus-within > .row-menu,.library-section-header:hover > .row-menu,.library-section-header:focus-within > .row-menu { opacity:1 }
.row-menu:hover { background:var(--accent-raised) }
.library-row.folder > .nav-note { font-size:13px; font-weight:650; color:var(--accent); padding-left:4px }
.library-row.folder:has(> [aria-pressed="true"]) { background:var(--accent-soft) }
.library-row.folder > [aria-pressed="true"] { color:var(--accent) }
.library-folder-toggle { flex:none; display:grid; place-items:center; width:17px; padding:0; color:var(--accent) }
.library-folder-toggle:hover { color:var(--accent) }
.library-section + .library-section { margin-top:11px }
.library-section + .library-outer { border-top:1px solid var(--border); margin-top:12px; padding-top:9px }
.library-top-target { display:block; width:100%; margin:0 0 6px; padding:4px 7px; text-align:left; color:var(--muted); font-size:11px; border-radius:5px }
.library-top-target:hover,.library-top-target[aria-pressed="true"] { color:var(--accent); background:var(--accent-soft) }
.library-section-header { display:flex; align-items:center; min-width:0; gap:4px }
.library-section-header.library-root { font-size:15px; color:#e8c992 }
.library-section-name { flex:1; min-width:0; display:flex; align-items:center; gap:3px }
.library-section-toggle { flex:none; display:grid; place-items:center; min-width:18px; min-height:17px; padding:0 }
.library-section-title:hover,.library-section-toggle:hover,.library-section-title[aria-pressed="true"] { color:#ffe4ac }
.library-section-header .row-menu { line-height:1; padding:2px }
.library-section-title { min-width:0; padding:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; text-align:left; font-weight:680 }
.aligned-library-title { flex:1 }
.library-section-content { padding-inline-start:7px }
.folder .nav-icon { height:11px; width:15px; border:1px solid var(--accent); border-radius:2px; position:relative }
.folder .nav-icon::before { content:""; position:absolute; left:0; top:-4px; border:1px solid var(--accent); border-bottom:0; border-radius:2px 2px 0 0; width:6px; height:3px }
.library-branch { margin-left:11px; border-left:1px solid var(--border); padding-left:5px }
.note-branch { margin-left:7px; padding-left:3px }
.folder-toggle { width:10px; text-align:center; font-size:11px; flex:none }
.nav-icon { flex:none }
.library-row.drop-here,.library-section-header.drop-here,.library-top-target.drop-here { background:var(--accent-soft); outline:1px solid var(--accent) }
.library-root { color:var(--muted); margin:0 0 5px; padding:4px 7px; font-size:11px }
.library-pinned { border-bottom:1px solid var(--border); margin:0 0 9px; padding-bottom:7px }
#library-menu { position:fixed; z-index:15; background:var(--panel); border:1px solid var(--border); border-radius:8px; min-width:142px; box-shadow:0 6px 18px #30223f1c; padding:4px }
#library-menu button { display:block; width:100%; text-align:left; padding:6px 9px; border-radius:5px }
#library-menu button:not(:disabled):hover { background:var(--accent-soft) }
#library-dialog { width:min(430px,92vw); border:1px solid var(--border); border-radius:12px; padding:22px; color:var(--ink); background:var(--panel); box-shadow:var(--floating) }
#library-dialog::backdrop { background:#27203559 }
#library-dialog h2 { font-size:18px; margin:0 0 14px }
#library-dialog label { display:grid; gap:5px }
#library-dialog input,#library-dialog select { width:100%; border:1px solid var(--border-strong); border-radius:6px; padding:8px; background:white }
#library-dialog input.library-name { background:var(--panel) }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:16px }
.dialog-actions button { border:1px solid var(--border); padding:7px 14px; border-radius:7px }
.dialog-actions .confirm { background:var(--gold); color:var(--gold-ink); border-color:#d7ab4b; font-weight:700 }
.dialog-actions .confirm:hover { background:#ffecab }
#library-error { color:var(--danger); margin:8px 0 0 }
.nav-note { display:flex; align-items:center; gap:7px; width:100%; text-align:left; color:var(--ink); padding:8px 9px; border-radius:7px; min-width:0 }
.nav-note span:last-child,.tab-name { overflow:hidden; white-space:nowrap; text-overflow:ellipsis }
.nav-note span:first-child { color:var(--accent) }
.library-row:not(.folder) .nav-icon { color:var(--accent) }
.nav-note:hover { background:var(--accent-soft); color:var(--accent) }
.nav-note[aria-current="page"] { background:var(--panel); color:var(--accent); font-weight:650; box-shadow:inset 3px 0 var(--branch), inset 0 0 0 1px var(--border), var(--lift) }
.library .nav-note[aria-current="page"] { background:var(--accent-raised) }
.library-footer { border-top:1px solid var(--border); margin-top:12px; padding:11px 1px 0; flex:none; color:var(--muted); display:grid; gap:7px; font-size:12px }
.library-footer button { text-align:left; border-radius:6px; padding:6px; font-size:13px }
.library-footer button:hover { background:var(--accent-soft) }
#save-state { padding:3px 6px; word-break:break-word }
#save-state.error { color:var(--danger) }
main { display:flex; flex-direction:column; min-width:0; min-height:0; position:relative }
.tabs { display:flex; gap:3px; align-items:center; min-height:41px; padding:4px 15px 0; background:var(--chrome); border-bottom:1px solid var(--border); overflow:auto }
.tab { display:flex; align-items:center; flex:0 0 auto; min-width:85px; max-width:225px; border-radius:9px 9px 0 0; padding:2px 5px 2px 7px; color:var(--muted) }
.tab.active { background:var(--panel); color:var(--ink); border-top:2px solid var(--branch) }
.tab button { padding:5px 7px; min-width:0 }
.tab .tab-close { flex:none; font-size:15px; padding:2px 5px; border-radius:5px }
.tab-close:hover { background:var(--accent-soft) }
.note-header { display:flex; align-items:center; justify-content:space-between; min-height:68px; padding:13px 22px; gap:14px; background:var(--panel); border-bottom:1px solid var(--border); z-index:2 }
.note-heading { display:flex; align-items:center; gap:8px; min-width:0; flex:1 }
.note-identity { flex:1; min-width:0 }
#note-path { display:flex; flex-wrap:wrap; align-items:center; gap:2px 4px; min-width:0; padding-left:6px; font-size:11px; color:var(--muted) }
.path-component { display:flex; align-items:center; min-width:0; max-width:100%; gap:4px }
.path-component + .path-component::before { content:"›"; flex:none; color:var(--muted) }
.path-component > :is(span,button) { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.path-parent { padding:1px 4px; border-radius:4px; color:var(--accent) }
.path-parent:hover { background:var(--accent-soft) }
.path-current { color:var(--ink); font-weight:650 }
#note-title { border:1px solid transparent; background:none; width:100%; min-width:0; font-size:24px; font-weight:700; border-radius:6px; padding:3px 5px }
#note-title:focus { border-color:var(--accent) }
#parent-note { white-space:nowrap; color:var(--accent); border-radius:7px; padding:6px }
.header-actions { flex:none; display:flex; align-items:center; gap:8px }
.header-actions > button, #mode button, .text-toolbar button { padding:7px 10px; border-radius:8px }
.header-actions > button:hover,#parent-note:hover,.text-toolbar button:hover { background:var(--accent-soft) }
#mode { display:flex; padding:3px; border-radius:9px; background:var(--accent-soft) }
#mode button { line-height:1.2; color:var(--muted) }
#mode button[aria-pressed="true"] { background:var(--panel); color:var(--accent); box-shadow:var(--lift); font-weight:700 }
#popup { position:absolute; right:20px; top:101px; min-width:192px; padding:6px; background:white; border:1px solid var(--border); border-radius:10px; z-index:7; box-shadow:0 10px 28px #30223f24 }
#popup button { display:block; width:100%; text-align:left; border-radius:6px; padding:8px 10px }
#popup button:hover { background:var(--accent-soft) }
#popup .canvas-color { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:5px 10px; border-radius:6px; cursor:pointer }
#popup .canvas-color:hover { background:var(--accent-soft) }
#popup .canvas-pattern { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:5px 10px }
#popup .canvas-pattern select { max-width:110px; color:inherit; background:#fff; border:1px solid var(--border-strong); border-radius:5px; padding:3px }
#popup .canvas-presets { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; padding:2px 5px }
#popup .canvas-presets button { text-align:center; background:var(--chrome) }
#popup .canvas-presets button[aria-pressed="true"] { outline:1px solid var(--accent) }
#popup .canvas-color input { width:42px; height:27px; padding:2px; border:1px solid var(--border-strong); border-radius:5px; background:#fff; cursor:pointer }
#empty-workspace { display:flex; flex:1; flex-direction:column; align-items:center; justify-content:center; gap:12px }
#empty-workspace h2 { margin:0 0 5px; font-size:21px }
#empty-workspace button { padding:7px 16px; border-radius:7px }
#empty-undo { color:var(--muted) }
#empty-undo:hover { background:var(--chrome) }
#panes { display:flex; flex:1; min-height:0; overflow:hidden }
#live-pane { flex:1; min-width:0; display:flex; flex-direction:column; position:relative }
#split-pane { flex:1; min-width:0; background:var(--paper); border-left:2px solid var(--border-strong); display:flex; flex-direction:column; position:relative }
#split-pane > header { padding:9px; display:flex; gap:6px; background:var(--chrome); border-bottom:1px solid var(--border); flex:none }
#split-pane select { min-width:0; flex:1; border:1px solid var(--border-strong); border-radius:6px; padding:5px; background:var(--panel) }
#split-pane button { border-radius:6px; background:var(--accent-soft); white-space:nowrap }
#split-pane button:hover { background:var(--accent-raised) }
#compare-view { flex:1; position:relative; overflow:hidden; touch-action:none }
#compare-world,#compare-wires { position:absolute; inset:0; pointer-events:none; transform-origin:0 0 }
#compare-world .card { pointer-events:none }
#compare-controls { box-shadow:var(--lift); position:absolute; bottom:14px; right:12px; background:var(--panel); border:1px solid var(--border); padding:3px; border-radius:8px }
#text-panel { display:flex; flex-direction:column; flex:1; min-height:0; overflow:hidden; background:var(--note-background,#fff) }
.text-toolbar { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:5px 12px; padding:9px 13px; background:var(--panel); border-bottom:1px solid var(--border) }
#note-edit-tools,.note-view-actions { display:flex; flex-wrap:wrap; gap:3px; align-items:center }
.note-tool-group { display:flex; flex-wrap:wrap; align-items:center; gap:2px; min-width:0 }
.note-tool-group + .note-tool-group { padding-inline-start:5px; border-inline-start:1px solid var(--border) }
#note-edit-tools button,.note-tool-menu summary { padding:5px 7px; min-width:27px; color:var(--accent); font-size:13px; font-weight:620; white-space:nowrap }
.note-tool-menu { position:relative }
.note-tool-menu summary { cursor:pointer; list-style:none; border-radius:7px }
.note-tool-menu summary::-webkit-details-marker { display:none }
.note-tool-menu summary::after { content:"▾"; margin-inline-start:5px; font-size:10px }
.note-tool-menu[open] summary,.note-tool-menu summary:hover { background:var(--accent-soft) }
.note-tool-options,#note-background-picker { position:absolute; top:calc(100% + 5px); z-index:7; padding:6px; border:1px solid var(--border); border-radius:9px; background:var(--panel); box-shadow:var(--floating) }
.note-tool-options { inset-inline-start:0; min-width:130px }
#note-edit-tools .note-tool-options button { display:block; width:100%; text-align:start }
.note-view-actions button { padding:5px 7px; color:var(--muted); font-size:12px }
.note-background-anchor { position:relative }
#note-background-button { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; border:1px solid var(--border); color:var(--ink) }
#note-background-button[aria-expanded="true"] { background:var(--accent-soft) }
.note-color-chip { width:14px; height:14px; border:1px solid var(--border-strong); border-radius:4px }
#note-background-picker { inset-inline-start:0; width:230px; padding:10px; color:var(--ink) }
#note-background-swatches { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:6px }
#note-background-swatches .note-background-swatch { min-width:0; aspect-ratio:1; padding:0; border:1px solid #96889b66; border-radius:6px }
#note-background-swatches .note-background-swatch[aria-pressed="true"] { outline:2px solid var(--accent); outline-offset:1px }
#note-background-custom { margin-top:12px }
#note-background-custom label { display:block; font-size:12px; color:var(--muted) }
#note-background-custom > div { display:flex; gap:6px; margin-top:4px }
#note-background-hex { width:100%; min-width:0; padding:4px 7px; border:1px solid var(--border-strong); border-radius:6px }
#note-background-custom button { flex:none; border:1px solid var(--border) }
#note-background-error { margin:5px 0 0; color:var(--danger); font-size:11px }
#note-view { color:var(--accent); border:1px solid var(--border); border-radius:6px; background:var(--chrome); padding:4px 6px; font-size:12px }
#text-format { display:flex; flex-wrap:wrap; align-items:center; gap:7px 11px; padding:6px 15px; background:var(--chrome); border-bottom:1px solid var(--border) }
#text-format label { display:flex; gap:4px; align-items:center; color:var(--muted) }
#text-format input,#text-format select { border:1px solid var(--border-strong); border-radius:6px; padding:5px; background:white }
#text-format input[type=number] { width:69px }
#text-format input[type=color] { width:37px;height:31px }
.note-document { display:flex; flex:1; min-height:0 }
#note-editor-pages { display:flex; justify-content:center; flex:1; min-width:0 }
.formatted-note { display:block; width:min(100%,890px); height:100%; margin:0; padding:28px clamp(24px,5vw,82px); border:0; background:none; font-size:17px; line-height:1.75; overflow:auto }
#note-rich { outline:0; line-break:strict; caret-color:currentColor }
#note-rich:has(> p:only-child > br:only-child)::before { content:attr(data-placeholder); position:absolute; opacity:.5; pointer-events:none }
#note-rich .note-embed[contenteditable="false"] { cursor:default; user-select:all }
.note-history-preview { max-height:300px; padding:10px 14px; border:1px solid var(--border); border-radius:7px }
.note-switch-results { max-height:235px; overflow:auto; margin-top:8px }
.note-switch-results [aria-current="true"] { background:var(--accent-soft); color:var(--accent) }
.formatted-note { overflow-wrap:anywhere }
.formatted-note :is(h1,h2,h3,h4,h5,h6) { line-height:1.3; margin:1.1em 0 .45em }
.formatted-note > :first-child { margin-top:0 }
.formatted-note p { margin:.55em 0; white-space:pre-wrap }
.formatted-note a { color:#633f93; text-underline-offset:.15em }
.dark-paper .formatted-note a,.formatted-note.dark-paper a { color:#e0bbfb }
.formatted-note a.unresolved { text-decoration-style:dashed }
.formatted-note blockquote { margin:1em 0; border-left:3px solid var(--branch); padding:4px 13px; background:#a95cbb16 }
.formatted-note blockquote[data-callout="tip"] { border-color:#468653; background:#71a48122 }
.formatted-note blockquote[data-callout="warning"] { border-color:#d38a27; background:#eebd5928 }
.formatted-note mark { color:#372d0d; background:#ffeb8b; padding-inline:2px }
.formatted-note pre { padding:12px 14px; background:#8272a11c; overflow:auto; border-radius:8px }
.formatted-note code { font-size:.9em; background:#8272a11c; padding:.12em .25em; border-radius:3px }
.formatted-note pre code { padding:0; background:none }
.formatted-note :is(img,video,audio) { max-width:100% }
.formatted-note :is(img,video) { max-height:360px }
.formatted-note .markdown-table-scroll { overflow:auto; margin:.8em 0 }
.formatted-note table { border-collapse:collapse; width:max-content; min-width:min(340px,100%); font-size:.92em }
.formatted-note :is(th,td) { padding:5px 11px; border:1px solid #8f829f70 }
.formatted-note th { background:#8272a127 }
.formatted-note .note-task { list-style-type:none; margin-inline-start:-1.2em }
.formatted-note .note-task input { accent-color:#8548ac }
.note-embed { display:block; margin:.6em 0; border-inline-start:2px solid #927ba5; padding-inline-start:.7em }
.embedded-note-body { display:block }
#note-details-panel { overflow:auto; width:min(230px,38%); min-width:142px; flex:none; background:var(--panel); border-inline-start:1px solid var(--border); padding:10px; font-size:12px }
.note-detail-tabs { display:flex; flex-wrap:wrap; gap:3px; margin-bottom:8px }
.note-detail-tabs button { padding:5px 7px; border-radius:6px }
.note-detail-tabs button[aria-pressed="true"],.note-detail-row:hover { background:var(--accent-soft); color:var(--accent) }
.note-detail-row { text-align:left; width:100%; padding:6px 8px; border-radius:5px; overflow-wrap:anywhere }
.note-empty { color:var(--muted); padding-inline:7px }
.note-property { display:flex; border-bottom:1px solid var(--border) }
.note-property .note-detail-row { display:grid }
.note-tags { display:flex; gap:4px; flex-wrap:wrap; margin-top:8px }
.note-tags button { padding:2px 6px; border-radius:10px; background:var(--accent-soft); color:var(--accent) }
#compared-text { background:var(--note-background,#fff); width:100%; height:auto; min-height:0; flex:1; padding:20px }
#note-catalog { width:min(780px,88vw); max-height:82vh; border:1px solid var(--border); border-radius:12px; padding:18px; color:var(--ink); background:var(--panel); box-shadow:var(--floating) }
#note-catalog::backdrop { background:#27203559 }
#note-catalog header { display:flex; justify-content:space-between; gap:10px; align-items:center; margin-bottom:9px }
#note-catalog h2 { margin:0; font-size:17px }
#note-catalog input { width:100%; padding:7px; border:1px solid var(--border); border-radius:7px }
#note-catalog-table { overflow:auto; max-height:60vh; margin-top:9px }
#note-catalog-table table { border-collapse:collapse; width:100%; font-size:13px }
#note-catalog-table :is(th,td) { border:1px solid var(--border); padding:5px 9px; text-align:start; overflow-wrap:anywhere }
#note-catalog-table th { position:sticky; top:0; background:var(--chrome) }
#note-catalog-table button { padding:3px; color:var(--accent); text-align:start }
#canvas-panel { position:relative; flex:1; min-height:0; overflow:hidden; background:var(--paper) }
#viewport { position:absolute; inset:0; overflow:hidden; touch-action:none; cursor:default }
:is(#viewport,#compare-view)[data-pattern=dots] { background-image:radial-gradient(circle,var(--canvas-mark) 1px,transparent 1.15px) }
:is(#viewport,#compare-view)[data-pattern=grid] { background-image:linear-gradient(var(--canvas-mark) 1px,transparent 1px),linear-gradient(90deg,var(--canvas-mark) 1px,transparent 1px) }
:is(#viewport,#compare-view)[data-pattern=lined] { background-image:linear-gradient(var(--canvas-mark) 1px,transparent 1px) }
#viewport.moving { cursor:grabbing }
#viewport.connecting { cursor:crosshair }
#wires,#world { position:absolute; left:0; top:0; pointer-events:none }
#world { transform-origin:0 0 }
.wire-handle { position:absolute; z-index:3; width:15px; height:15px; padding:0; border-radius:50%; background:white; border:2px solid var(--accent); box-shadow:0 0 0 2px #fff9; transform:translate(-50%,-50%); cursor:grab; touch-action:none }
.wire-handle.wire-arrow { background:var(--accent); border-color:white }
.wire-handle.wire-middle { width:13px; height:13px; border-radius:3px; transform:translate(-50%,-50%) rotate(45deg) }
.wire-handle:active { cursor:grabbing }
#tools { position:absolute; top:17px; left:50%; transform:translateX(-50%); display:flex; align-items:center; flex-wrap:wrap; justify-content:center; max-width:calc(100% - 26px); width:max-content; gap:3px; padding:6px; background:var(--panel); border:1px solid var(--border); border-radius:12px; box-shadow:var(--lift); z-index:3 }
#tools button { position:relative; padding:7px 6px; line-height:1.2; border-radius:8px; white-space:nowrap }
#tools :is(.tool-drop-before,.tool-drop-after)::after { content:""; position:absolute; inset-block:3px; width:2px; border-radius:1px; background:var(--accent); pointer-events:none }
#tools .tool-drop-before::after { left:-2px }
#tools .tool-drop-after::after { right:-2px }
#tools button:hover:not(:disabled,[aria-disabled="true"]) { background:var(--accent-soft); color:var(--accent) }
#tools button[aria-disabled="true"] { opacity:.4 }
#tools button[aria-pressed="true"] { background:var(--accent-raised); color:var(--accent); box-shadow:inset 0 -2px var(--branch) }
#tools #new-core { background:var(--gold-soft); color:var(--gold-ink) }
#tools #new-core:hover { background:var(--gold); color:var(--gold-ink) }
#tools b { color:var(--accent); font-size:16px; margin-right:2px }
#tools #new-core b { color:var(--gold-ink) }
#tools :is([data-card="image"],[data-card="video"],[data-card="audio"]) b { color:var(--danger) }
.tool-divider { display:block; border-left:1px solid var(--border); height:23px; margin:0 2px }
.card-shell { pointer-events:none; position:absolute }
.card-badges { position:absolute; bottom:calc(100% - 1px); inset-inline:10px; display:flex; align-items:flex-end; gap:6px; pointer-events:none }
.card-badges span { padding:4px 8px; min-height:23px; line-height:1.16; font-size:13px; font-weight:700; border-radius:6px 6px 0 0; white-space:nowrap }
.card-top-title { overflow:hidden; text-overflow:ellipsis; color:#514037; background:#efe7dc; border:1px solid #c9b6a6 }
.card-top-title.core-title { color:#3c2a0e; background:var(--core-badge); border-color:#aa7a18 }
.blocked-title { margin-inline-start:auto; flex:none; color:#fff; background:#a62f39; border:1px solid #a62f39 }
.card-top-title[data-align=center] { margin-inline:auto }
.card-top-title[data-align=right] { margin-inline-start:auto }
.card { pointer-events:auto; position:absolute; inset:0; display:flex; flex-direction:column; border:1px solid #cbd2c9; border-radius:12px; background:var(--card); color:var(--ink); overflow:hidden; box-shadow:0 2px 6px #5f463018,inset 0 0 0 1px #fffc; user-select:none; cursor:grab }
.card:hover { border-color:#a78970 }
.card.is-core { box-shadow:0 4px 8px #58341230 }
.card.is-core::after { content:""; position:absolute; inset:var(--core-gap); border:var(--core-inner-width) solid var(--core-inner); border-radius:calc(12px - var(--core-gap)); pointer-events:none }
.card.is-core:is(.shape-pill,.shape-database)::after { border-radius:inherit }
.card.is-core .card-kind { color:inherit }
.card.selected { outline:1px dashed #956d55; outline-offset:4px }
.card.connect-from { outline:2px dashed #946f55; outline-offset:5px }
.card.column { border-style:dashed }
.card.column.drop-target { border:2px solid #548a75 }
.card-header { display:flex; align-items:center; padding:13px 14px 9px; gap:7px; flex:none; min-width:0 }
.card-kind { font-size:13px; font-weight:650; color:#53766a; flex:none }
.card-title { font-size:inherit; color:inherit; font-weight:700; overflow-wrap:anywhere; min-width:0; line-height:1.25; white-space:pre-wrap }
.card .card-title { flex:1; width:100% }
.card.heading .card-header { height:100%; padding:0 14px }
.card.heading .card-title { white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.card.heading .card-kind { display:none }
.card.note:has(.open-subboard) .card-header { padding-right:41px }
.open-subboard { position:absolute; z-index:2; top:8px; right:8px; width:25px; height:25px; padding:0; border-radius:6px; color:var(--ink); background:#ffffff9e }
.open-subboard:hover { background:#ffffff }
.card.column .card-kind { display:none }
.group-color-bar { position:absolute; top:0; left:0; right:0; height:5px; pointer-events:none }
.card-body { padding:0 14px 12px; white-space:pre-wrap; overflow:hidden; overflow-wrap:anywhere; line-height:1.42; flex:1; min-height:0 }
.card.shape-pill { border-radius:999px }
.card.shape-decision { clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%); text-align:center; justify-content:center; padding:21px 18%; border:none; box-shadow:none }
.card.shape-decision.selected { background:#e0cdb4 }
.card.shape-decision:is(.is-core,.is-blocked) { background:var(--core-border) }
.card.shape-decision:is(.is-core,.is-blocked)::before { content:""; position:absolute; inset:var(--core-width); clip-path:inherit; background:var(--card); pointer-events:none }
.card.shape-decision.is-core::after { inset:calc(var(--core-width) + var(--core-gap)); clip-path:inherit; border:0; background:var(--core-inner) }
.card.shape-decision.is-core .core-diamond-fill { position:absolute; inset:calc(var(--core-width) + var(--core-gap) + var(--core-inner-width)); clip-path:inherit; background:var(--card); pointer-events:none; z-index:1 }
.card.shape-decision:is(.is-core,.is-blocked) > :is(.card-header,.card-body) { position:relative; z-index:2 }
.card.shape-decision .card-header { justify-content:center; padding:0 }
.card.shape-decision .card-body { padding:0 }
.card.shape-database { border-radius:50% / 25%; border-bottom:4px double #819daa }
.symbol-mark { flex:none; width:30px; height:30px; display:grid; place-items:center; border-radius:8px; background:#ebe2d8 }
.symbol-mark img { display:block; width:22px; height:22px; object-fit:contain; pointer-events:none }
.symbol-mark.brand-symbol { background:transparent }
.symbol-mark.brand-symbol img { width:27px; height:27px }
.symbol-picker { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:3px; width:min(480px,calc(100vw - 56px)) }
#popup .symbol-picker button { display:flex; align-items:center; gap:8px; min-width:0 }
.card-body:empty { display:none }
.card-body.image { padding:0; display:flex; flex-direction:column }
.card-body img { width:100%; min-height:0; flex:1; object-fit:contain; display:block; pointer-events:none }
.card-body.image > img { flex:none }
.media-caption { padding:4px 0; flex:none }
.card-body:is(.image,.video) .media-caption { padding-inline:14px }
.card-body.link { display:flex; flex-direction:column; padding:0 }
.card-body .link-preview-image { flex:none; border:1px solid var(--border); border-radius:6px; background:#ffffff }
.card-body .link-preview-status { font-size:12px; color:var(--muted) }
.card-body.link > .link-preview-image { border:0; border-bottom:1px solid #eee8ed; border-radius:0; object-fit:cover }
.link-preview-copy { padding:13px 16px 15px }
.link-preview-address { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-bottom:5px; color:#706879; font:11px/16px -apple-system,sans-serif }
.link-preview-title { display:block; overflow-wrap:anywhere; font-weight:650; line-height:1.42 }
a.link-preview-title { color:#bf4215; text-decoration-line:underline; text-decoration-thickness:1px; text-underline-offset:2px; cursor:pointer }
a.link-preview-title:hover { filter:brightness(.8) }
a.link-preview-title:focus-visible { border-radius:3px; outline:2px solid var(--accent); outline-offset:2px }
.link-preview-description { margin-top:10px; line-height:1.56 }
.link-preview-copy > .link-preview-status { display:block; margin-top:5px }
.embedded-link-preview { display:grid; gap:5px; margin:7px 0 4px; padding:8px; border:1px solid var(--border); border-radius:7px; text-align:left }
.embedded-link-preview:empty { display:none }
.card-body button.go { color:inherit; text-align:left; min-width:0; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding:0; cursor:pointer }
.card-body audio { width:100%; height:35px }
.card-body.video { padding:0 9px 8px; display:flex; flex-direction:column; min-height:0 }
.card-body video { display:block; width:100%; min-height:0; flex:1; object-fit:contain; background:#101820; border-radius:7px; cursor:default }
.card-body.video .video-download { font-size:11px; padding:3px; align-self:flex-end; color:var(--accent) }
.media-error { font-size:12px; color:#92372d }
.task-row { display:flex; gap:7px; align-items:flex-start; padding:3px 0; cursor:pointer }
.task-row input { accent-color:#537d73; margin-top:4px }
.task-row input:checked + span { text-decoration:line-through }
.task-row span { flex:1; min-width:0 }
.resize-card { width:19px; height:19px; position:absolute; bottom:0; right:0; pointer-events:none; opacity:0; cursor:nwse-resize; background:linear-gradient(135deg,transparent 52%,#829790 54%,#829790 59%,transparent 61%,transparent 67%,#829790 69%,#829790 75%,transparent 77%) }
.card.selected ~ .resize-card { pointer-events:auto; opacity:1 }
.card.inline-editing ~ .resize-card { pointer-events:none; opacity:0 }
.inline-card-edit { position:absolute; z-index:4; left:8px; right:8px; width:calc(100% - 16px); min-width:0; padding:6px 8px; border:1px solid var(--accent); border-radius:6px; background:var(--panel); cursor:text; user-select:text }
.inline-card-edit.inline-title { top:8px; font-weight:700 }
.card.column .inline-title { top:9px; right:38px; width:calc(100% - 46px); text-align:center }
.inline-card-edit.inline-body { top:39px; bottom:8px; resize:none; line-height:1.42 }
.inline-card-edit.inline-image-caption { position:static; flex:none; margin:4px 8px }
.collapse { position:absolute; top:8px; right:8px; border-radius:5px; background:#f4f4ec; font-size:16px }
#inspector { position:absolute; right:15px; top:var(--toolbar-bottom,81px); bottom:68px; width:min(296px,46%); padding:14px; overflow:auto; background:var(--panel); border:1px solid var(--border); box-shadow:var(--floating); z-index:4; border-radius:11px }
#inspector h2 { font-size:16px; margin:0 }
.core-toggle { margin-top:10px; padding:7px 10px; border:1px solid #d7ab4b; border-radius:7px; color:var(--gold-ink) }
.core-toggle:hover,.core-toggle[aria-pressed="true"] { background:var(--gold-soft) }
#inspector .blocked-field { display:flex; align-items:center; justify-content:space-between; color:var(--danger) }
#inspector .blocked-field input { accent-color:#a62f39 }
#inspector .ungroup { display:block; margin-top:9px; padding:7px 10px; border:1px solid var(--border-strong); border-radius:7px; color:var(--accent) }
#inspector .ungroup:hover { background:var(--accent-soft) }
.inspect-header,.inspect-actions { display:flex; align-items:center; justify-content:space-between; gap:6px }
.inspect-header button:hover { background:var(--accent-soft) }
.inspect-header button { border-radius:6px; padding:0 6px; font-size:18px }
.group-color-settings { margin-top:9px; padding:9px; border:1px solid var(--border); border-radius:8px }
.group-color-picker { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:4px 8px }
#inspector .group-color-picker label { display:flex; align-items:center; margin:0; color:var(--ink) }
#inspector .group-color-picker input[type=color] { width:36px; height:28px; padding:3px; cursor:pointer }
.remove-group-color { padding:4px; border-radius:5px; color:var(--muted); font-size:11px }
.remove-group-color:hover { background:var(--accent-soft) }
.group-color-settings .palette { margin-top:7px }
.selected-text-format { display:grid; grid-template-columns:minmax(0,1fr) 50px 36px auto; align-items:end; gap:6px; margin-top:9px; padding:8px; border:1px solid var(--border); border-radius:8px; background:var(--accent-soft) }
#inspector .selected-text-format label { margin:0 }
#inspector .selected-text-format input { height:28px; padding:3px }
.selected-text-format strong { align-self:center; font-size:12px }
.selected-text-format button { padding:5px 8px; border-radius:6px; background:var(--panel); font-size:12px }
.text-marker-controls { grid-column:1/-1; display:flex; align-items:flex-end; gap:7px }
#inspector .text-marker-controls label { width:44px }
.text-marker-controls button { min-height:28px }
.text-marker-controls button:first-of-type { background:#fff08a; color:#493c16 }
.selected-text-excerpt { grid-column:1/-1; width:fit-content; max-width:100%; padding:1px 4px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; border-radius:3px; color:var(--ink); background:#e0d1f2; font-size:12px }
#inspector label { display:grid; gap:5px; margin-top:11px; font-size:12px; color:var(--muted) }
#inspector input:not([type=checkbox]),#inspector textarea,#inspector select { width:100%; border:1px solid var(--border-strong); border-radius:6px; padding:7px 8px; background:#fff }
#inspector :is(.edge-appearance,.core-outline-options) { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px }
#inspector :is(.edge-appearance,.core-outline-options,.core-fill-option) input { height:34px }
#inspector :is(.edge-appearance,.core-outline-options,.core-fill-option) input[type=color] { padding:4px; cursor:pointer }
.edge-color-hint { margin:6px 0 0; color:var(--muted); font-size:11px }
#inspector textarea { resize:vertical; min-height:85px }
.inspect-actions { margin-top:13px; flex-wrap:wrap; justify-content:flex-start }
.inspect-actions button { padding:6px 8px; border-radius:6px; background:var(--accent-soft) }
.inspect-actions .danger { color:var(--danger); background:var(--danger-soft) }
.palette { display:flex; flex-wrap:wrap; margin-top:12px; gap:7px }
.swatch { width:24px; height:24px; border:1px solid var(--border-strong); border-radius:6px }
.swatch[aria-pressed=true] { outline:2px solid var(--accent); outline-offset:2px }
#canvas-footer { display:flex; justify-content:space-between; gap:8px; position:absolute; bottom:15px; left:15px; right:15px; align-items:center; z-index:3; pointer-events:none }
#canvas-footer > * { box-shadow:var(--lift); border:1px solid var(--border); background:var(--panel); border-radius:8px; pointer-events:auto }
#canvas-footer > div { display:flex; padding:3px }
#canvas-footer button { min-width:28px; border-radius:5px; padding:4px 7px }
#canvas-footer button:hover:not(:disabled) { background:var(--accent-soft) }
#board-count { padding:6px 9px; color:var(--muted); white-space:nowrap }
#board-hint { position:absolute; left:50%; top:var(--toolbar-bottom,72px); transform:translateX(-50%); box-shadow:0 2px 12px #30223f22; padding:7px 12px; z-index:3; background:var(--accent-soft); color:var(--accent); border-radius:8px; max-width:calc(100% - 26px); width:max-content; text-align:center; pointer-events:none }
#empty-board { position:absolute; top:49%; left:50%; transform:translate(-50%,-50%); display:grid; text-align:center; gap:11px; pointer-events:none; width:max-content; max-width:90%; color:var(--muted) }
#empty-board strong { font-size:28px; color:var(--ink) }
#marquee { position:absolute; border:1px solid var(--accent); background:#af50c828; pointer-events:none }
#toast { position:fixed; z-index:10; bottom:69px; left:50%; transform:translateX(-50%); background:#3d294e; color:white; padding:10px 15px; max-width:80%; border-radius:9px; box-shadow:0 4px 17px #213f3730 }
@media (max-width:1020px) {
  .app { grid-template-columns:172px minmax(0,1fr) }
  .note-header { padding:11px; gap:6px }
  .header-actions { gap:3px }
  .header-actions > button { padding-inline:6px }
  #tools button { padding:7px 5px }
}

.formatted-field { margin:0 0 14px }
.text-style { margin-top:5px; padding:6px 7px; border:1px solid var(--border); border-radius:6px; background:var(--chrome) }
.format-title { font-weight:650; margin-bottom:4px }
.format-tools { display:grid; grid-template-columns:minmax(61px,1fr) 44px 34px 60px; gap:5px; align-items:end }
#inspector .format-tools label,#library-dialog .format-tools label,#popup .format-tools label {
  display:grid; gap:2px; margin:0; min-width:0; font-size:11px;
}
:is(#inspector,#library-dialog,#popup) .format-tools :is(select,input:not([type=checkbox])) {
  width:100%; min-width:0; height:30px; padding:3px; font-size:12px; border:1px solid var(--border-strong); border-radius:5px; background:white;
}
:is(#inspector,#library-dialog,#popup) .format-tools input[type=color] { padding:3px; cursor:pointer }
#popup .text-style { margin:5px }
#popup .format-tools { min-width:218px }
#inspector .formatted-field :is(textarea,input):not([type=number],[type=color]) { line-height:1.35 }

/* White paper cards and the gold center used on the light canvas. */
.card.paper-card:not(.shape-decision,.shape-pill,.shape-database) { border-radius:11px; box-shadow:0 2px 0 #dfdfe9 }
.paper-card:not(.shape-decision) .card-header { padding:12px 14px 4px }
.card.column .card-header { justify-content:center; min-height:46px; padding:11px 40px; text-align:center }
.card.column:has(.group-color-bar) .card-header { padding-top:17px }
.paper-card .card-kind { display:none }
.paper-card .symbol-mark { width:22px; height:22px; background:transparent }
.paper-card .symbol-mark img { width:20px; height:20px }
.card.has-paper-rail .card-body { padding-bottom:19px }
.paper-rail { position:absolute; left:11px; right:11px; bottom:7px; height:6px; border-radius:999px; pointer-events:none }
.card.paper-core:not(.shape-pill,.shape-database) { border-radius:15px; box-shadow:none }
.card.paper-core:not(.shape-pill,.shape-database)::after { border-radius:10px }
.paper-card.paper-core .card-header { flex-direction:column; text-align:center; gap:11px; padding:15px 14px 4px }
.paper-card.paper-core-text .card-header { padding-top:40px }
.paper-core .symbol-mark,.paper-core .symbol-mark img { width:32px; height:32px }
.paper-core .card-body { text-align:center }
.paper-core-badge { position:absolute; top:11px; left:11px; max-width:calc(100% - 24px); padding:3px 8px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; line-height:1.2; font-weight:700; border-radius:8px; background:#fff0b2; pointer-events:none }
.paper-core-badge[data-align=center] { left:50%; transform:translateX(-50%) }
.paper-core-badge[data-align=right] { left:auto; right:11px }
