/* =====================================================
   Deez Notes v3 — full-screen canvas, text boxes,
   focus mode, party, select. Loaded after lagoon.css.
   ===================================================== */

/* ---------- full-width page ---------- */
#scroller { padding: 18px 16px 150px; }
#page { width: auto; margin: 0; min-width: 0; isolation: isolate; }
#editor { width: 900px; min-height: 0; padding-bottom: 40px; position: relative; z-index: 1; }
#editor:empty::before { white-space: nowrap; }
#page.has-stuff #editor:empty::before { content: none; }   /* the note isn't blank: your writing is in boxes, pictures or drawings */
#pageEnd { padding-top: 16px; }
.page-head { right: 28px; }

/* drag handle on the text column edge */
#colHandle {
  position: absolute; top: 60px; width: 24px; margin-left: -12px; bottom: 0; z-index: 1; /* wide grab area; above the text (it comes after it), still under pictures and boxes */
  cursor: ew-resize; opacity: 0; transition: opacity .15s;
}
#colHandle::after { content: ''; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--glow); }
#page:hover #colHandle { opacity: .18; }
#colHandle:hover, #colHandle.drag { opacity: 1 !important; }
#app.drawing #colHandle { display: none; }
/* handle for dragging a table out of the text */
#tblGrip { position: fixed; z-index: 15; width: 24px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: var(--panel-2); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line-2)); color: var(--text); cursor: grab; box-shadow: var(--shadow); }
#tblGrip:hover { color: var(--accent); border-color: var(--accent); }
#tblGrip.hidden { display: none; }
body.tbl-dragging, body.tbl-dragging * { cursor: grabbing !important; user-select: none; }
#app.readonly ~ #tblGrip { display: none; }

/* ---------- free text boxes ---------- */
#boxes { position: absolute; inset: 0; pointer-events: none; } /* no z-index: boxes and pictures share one stack */
.tbox {
  position: absolute; min-width: 40px; max-width: 760px; width: max-content; pointer-events: auto;
  border-radius: 8px;
  outline: 1px solid transparent; outline-offset: 4px;
  transition: outline-color .15s, box-shadow .15s;
}
.tbox:hover { outline-color: var(--line-2); }
.tbox:focus-within { outline-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.tbox.sel { outline: 1.5px dashed var(--accent); }
.tb-body.dn-editor {
  padding: 2px 4px; min-height: 32px; min-width: 40px; width: auto;
  white-space: pre-wrap;
}
.tbox[style*="width"] .tb-body { white-space: normal; }
.tb-body.dn-editor:empty::before { content: 'Type…'; color: var(--faint); }
.tb-grip {
  position: absolute; left: -26px; top: 4px; width: 20px; height: 24px; border-radius: 6px;
  cursor: grab; opacity: 0; transition: opacity .12s, background .12s;
  background: radial-gradient(circle, var(--muted) 1.4px, transparent 1.8px) 0 0 / 7px 7px;
  background-position: 3px 2px;
}
.tbox:hover .tb-grip, .tbox:focus-within .tb-grip { opacity: .8; }
.tb-grip:hover { background-color: var(--hover); opacity: 1; }
.tb-grip:active { cursor: grabbing; }
.tb-resize { position: absolute; right: -8px; top: 0; bottom: 0; width: 10px; cursor: ew-resize; opacity: 0; }
.tb-resize::after { content: ''; position: absolute; right: 3px; top: 50%; height: 22px; margin-top: -11px; width: 3px; border-radius: 3px; background: var(--accent); }
.tbox:hover .tb-resize, .tbox:focus-within .tb-resize { opacity: .7; }
#app.drawing .tbox { pointer-events: none !important; }
#app.drawing .tb-grip, #app.drawing .tb-resize { display: none; }

/* sticky notes */
.tbox.sticky { border-radius: 10px; outline-offset: 2px; box-shadow: 0 14px 30px rgba(0,0,0,.28); }
.tbox.sticky .tb-body { padding: 14px 16px; min-width: 180px; min-height: 120px; color: #0b0c0e; caret-color: #0b0c0e; border-radius: 10px; }
.tbox.sticky .tb-body h3 { color: #0b0c0e; opacity: .7; }
.tbox.sticky-mint .tb-body { background: #8ff0c6; }
/* old gold stickies now show as paper */
.tbox.sticky-gold .tb-body, .tbox.sticky-paper .tb-body { background: #eceff2; }
.tbox.sticky-ice .tb-body { background: #a8ecfb; }
.tbox.sticky-rose .tb-body { background: #ffb4d0; }
.tbox.sticky-glass .tb-body { background: color-mix(in srgb, var(--panel-2) 85%, transparent); color: var(--ink); caret-color: var(--ink); border: 1px solid var(--line-2); backdrop-filter: blur(8px); }
.tbox.sticky-glass .tb-body h3 { color: var(--gold); opacity: 1; }
.tbox.sticky-glass { border-left: 2px solid var(--accent); }

/* ---------- party button ---------- */
.btn.party { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.btn.party.on { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent-text); border-color: var(--accent); box-shadow: 0 0 18px var(--glow); }
.party-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 4px; }
.party-choice button {
  text-align: left; padding: 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2);
  display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, box-shadow .15s, transform .1s;
}
.party-choice button:hover { border-color: var(--accent); box-shadow: 0 0 20px var(--glow); }
.party-choice button:active { transform: scale(.98); }
.party-choice b { font-family: var(--display); font-size: 16px; }
.party-choice small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.party-choice .ic { color: var(--accent); }
@media (max-width: 520px) { .party-choice { grid-template-columns: 1fr; } }

/* ---------- stats ---------- */
#stats {
  position: absolute; left: 14px; bottom: 16px; z-index: 5;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); pointer-events: none; white-space: nowrap;
}
@media (max-width: 1250px) { #stats { display: none; } }

/* ---------- focus mode ---------- */
#chrome { position: relative; z-index: 20; flex: none; }
#revealZone { display: none; }
#app.focus { grid-template-columns: 0 1fr; }
#app.focus #sidebar { opacity: 0; pointer-events: none; }
#app.focus #chrome {
  position: absolute; left: 0; right: 0; top: 0;
  transform: translateY(-100%); transition: transform .22s var(--ease);
  box-shadow: var(--shadow);
}
#app.focus.reveal #chrome { transform: none; }
#app.focus #revealZone { display: block; position: absolute; left: 0; right: 0; top: 0; height: 14px; z-index: 19; }
#app.focus #stats { display: none; }
#focusPill {
  position: absolute; right: 16px; top: 14px; z-index: 7;
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px;
  background: var(--glass); border: 1px solid var(--line-2); color: var(--muted);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  backdrop-filter: blur(12px); opacity: .5; transition: opacity .15s, color .15s, border-color .15s;
}
#focusPill:hover { opacity: 1; color: var(--text); border-color: var(--accent); }
#app.focus #scroller { padding-top: 26px; }

/* ---------- font picker preview ---------- */
.font-pop { width: 320px; }
.fp-list { max-height: 380px; }
.fp-item { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.fp-item .fp-tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; color: var(--faint); text-transform: uppercase; flex: none; }

/* ---------- settings font rows ---------- */
.font-row { display: flex; align-items: center; gap: 10px; }
.font-row select { flex: 1; }
.font-sample { margin-top: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.font-sample .fs-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.font-sample .fs-title { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: -.03em; margin: 4px 0 2px; }
.font-sample .fs-body { font-family: var(--ui); color: var(--muted); font-size: 14px; }

/* ---------- templates menu ---------- */
.tpl-pop { width: 280px; }
.tpl-pop .mi { align-items: flex-start; white-space: normal; }
.tpl-pop .mi small { display: block; color: var(--faint); font-size: 11.5px; margin-top: 2px; }

@media (max-width: 860px) {
  #editor { width: min(900px, calc(100vw - 32px)); }
}

/* ---------- image cards & PDF pages ---------- */
#images { position: absolute; inset: 0; pointer-events: none; }
.icard { position: absolute; pointer-events: auto; border-radius: 6px; user-select: none; }
.icard img { display: block; width: 100%; height: 100%; border-radius: inherit; pointer-events: none; }
.icard:not(.locked) { cursor: move; }
.icard:not(.locked):hover { outline: 1px solid var(--line-2); outline-offset: 3px; }
.icard.pdf { border-radius: 2px; box-shadow: 0 0 0 1px var(--line), 0 10px 30px rgba(0,0,0,.25); background: #fff; }
.icard.sel { outline: 1.5px dashed var(--accent); outline-offset: 4px; }
.icard .ic-resize { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; border-radius: 4px; background: var(--accent); cursor: nwse-resize; opacity: 0; box-shadow: 0 0 10px var(--glow); }
.icard:not(.locked):hover .ic-resize { opacity: 1; }
.icard .ic-tag { position: absolute; left: 0; top: -22px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); pointer-events: none; }
#app.drawing .icard, #app.readonly .icard { pointer-events: none; }

/* ---------- presenting ---------- */
#presentBar {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 8;
  display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--line-2); backdrop-filter: blur(16px); box-shadow: var(--shadow);
}
#presCount { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; min-width: 64px; text-align: center; color: var(--text); }
#app.presenting #focusPill, #app.presenting #stats { display: none; }
#app.presenting #presentBar { bottom: auto; top: 14px; }
#followBar {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 8;
  display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; border-radius: 10px;
  background: var(--glass); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); backdrop-filter: blur(14px);
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; box-shadow: 0 0 24px var(--glow);
}
#followBar button { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; padding: 5px 9px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); }
#followBar button:hover { color: var(--text); border-color: var(--accent); }
.stop-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; max-height: 320px; overflow: auto; }
.stop-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.stop-row .num { font-family: var(--mono); font-size: 11px; color: var(--accent-text); width: 22px; }
.stop-row input { flex: 1; background: none; border: 0; outline: 0; font-weight: 600; }
.stop-row button { color: var(--muted); }
.stop-row button:hover { color: var(--text); }

/* ---------- busy overlay ---------- */
#busy { position: absolute; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; gap: 12px; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(3px); font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
#busy.hidden { display: none; }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; box-shadow: 0 0 20px var(--glow); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- view-only (party viewers) ---------- */
#app.readonly #formatbar { opacity: .35; pointer-events: none; }
#app.readonly .tool[data-tool]:not([data-tool="type"]):not([data-tool="laser"]), #app.readonly #swatches, #app.readonly .width, #app.readonly #undoBtn, #app.readonly #redoBtn { opacity: .25; pointer-events: none; }
#app.readonly .tb-grip, #app.readonly .tb-resize, #app.readonly #colHandle { display: none; }
.ro-badge { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; padding: 2px 6px; border-radius: 4px; background: var(--gold); color: #1a1203; margin-left: 4px; }

/* ---------- version history ---------- */
.ver-list { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow: auto; margin: 10px 0; }
.ver-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.ver-row .vt { font-weight: 600; }
.ver-row .vm { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }
.ver-row .grow { flex: 1; }

/* =====================================================
   v4 — size preview, tidy tools, image editor, layers,
   tabs, keyboard shortcuts
   ===================================================== */
/* text size picker */
.size-btn { min-width: 62px; justify-content: space-between; gap: 4px; border: 1px solid var(--line); color: var(--text); padding: 0 6px 0 9px; margin-left: 4px; font-family: var(--mono); font-size: 12px; border-radius: 6px; }
/* a short grid of numbers, so the text you're previewing stays visible under it */
.size-pop { width: 344px; padding: 8px; }
.size-pop .fp-mode { padding: 2px 4px 8px; }
.sz-custom { display: flex; align-items: center; gap: 6px; padding: 0 2px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sz-custom .input { width: 64px; height: 30px; padding: 0 8px; font-family: var(--mono); }
.sz-custom span { color: var(--faint); font-family: var(--mono); font-size: 11px; margin-right: auto; }
.sz-list { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.sz-item { display: grid; place-items: center; height: 32px; border-radius: 6px; }
.sz-item:hover, .sz-item.on { background: var(--hover); }
.sz-item.on .sz-n { color: var(--accent-text); }
.sz-a { display: none; }
.sz-n { font-family: var(--mono); font-size: 12px; color: var(--text); }

/* hidden things (layers) */
.tbox.hid, .icard.hid { display: none !important; }

/* image cards: crop + adjustments */
.icard .ic-clip { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; }
.icard .ic-clip img { position: absolute; max-width: none; width: 100%; height: 100%; border-radius: 0; }
.icard.cropping { outline: 1.5px solid var(--accent) !important; outline-offset: 0 !important; z-index: 999999 !important; }
.icard .ic-ghost { position: absolute; max-width: none; opacity: .22; pointer-events: none; filter: grayscale(.4); }
.icard.cropping .ic-resize { display: none; }
.ic-crop { position: absolute; background: var(--accent); box-shadow: 0 0 8px var(--glow); z-index: 2; border-radius: 2px; }
.ic-crop.c-n, .ic-crop.c-s { left: 50%; width: 34px; height: 6px; margin-left: -17px; cursor: ns-resize; }
.ic-crop.c-n { top: -3px; } .ic-crop.c-s { bottom: -3px; }
.ic-crop.c-e, .ic-crop.c-w { top: 50%; width: 6px; height: 34px; margin-top: -17px; cursor: ew-resize; }
.ic-crop.c-e { right: -3px; } .ic-crop.c-w { left: -3px; }
.ic-crop.c-ne, .ic-crop.c-nw, .ic-crop.c-se, .ic-crop.c-sw { width: 14px; height: 14px; background: transparent; box-shadow: none; border: 0 solid var(--accent); }
.ic-crop.c-nw { left: -3px; top: -3px; border-width: 4px 0 0 4px; cursor: nwse-resize; }
.ic-crop.c-ne { right: -3px; top: -3px; border-width: 4px 4px 0 0; cursor: nesw-resize; }
.ic-crop.c-sw { left: -3px; bottom: -3px; border-width: 0 0 4px 4px; cursor: nesw-resize; }
.ic-crop.c-se { right: -3px; bottom: -3px; border-width: 0 4px 4px 0; cursor: nwse-resize; }

/* floating bar over a selection */
#selBar {
  position: absolute; left: 0; top: 0; z-index: 9; display: flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: 12px; background: var(--glass); border: 1px solid var(--line-2); backdrop-filter: blur(16px);
  box-shadow: var(--shadow); white-space: nowrap; will-change: transform;
}
#selBar.hidden { display: none; }
#selBar .dsep { height: 18px; margin: 0 3px; }
#selBar .sb-count { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 0 6px 0 8px; }

/* side panels (image editor, layers) */
#imgPanel, #layersPanel {
  position: absolute; right: 14px; top: 14px; z-index: 10; width: 282px; max-height: calc(100% - 110px); overflow: auto;
  padding: 10px 12px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line-2);
  backdrop-filter: blur(18px); box-shadow: var(--shadow);
}
#imgPanel.hidden, #layersPanel.hidden { display: none; }
/* Layers: solid background so names are readable over pictures; drag the title to move, the corner to resize */
#layersPanel { width: 300px; min-width: 240px; min-height: 140px; max-width: calc(100% - 20px); resize: both; background: var(--panel); }
#layersPanel .ip-head { cursor: grab; padding: 2px 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
#layersPanel.moving, #layersPanel.moving .ip-head { cursor: grabbing; user-select: none; }
#layersPanel .ip-title { font-size: 15px; }
#layersPanel .ly-row { padding: 7px 8px; }
#layersPanel .ly-name { font-size: 13.5px; color: var(--text); font-weight: 500; gap: 2px; }
#layersPanel .ly-name small { font-family: var(--sans, inherit); font-size: 11.5px; letter-spacing: 0; color: var(--muted); font-weight: 400; }
#layersPanel .ip-sec small { color: var(--muted); }
#layersPanel .ly-thumb { width: 38px; height: 30px; }
#app.layers-open #imgPanel { right: 308px; }
.ip-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.ip-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-family: var(--display); font-weight: 600; font-size: 14px; }
.ip-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ip-title .ic { color: var(--accent); flex: none; }
.ip-sec { display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); margin: 12px 0 7px; font-weight: 600; }
.ip-sec small { letter-spacing: .06em; text-transform: none; color: var(--faint); font-weight: 400; }
.ip-link { margin-left: auto; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 2px 6px; border-radius: 5px; }
.ip-link:hover { color: var(--text); background: var(--hover); }
.ip-looks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ip-look { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; border-radius: 8px; }
.ip-look img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); transition: border-color .12s, box-shadow .12s; }
.ip-look:hover img { border-color: var(--accent); box-shadow: 0 0 12px var(--glow); }
.ip-look span { font-size: 9.5px; color: var(--muted); font-family: var(--mono); letter-spacing: .04em; }
.ip-sliders { display: flex; flex-direction: column; gap: 5px; }
.ip-row { display: grid; grid-template-columns: 84px 1fr 44px; align-items: center; gap: 8px; }
.ip-l { font-size: 12px; color: var(--muted); cursor: default; user-select: none; }
.ip-l:hover { color: var(--text); }
.ip-v { font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-align: right; }
.ip-row input[type=range] { width: 100%; accent-color: var(--accent); height: 16px; }
.ip-tools { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.ip-tools .tool.on { color: var(--accent-ink); background: var(--accent); }
.ip-foot { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.ip-foot .mini-btn { font-size: 11.5px; padding: 5px 9px; }
.ip-foot .mini-btn:disabled { opacity: .4; pointer-events: none; }

/* layers list */
.ly-list { display: flex; flex-direction: column; gap: 3px; }
.ly-row { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.ly-row:hover { background: var(--hover); }
.ly-row.sel { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.ly-row.off .ly-name, .ly-row.off .ly-thumb { opacity: .38; }
.ly-row.dragging { opacity: .35; }
.ly-row.over-top { box-shadow: inset 0 2px 0 var(--accent); }
.ly-row.over-bot { box-shadow: inset 0 -2px 0 var(--accent); }
.ly-row.ly-ink { cursor: default; }
.ly-thumb { width: 34px; height: 26px; flex: none; border-radius: 5px; object-fit: cover; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.ly-thumb.ink { color: var(--accent); }
.ly-name { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; }
.ly-name small { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; color: var(--faint); }
.ly-btn { width: 26px; height: 26px; flex: none; border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.ly-btn:hover { background: var(--panel-2); color: var(--text); }
.ly-btn.faint { opacity: .4; } .ly-btn.faint:hover { opacity: 1; }
.ly-btn.lk { color: var(--gold); }
.ly-btn.off { color: var(--faint); }
.ly-empty { color: var(--faint); font-size: 12.5px; padding: 12px 4px; line-height: 1.5; }
.ly-rename { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--accent); border-radius: 5px; padding: 3px 6px; font-size: 12.5px; color: var(--text); outline: 0; }

/* tabs */
#tabbar { display: flex; align-items: flex-end; gap: 2px; height: 36px; padding: 6px 10px 0; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--line); background: var(--side); scrollbar-width: none; }
#tabbar.hidden { display: none; }
#tabbar::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 7px; height: 30px; min-width: 90px; max-width: 210px; padding: 0 6px 0 11px; border-radius: 8px 8px 0 0; border: 1px solid transparent; border-bottom: 0; color: var(--muted); font-size: 12.5px; cursor: pointer; flex: none; user-select: none; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.on { background: var(--panel); border-color: var(--line); color: var(--text); box-shadow: inset 0 2px 0 var(--accent); margin-bottom: -1px; height: 31px; }
.tab .pdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.tab .tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .tx { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; opacity: 0; color: var(--muted); flex: none; }
.tab:hover .tx, .tab.on .tx { opacity: 1; }
.tab .tx:hover { background: var(--panel-2); color: var(--text); }
.tab-new { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); flex: none; margin-bottom: 1px; }
.tab-new:hover { background: var(--hover); color: var(--text); }

/* keyboard shortcuts editor */
.kb-top { display: flex; gap: 8px; }
.kb-top .input { flex: 1; }
.kb-hint { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 10px 0 6px; }
.kb-hint kbd, .kb-chip kbd { font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--panel); margin: 0 1px; }
.kb-list { max-height: 52vh; overflow: auto; margin: 0 -4px; padding: 0 4px; }
.kb-group { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); margin: 16px 0 6px; font-weight: 600; }
.kb-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 8px; }
.kb-row:hover { background: var(--panel-2); }
.kb-row.changed .kb-label::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: middle; box-shadow: 0 0 8px var(--glow); }
.kb-label { flex: 1; font-size: 13px; }
.kb-label small { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }
.kb-keys { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.kb-chip { position: relative; display: inline-flex; align-items: center; gap: 1px; padding: 4px 18px 4px 6px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-size: 11px; }
.kb-chip:hover { border-color: var(--accent); }
.kb-chip.rec { border-color: var(--accent); color: var(--accent-text); font-family: var(--mono); padding-right: 8px; box-shadow: 0 0 14px var(--glow); animation: kbpulse 1s ease-in-out infinite; }
@keyframes kbpulse { 50% { box-shadow: 0 0 2px var(--glow); } }
.kb-x { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; line-height: 13px; border-radius: 4px; font-size: 13px; color: var(--faint); }
.kb-x:hover { color: #ff5c5c; background: var(--hover); }
.kb-add, .kb-def { width: 24px; height: 24px; border-radius: 6px; border: 1px dashed var(--line-2); color: var(--muted); display: grid; place-items: center; font-size: 15px; }
.kb-add:hover, .kb-def:hover { border-color: var(--accent); color: var(--text); }
.kb-def { border-style: solid; }
#app.presenting #imgPanel { display: none; }

/* ---------- v5: table bar, my templates ---------- */
#tblBar {
  position: fixed; z-index: 60; display: flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: 12px; background: var(--glass); border: 1px solid var(--line-2); backdrop-filter: blur(16px);
  box-shadow: var(--shadow); white-space: nowrap;
}
#tblBar.hidden { display: none; }
#tblBar button { display: flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px; border-radius: 8px; color: var(--muted); font-size: 12px; }
#tblBar button:hover { background: var(--hover); color: var(--text); }
#tblBar button:disabled { opacity: .35; cursor: default; background: none; color: var(--muted); }
#tblBar button .ic { color: var(--accent); }
#tblBar button.dz .ic { color: var(--muted); }
#tblBar button.dz:hover { color: #ff6b6b; }
#tblBar button.dz:hover .ic { color: #ff6b6b; }
#tblBar i { width: 1px; height: 18px; background: var(--line-2); margin: 0 3px; }
body.presenting #tblBar { display: none; }
.tpl-list { display: flex; flex-direction: column; gap: 8px; }
.tpl-row { display: flex; align-items: center; gap: 6px; }
.tpl-row .input { flex: 1; }
.tpl-row .danger:hover { color: #ff6b6b; }
#tblBar em { font-style: normal; font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); padding: 0 4px 0 8px; }
.kb-label small.kb-sub { text-transform: none; letter-spacing: 0; font-family: inherit; font-size: 11.5px; }
/* layers: one stack for pictures + boxes */
.ly-grip { display: grid; place-items: center; width: 12px; color: var(--faint); cursor: grab; flex: none; }
.ly-row:hover .ly-grip { color: var(--muted); }
.ly-ord { display: flex; flex-direction: column; margin-left: auto; }
.ly-ord .ly-btn { height: 13px; width: 20px; padding: 0; display: grid; place-items: center; }
.ly-ord .ly-btn:disabled { opacity: .2; pointer-events: none; }
.ly-row.over-top { box-shadow: inset 0 2px 0 var(--accent); }
.ly-row.over-bot { box-shadow: inset 0 -2px 0 var(--accent); }
body.ly-dragging, body.ly-dragging * { cursor: grabbing !important; user-select: none; }
/* canvas scrollbars you can actually see and grab */
#scroller { scrollbar-width: auto; scrollbar-color: color-mix(in srgb, var(--muted) 60%, transparent) transparent; }
#scroller::-webkit-scrollbar { width: 12px; height: 12px; }
#scroller::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 60%, transparent); border: 3px solid transparent; background-clip: padding-box; border-radius: 10px; }
.tbox[style*="max-width"] .tb-body { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Photoshop-style front / spare colors */
.fgbg { position: relative; width: 34px; height: 30px; flex: none; margin-right: 2px; }
.fb-sq { position: absolute; width: 19px; height: 19px; border-radius: 5px; box-shadow: 0 0 0 1.5px var(--panel), 0 0 0 2.5px rgba(127,127,127,.55); overflow: hidden; cursor: pointer; }
.fb-sq input { position: absolute; inset: -8px; width: 40px; height: 40px; opacity: 0; cursor: pointer; }
.fb-front { left: 0; top: 0; z-index: 2; }
.fb-back { left: 11px; top: 11px; z-index: 1; }
.fb-swap { position: absolute; right: -3px; top: -4px; width: 14px; height: 14px; display: grid; place-items: center; color: var(--muted); border-radius: 4px; padding: 0; }
.fb-swap:hover { color: var(--text); background: var(--hover); }
.fb-reset { position: absolute; left: -2px; bottom: -3px; width: 10px; height: 10px; padding: 0; border-radius: 2px; background: linear-gradient(135deg, #fff 50%, #000 50%); box-shadow: 0 0 0 1px rgba(127,127,127,.6); }
.fb-reset:hover { transform: scale(1.2); }
.dsep.sm { height: 18px; margin: 0 2px; }

/* [[links]] between notes */
.dn-editor a.nlink { color: var(--accent); text-decoration: none; border-bottom: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); cursor: pointer; padding: 0 1px; border-radius: 3px; }
.dn-editor a.nlink::before { content: '↗ '; font-size: .8em; opacity: .7; }
.dn-editor a.nlink:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.dn-editor a.nlink.dead { color: var(--muted); text-decoration: line-through; border-bottom-color: transparent; }
#linkPop { position: fixed; z-index: 9000; min-width: 220px; max-width: 320px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.35); }
#linkPop .lp-h { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); padding: 4px 8px 6px; }
#linkPop button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 8px; border-radius: 7px; color: var(--ink); background: none; border: 0; font: inherit; font-size: 13px; cursor: pointer; }
#linkPop button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#linkPop button.on, #linkPop button:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
#linkPop button.none { color: var(--muted); cursor: default; background: none; }
#backlinks { position: absolute; top: 42px; left: 76px; right: 76px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; z-index: 2; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); user-select: none; }
#backlinks:empty { display: none; }
#backlinks button { font: inherit; letter-spacing: .06em; text-transform: none; font-size: 11px; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 999px; padding: 2px 9px; cursor: pointer; }
#backlinks button:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

/* sync */
.sync-pill { flex: none; display: flex; align-items: center; gap: 6px; font: 600 10.5px/1 var(--mono); letter-spacing: .08em; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--muted); cursor: pointer; }
.sync-pill.hidden { display: none; }
.sync-pill:not(.s-needs):not(.s-error) { padding: 6px; }
.sync-pill:not(.s-needs):not(.s-error) span { display: none; }
.side-foot .me { min-width: 0; }
.sync-pill.s-ok { color: var(--accent); }
.sync-pill.s-busy .ic { animation: syncPulse 1s ease-in-out infinite; }
.sync-pill.s-needs, .sync-pill.s-error { color: #ff8f73; border-color: color-mix(in srgb, #ff8f73 45%, transparent); }
@keyframes syncPulse { 50% { opacity: .35; } }
.sync-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sync-row .sync-name { font: 600 11px var(--mono); color: var(--accent); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Map view */
#mapView { position: fixed; inset: 0; z-index: 800; background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--accent) 6%, var(--bg)) 0%, var(--bg) 70%); display: flex; flex-direction: column; }
#mapView.hidden { display: none; }
#mapView canvas { flex: 1; width: 100%; min-height: 0; cursor: grab; touch-action: none; }
#mapView canvas:active { cursor: grabbing; }
.mp-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 85%, transparent); backdrop-filter: blur(8px); }
.mp-title { display: flex; align-items: center; gap: 8px; color: var(--accent); min-width: 0; flex: 1; }
.mp-title b { color: var(--ink); font-size: 15px; }
.mp-title span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-search { width: 200px; height: 32px; }
.mp-scope { display: flex; }
.mp-scope button.on { background: var(--hover); color: var(--ink); }
.mp-help { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); pointer-events: none; white-space: nowrap; opacity: .8; }
@media (max-width: 760px) { .mp-search { width: 120px; } .mp-help { display: none; } .mp-title span { display: none; } }

#editor > p[data-rel] { color: var(--muted); font-size: .92em; margin-top: 1.4em; }
#mapView .mp-new { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; gap: 4px; align-items: center; z-index: 3; }
#mapView .mp-new input { width: 220px; text-align: center; }
#mapView .mp-new small { font-size: 11px; color: var(--muted); }
body.map-open .pop, body.map-open .modal-wrap, body.map-open #toasts { z-index: 900; }
body.map-open .pop { background-color: var(--bg); background-image: linear-gradient(var(--panel), var(--panel)); }

/* connections: chips with a remove ×, colour dots, swatches, toast button, map View */
#backlinks button { display: inline-flex; align-items: center; gap: 5px; }
#backlinks button b { font-weight: 400; opacity: 0; margin-right: -3px; padding: 0 2px; border-radius: 50%; line-height: 1; transition: opacity .12s; }
#backlinks button:hover b { opacity: .6; }
#backlinks button b:hover { opacity: 1; color: #ff6b8b; }
.cdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; margin-right: 5px; vertical-align: 1px; box-shadow: 0 0 6px currentColor; }
#backlinks .cdot { margin-right: 0; }
.mswatch { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 10px 8px; }
.mswatch button { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-2, rgba(255,255,255,.15)); background: var(--c, transparent); cursor: pointer; display: grid; place-items: center; color: var(--muted); padding: 0; }
.mswatch button:hover { transform: scale(1.15); }
.mswatch button.on { outline: 2px solid var(--ink, #fff); outline-offset: 2px; }
.toast-act { margin-left: 12px; font: inherit; font-weight: 600; color: var(--accent); background: none; border: 0; cursor: pointer; padding: 0; }
.toast-act:hover { text-decoration: underline; }
.mv-pop { min-width: 260px; }
.mv-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.mv-row:hover { background: color-mix(in srgb, var(--ink, #fff) 6%, transparent); }
.mv-row span { display: flex; flex-direction: column; font-size: 13px; }
.mv-row small { font-size: 11px; color: var(--muted); }
.mv-row input { accent-color: var(--accent); width: 16px; height: 16px; }

/* search results, tags, quick switcher */
.note-item mark, .qs mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.list-empty small { color: var(--muted); }
.ni-tag { color: color-mix(in srgb, var(--c) 80%, var(--ink)); }
.tag-bar { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 14px 8px; }
.tag-bar:empty { display: none; }
.tag-bar button { font: inherit; font-size: 11px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; cursor: pointer;
  color: color-mix(in srgb, var(--c) 80%, var(--ink)); background: color-mix(in srgb, var(--c) 10%, transparent); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); }
.tag-bar button small { opacity: .6; font-size: 10px; }
.tag-bar button:hover { background: color-mix(in srgb, var(--c) 18%, transparent); }
.tag-bar button.on { background: color-mix(in srgb, var(--c) 30%, transparent); border-color: var(--c); }
.qs-wrap { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
body.map-open .qs-wrap { z-index: 900; }
.qs { width: min(620px, calc(100vw - 32px)); background: var(--panel, #111); border: 1px solid var(--line-2, rgba(255,255,255,.12)); border-radius: 14px; box-shadow: 0 24px 80px rgba(0,0,0,.5); overflow: hidden; animation: popIn .14s ease-out; }
.qs-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); color: var(--muted); }
.qs-in input { flex: 1; background: none; border: 0; outline: 0; font: inherit; font-size: 16px; color: var(--ink); }
.qs-list { max-height: min(56vh, 460px); overflow-y: auto; padding: 6px; }
.qs-head { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.qs-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.qs-item.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.qs-item > .ic { color: var(--muted); flex: none; }
.qs-item .cdot { margin: 0 4px; width: 9px; height: 9px; }
.qs-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qs-label { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-txt small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-hint { font-size: 11px; color: var(--muted); white-space: nowrap; }
.qs-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.qs-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--line, rgba(255,255,255,.08)); font-size: 11px; color: var(--muted); }
.qs-foot kbd { margin-right: 3px; }
@media (max-width: 600px) { .qs-foot { display: none; } .qs-wrap { padding-top: 8vh; } }

/* AI help */
.fbtn.ai-btn { color: var(--accent); }
.ai-setup p { margin: 0 0 10px; line-height: 1.5; }
.ai-setup ol { margin: 0 0 14px; padding-left: 20px; line-height: 1.7; }
.ai-setup a { color: var(--accent); }
.ai-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ai-field > span { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ai-models { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ai-models.ai-provs { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 560px) { .ai-models { grid-template-columns: 1fr; } }
.ai-model { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2, rgba(255,255,255,.12)); cursor: pointer; }
.ai-model input { display: none; }
.ai-model b { font-size: 13px; }
.ai-model small { font-size: 11px; color: var(--muted); }
.ai-model .ai-price { font-family: var(--mono); font-size: 10px; margin-top: 4px; }
.ai-model.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.ai-privacy { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--ink, #fff) 4%, transparent); border-radius: 8px; padding: 10px 12px; }
.ai-privacy .ic { flex: none; margin-top: 2px; }
#aiPanel { position: fixed; right: 18px; bottom: 86px; width: min(440px, calc(100vw - 32px)); max-height: min(68vh, 640px); z-index: 70; display: flex; flex-direction: column;
  background-color: var(--bg); background-image: linear-gradient(var(--panel), var(--panel)); border: 1px solid var(--line-2, rgba(255,255,255,.12)); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.45); overflow: hidden; animation: popIn .16s ease-out; }
#aiPanel.hidden { display: none; }
body.map-open #aiPanel { z-index: 900; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); color: var(--accent); }
.ai-head b { color: var(--ink); font-size: 14px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-model-btn { font: inherit; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--muted); background: none; border: 1px solid var(--line-2, rgba(255,255,255,.12)); border-radius: 999px; padding: 2px 8px; cursor: pointer; }
.ai-model-btn:hover { color: var(--ink); }
.ai-body { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.55; min-height: 60px; }
.ai-hint { color: var(--muted); font-size: 13px; }
.ai-q { align-self: flex-end; max-width: 85%; background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 12px 12px 4px 12px; padding: 6px 11px; }
.ai-a p { margin: 0 0 8px; } .ai-a ul, .ai-a ol { margin: 0 0 8px; padding-left: 20px; } .ai-a h2, .ai-a h3 { font-size: 15px; margin: 6px 0; }
.ai-a > :last-child { margin-bottom: 0; }
.ai-a.live > :not(.ai-thinking):last-child::after { content: ''; display: inline-block; width: 7px; height: 14px; margin-left: 3px; vertical-align: -2px; background: var(--accent); animation: aiBlink 1s steps(2) infinite; }
@keyframes aiBlink { 50% { opacity: 0; } }
.ai-a a.nlink { color: var(--accent); cursor: pointer; text-decoration: underline dotted; }
.ai-thinking { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 4px; }
.ai-thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: aiDot 1.2s infinite; }
.ai-thinking i:nth-child(2) { animation-delay: .15s; } .ai-thinking i:nth-child(3) { animation-delay: .3s; margin-right: 4px; }
@keyframes aiDot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ai-err { color: #ff6b8b; font-size: 13px; }
.ai-note, .ai-usage, .ai-ctx { color: var(--muted); font-size: 11px; margin-top: 4px; }
.ai-usage { font-family: var(--mono); }
.linkish { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.ai-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; }
.ai-bar:not(:empty) { padding: 0 14px 10px; }
.ai-bar .btn { font-size: 12px; padding: 5px 10px; }
.ai-ask { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line, rgba(255,255,255,.08)); }
.ai-ask input { flex: 1; }
@media (prefers-reduced-motion: reduce) { .ai-a.live > :last-child::after, .ai-thinking i { animation: none; } }

/* voice typing */
.fbtn.mic-btn.rec { color: #fff; background: #e5484d; border-radius: 8px; animation: micPulse 1.4s ease-in-out infinite; }
@keyframes micPulse { 50% { box-shadow: 0 0 0 6px rgba(229,72,77,.25); } }
#voicePill, #memoPill { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 75; display: flex; align-items: center; gap: 10px; max-width: min(640px, calc(100vw - 32px));
  padding: 7px 8px 7px 14px; border-radius: 999px; background-color: var(--bg); background-image: linear-gradient(var(--panel), var(--panel)); border: 1px solid var(--line-2, rgba(255,255,255,.12)); box-shadow: 0 12px 40px rgba(0,0,0,.4); font-size: 13px; }
body.map-open #voicePill, body.map-open #memoPill { z-index: 900; }
.vp-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5484d; flex: none; animation: aiBlink 1.2s steps(2) infinite; }
.vp-meter { display: flex; align-items: center; gap: 2px; height: 16px; flex: none; }
.vp-meter i { width: 3px; height: 16px; border-radius: 2px; background: var(--accent); transform: scaleY(.15); transition: transform .08s; }
#voicePill[data-engine=live] .vp-meter { display: none; }
.vp-txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.vp-txt.interim { color: var(--ink); font-style: italic; }
.vp-btn { font: inherit; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px solid var(--line-2, rgba(255,255,255,.12)); color: var(--ink); border-radius: 999px; padding: 4px 10px; cursor: pointer; flex: none; }
.vp-btn:hover { background: color-mix(in srgb, var(--ink, #fff) 8%, transparent); }
.vp-stop { background: #e5484d; border-color: #e5484d; color: #fff; }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 720px) { .vs { grid-template-columns: 1fr; } }
.vs .ai-models { grid-template-columns: 1fr; }
.vs-tip { font-size: 12px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.vs-level { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--ink, #fff) 8%, transparent); overflow: hidden; margin: 2px 0 10px; position: relative; }
.vs-level i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .06s; }
.vs-level i.hot { background: #ff9f6b; }
.vs-level[data-err] { height: auto; background: none; }
.vs-level[data-err]::after { content: attr(data-err); color: #ff6b8b; font-size: 12px; }
.vs-level[data-err] i { display: none; }
.vs .mv-row input[type=range] { flex: 1; max-width: 140px; accent-color: var(--accent); }
.vs-bv { font-family: var(--mono); font-size: 11px; width: 34px; text-align: right; }
#vsTest { margin-top: 8px; width: 100%; justify-content: center; }
@media (prefers-reduced-motion: reduce) { .fbtn.mic-btn.rec, .vp-dot { animation: none; } }

/* media cards (the player itself lives in each card's shadow root) */
.dn-media { display: block; min-height: 56px; }
.vp-time { color: var(--ink); font-family: var(--mono); font-weight: 500; }
.vp-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; flex: none; }
.vp-chk input { accent-color: var(--accent); }

/* ---------- hand tool ---------- */
#stage[data-tool="hand"] #ink { cursor: grab; }
#stage.panning #ink, #stage.panning { cursor: grabbing !important; }

/* ---------- party: faces on notes, people rows ---------- */
.ni-faces { display: inline-flex; margin-left: auto; margin-right: 4px; flex: none; }
.ni-faces .av { width: 18px; height: 18px; border-radius: 50%; font-size: 8.5px; font-weight: 700; color: #0b0c0e; display: grid; place-items: center; border: 1.5px solid var(--panel); margin-left: -5px; box-shadow: 0 0 8px currentColor; }
.person .pp-acts { margin-left: auto; display: flex; gap: 6px; }
.person .pp-acts .btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.pp-acts .btn.danger, .party-leave .btn.danger { background: transparent; color: #ff6b8b; border-color: color-mix(in srgb, #ff6b8b 45%, transparent); }
.pp-acts .btn.danger:hover, .party-leave .btn.danger:hover { background: #ff5c5c; color: #1a0505; }
.person b { white-space: nowrap; }
.person[data-uid] .tag { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: right; }
.person[data-uid] .pp-acts { margin-left: 0; flex: none; }
.party-leave { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.party-leave .grow { flex: 1; }

/* ---------- sound & video cards: small; inside a box they fill the box (resize the box to resize them) ---------- */
.dn-editor .dn-media { max-width: 420px; }
.dn-editor .dn-media[data-kind="video"], .dn-editor .dn-media[data-kind="embed"] { max-width: 640px; }
.tb-body .dn-media { max-width: none; margin: 2px 0; }

/* ---------- tool options (eraser modes, steady hand) ---------- */
.opt-pop { width: 270px; }
.opt-pop .mi { align-items: flex-start; white-space: normal; }
.opt-pop .mi small { display: block; color: var(--faint); font-size: 11.5px; margin-top: 2px; }
.opt-pop .mi.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.opt-pop .mi.danger { color: #ff6b8b; }
.opt-pop .msep { height: 1px; background: var(--line); margin: 6px 4px; }
.opt-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.opt-row input { flex: 1; accent-color: var(--accent); }
.opt-row b { min-width: 28px; text-align: right; font-family: var(--mono); font-size: 12px; }
#selBar .tool.sb-txt { width: auto; padding: 0 10px 0 8px; gap: 6px; display: inline-flex; align-items: center; font-size: 12px; white-space: nowrap; }

/* ---------- sidebar peeks in from the left in focus / full screen, or when it's hidden ---------- */
#sideZone { display: none; }
#app.focus #sideZone, #app.collapsed #sideZone { display: block; position: fixed; left: 0; top: 0; bottom: 0; width: 10px; z-index: 25; }
#app.focus.side-peek #sidebar, #app.collapsed.side-peek #sidebar {
  opacity: 1; pointer-events: auto; position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); z-index: 45;
  box-shadow: 18px 0 50px rgba(0,0,0,.45); animation: sidePeekIn .18s var(--ease);
}
@keyframes sidePeekIn { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- History panel ---------- */
#histPanel { position: absolute; right: 16px; top: 70px; width: 270px; max-height: min(520px, 70%); z-index: 9; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
#histPanel.hidden { display: none; }
#histPanel .hp-head { display: flex; align-items: center; gap: 8px; padding: 9px 8px 9px 12px; border-bottom: 1px solid var(--line); cursor: move; user-select: none; color: var(--text); }
#histPanel .hp-head small { color: var(--faint); font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
#histPanel .hp-head .grow { flex: 1; }
#histPanel .hp-list { overflow: auto; padding: 6px; }
#histPanel .hp-row { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 7px 8px; border-radius: 8px; color: var(--text); font-size: 13px; background: none; border: 0; cursor: pointer; }
#histPanel .hp-row:hover { background: var(--panel-2); }
#histPanel .hp-row.on { background: color-mix(in srgb, var(--accent) 16%, transparent); }
#histPanel .hp-row.undone { opacity: .45; }
#histPanel .hp-row .hp-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#histPanel .hp-row small { color: var(--faint); font-family: var(--mono); font-size: 10px; }
#histPanel .hp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
#histPanel .hp-row.on .hp-dot { background: var(--accent); box-shadow: 0 0 8px var(--glow); }
#histPanel .hp-foot { padding: 8px 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11.5px; }

/* ---------- box corner: drag = bigger / smaller text ---------- */
.tb-scale { position: absolute; right: -9px; bottom: -9px; width: 14px; height: 14px; border-radius: 4px; cursor: nwse-resize; opacity: 0;
  background: var(--panel); border: 1.5px solid var(--accent); box-shadow: 0 0 8px var(--glow); z-index: 2; }
.tb-scale::before { content: 'A'; position: absolute; inset: 0; display: grid; place-items: center; font: 700 8.5px/1 var(--ui); color: var(--accent); }
.tbox:hover .tb-scale, .tbox:focus-within .tb-scale, .tbox.scaling .tb-scale { opacity: .9; }
.tbox.scaling::after { content: attr(data-fs); position: absolute; right: 0; bottom: -30px; font: 600 11px var(--mono); color: var(--accent); background: var(--panel); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 6px; pointer-events: none; }
#app.drawing .tb-scale, #app.readonly .tb-scale { display: none; }

/* ---------- first-run tour ---------- */
#tour { position: fixed; inset: 0; z-index: 400; }
#tour .tr-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(3,6,8,.72); outline: 2px solid var(--accent); transition: all .28s var(--ease); pointer-events: none; }
#tour .tr-card { position: fixed; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 16px 16px 12px; box-shadow: var(--shadow), 0 0 40px var(--glow); transition: left .28s var(--ease), top .28s var(--ease); color: var(--text); }
#tour .tr-step { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; color: var(--accent); }
#tour h3 { margin: 6px 0 6px; font-family: var(--display); font-size: 19px; letter-spacing: -.01em; }
#tour p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
#tour .tr-dots { display: flex; gap: 5px; margin-bottom: 10px; }
#tour .tr-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
#tour .tr-dots i.on { background: var(--accent); width: 16px; border-radius: 4px; }
#tour .tr-acts { display: flex; gap: 8px; align-items: center; }
#tour .tr-acts .grow { flex: 1; }

/* ---------- waiting room game ---------- */
#lounge { position: fixed; inset: 0; z-index: 300; background: rgba(3,6,8,.66); display: grid; place-items: center; backdrop-filter: blur(4px); }
#lounge .lg-card { width: min(940px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
#lounge .lg-head, #lounge .lg-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--text); }
#lounge .lg-head { border-bottom: 1px solid var(--line); }
#lounge .lg-foot { border-top: 1px solid var(--line); flex-wrap: wrap; }
#lounge .lg-sub { color: var(--faint); font-size: 12.5px; }
#lounge .grow { flex: 1; }
#lounge canvas { display: block; width: 100%; height: auto; background: radial-gradient(ellipse at center, #10171b, #07090b); cursor: crosshair; touch-action: none; }
#lounge .lg-scores { display: flex; gap: 12px; flex-wrap: wrap; }
#lounge .lg-sc { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
#lounge .lg-sc i { width: 10px; height: 10px; border-radius: 50%; }
#app.focus.side-peek #main, #app.collapsed.side-peek #main { grid-column: 2; grid-row: 1; }

/* ---------- projects inside projects ---------- */
.proj { padding-left: calc(4px + var(--d, 0) * 14px); gap: 6px; }
.ptog { width: 16px; height: 18px; flex: none; display: grid; place-items: center; color: var(--muted); border-radius: 4px; user-select: none; }
.ptog:hover { background: var(--hover); color: var(--text); }
.ptog.none { pointer-events: none; }
.proj.sub .pname { font-weight: 450; }
.proj.drop-in { box-shadow: inset 0 0 0 1.5px var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.project-list.drop-top { box-shadow: inset 0 2px 0 var(--accent); }
.sub-projs { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.sub-proj { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 8px; background: none; border: 0; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.sub-proj:hover { background: var(--hover); }
.sub-proj .sp-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.sub-proj small { color: var(--faint); font-size: 11px; white-space: nowrap; }
.sub-proj.up { color: var(--muted); }
.sub-proj .sp-ic { width: 9px; text-align: center; }
.crumb-up { cursor: pointer; }
.crumb-up:hover { color: var(--text); text-decoration: underline; }
.mp-up { margin-right: 4px; height: 26px; }

/* map: empty project card */
.mp-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100% - 32px)); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px 28px 22px; border-radius: 18px; background: color-mix(in srgb, var(--panel) 78%, transparent); border: 1px solid var(--line-2); box-shadow: 0 30px 80px rgba(0,0,0,.45); backdrop-filter: blur(10px); z-index: 2; }
.mp-empty b { font-family: var(--display); font-size: 20px; letter-spacing: -.02em; color: var(--text); }
.mp-empty p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.mp-empty small { color: var(--faint); font-size: 12px; }
.mpe-orb { width: 54px; height: 54px; border-radius: 50%; margin-bottom: 4px; background: radial-gradient(circle at 35% 30%, #fff 0, color-mix(in srgb, var(--accent) 70%, #fff) 18%, var(--accent) 55%, color-mix(in srgb, var(--accent) 40%, #000) 100%); box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 45%, transparent); animation: mpeFloat 4s ease-in-out infinite; }
@keyframes mpeFloat { 50% { transform: translateY(-5px); } }
.mpe-acts { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.mpe-acts .btn { display: inline-flex; align-items: center; gap: 6px; }
.mpe-link { margin-top: 4px; background: none; border: 0; color: var(--accent-text, var(--accent)); font: inherit; font-size: 12.5px; cursor: pointer; }
.mpe-link:hover { text-decoration: underline; }


/* map: background layer under the dots */
#mapView canvas.mp-bg { position: absolute; flex: none; pointer-events: none; z-index: 0; }
#mapView canvas.mp-cv { position: relative; z-index: 1; }
#mapView .mp-help { z-index: 2; }

/* map look picker */
.mv-pop { width: 420px; max-width: calc(100vw - 24px); max-height: calc(100vh - 90px); overflow-y: auto; }
.mv-cosm { font-size: 11px; color: var(--muted); padding: 2px 6px 4px; }
.mv-looks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 2px 4px 8px; }
.mv-look { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px 7px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; }
.mv-look:hover { background: var(--hover); }
.mv-look.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 16px color-mix(in srgb, var(--accent) 22%, transparent); }
.mv-look canvas { width: 44px; height: 44px; }
.mv-look span { font-size: 11px; font-weight: 550; line-height: 1.2; text-align: center; }
.mv-look span i { font-style: normal; color: var(--gold); }

/* record while you write → replay */
#replayPill { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 75; display: flex; align-items: center; gap: 10px; max-width: min(680px, calc(100vw - 32px));
  padding: 7px 8px 7px 14px; border-radius: 999px; background-color: var(--bg); background-image: linear-gradient(var(--panel), var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 12px 40px rgba(0,0,0,.4); font-size: 13px; }
#replayPill .rp-ic { color: var(--accent); display: inline-flex; }
.rp-later { opacity: .12 !important; }
#editor > .rp-now, .tbox.rp-now, .icard.rp-now { box-shadow: -4px 0 0 var(--accent); border-radius: 4px; background-color: color-mix(in srgb, var(--accent) 10%, transparent); }
body.replaying #editor > [data-rt], body.replaying .tbox, body.replaying .icard { cursor: pointer; transition: opacity .25s, box-shadow .25s; }

/* import picker */
.imp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
@media (max-width: 640px) { .imp-grid { grid-template-columns: 1fr; } }
.imp-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border-radius: 12px; border: 1px solid var(--line-2, rgba(255,255,255,.12)); background: color-mix(in srgb, var(--ink, #fff) 3%, transparent); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.imp-opt:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.imp-opt svg { color: var(--accent); margin-bottom: 4px; }
.imp-opt small { color: var(--muted); font-size: 12px; line-height: 1.4; }

/* comments */
#cpins { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 40; }
.cpin { position: absolute; width: 26px; height: 26px; padding: 0; border-radius: 13px 13px 13px 3px; border: 2px solid var(--bg); background: var(--c, var(--accent)); color: #0b0b0d; font: 700 10px/1 var(--mono, monospace); display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.35); transform-origin: 0 100%; transition: transform .12s; }
.cpin:hover, .cpin.on { transform: scale(1.15); z-index: 2; }
.cpin.res { opacity: .45; filter: grayscale(.6); }
.cpin.new::after { content: ''; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: #ff5c5c; border: 2px solid var(--bg); }
.cpin i { position: absolute; right: -8px; bottom: -6px; font-style: normal; font-size: 9px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: var(--panel); color: var(--ink); border: 1px solid var(--line-2, rgba(255,255,255,.12)); display: grid; place-items: center; }
body.replaying .cpin, body.presenting .cpin { display: none; }
@media print { #cpins { display: none; } }
#commentsBtn .cm-count:empty { display: none; }
#commentsBtn .cm-count { margin-left: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 10px; display: inline-grid; place-items: center; background: color-mix(in srgb, var(--ink, #fff) 14%, transparent); }
#commentsBtn.you .cm-count { background: #ff5c5c; color: #fff; }
.pop.cm-pop { width: 340px; padding: 10px; }
.cm-q { font-size: 12px; color: var(--muted); border-left: 3px solid var(--accent); padding: 2px 0 2px 8px; margin-bottom: 8px; max-height: 3.6em; overflow: hidden; }
.cm-msgs { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.cm-msg { display: flex; gap: 8px; }
.cm-msg .av, .cm-row .av, .cm-mention .av { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 700 9px/1 var(--mono, monospace); color: #0b0b0d; }
.cm-body { flex: 1; min-width: 0; }
.cm-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; } .cm-meta span { color: var(--muted); font-size: 11px; }
.cm-del { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; opacity: 0; } .cm-msg:hover .cm-del { opacity: 1; } .cm-del:hover { color: #ff6b8b; }
.cm-text { font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.cm-at { color: var(--accent); font-weight: 600; }
.cm-reply textarea { width: 100%; resize: vertical; min-height: 44px; font: inherit; font-size: 13px; }
.cm-acts { display: flex; align-items: center; gap: 6px; margin-top: 6px; } .cm-acts .grow { flex: 1; } .cm-tip { font-size: 11px; color: var(--muted); }
.cm-mention { position: fixed; z-index: 2000; display: flex; flex-direction: column; padding: 4px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-2, rgba(255,255,255,.12)); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.cm-mention button { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.cm-mention button.on, .cm-mention button:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.cm-panel { display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow: auto; }
.cm-ph { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; } .cm-ph .grow { flex: 1; }
.cm-sec { font: 600 10px/1 var(--mono, monospace); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 10px 0 4px; }
.cm-row { display: flex; align-items: center; gap: 8px; padding: 6px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.cm-row:hover { background: color-mix(in srgb, var(--ink, #fff) 7%, transparent); }
.cm-rt { flex: 1; min-width: 0; font-size: 12px; } .cm-rt small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.cm-n { font-size: 11px; color: var(--muted); }
.cm-empty { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 4px 0; }
.cm-showres { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; text-align: left; padding: 6px; } .cm-showres:hover { color: var(--ink); }

/* due dates */
.due { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; margin: 0 2px; border-radius: 999px; font-size: .8em; line-height: 1.6; font-weight: 600; white-space: nowrap; vertical-align: .08em; cursor: pointer; user-select: none;
  background: color-mix(in srgb, var(--ink, #fff) 9%, transparent); color: var(--muted); text-decoration: none; }
.due::before { content: ''; width: .85em; height: .85em; flex: none; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E") center / contain no-repeat; }
.due[data-s=late] { background: rgba(255, 92, 92, .16); color: #ff6b6b; }
.due[data-s=today] { background: rgba(232, 176, 75, .18); color: #e8b04b; }
.due[data-s=soon] { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.due[data-s=done] { opacity: .6; }
.dn-editor li.flash { animation: liFlash 1.6s ease-out; border-radius: 6px; }
@keyframes liFlash { 0%, 40% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }
.pop.due-popw { width: 300px; padding: 12px; }
.due-q { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.due-pick { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; font-size: 12px; color: var(--muted); } .due-pick input { flex: 1; color-scheme: dark light; }
.due-tip { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin: 0; }
/* board */
#boardView { position: fixed; inset: 0; z-index: 790; background: var(--bg); display: flex; flex-direction: column; outline: none; }
#boardView.hidden { display: none; }
.bd-tabs, .bd-scope { display: flex; } .bd-tabs button.on, .bd-scope button.on { background: var(--hover); color: var(--ink); }
.bd-body { flex: 1; min-height: 0; overflow: auto; padding: 18px; }
.bd-cols { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 14px; align-items: start; }
.bd-col { background: color-mix(in srgb, var(--panel) 70%, transparent); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 120px; transition: border-color .15s, background .15s; }
.bd-col.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.bd-ch { display: flex; align-items: center; gap: 8px; font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 4px 4px 10px; }
.bd-ch i { font-style: normal; opacity: .7; } .bd-ch .grow { flex: 1; }
.bd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); } .bd-dot.s-todo { background: #5ee1ff; } .bd-dot.s-doing { background: #e8b04b; } .bd-dot.s-done { background: var(--accent); }
.bd-list { display: flex; flex-direction: column; gap: 8px; }
.bd-card { background: var(--panel); border: 1px solid var(--line-2, var(--line)); border-left: 3px solid var(--c); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: transform .12s, box-shadow .12s; }
.bd-card:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.25); }
.bd-card.dragging { opacity: .4; }
.bd-card b { font-size: 14px; } .bd-card small { color: var(--muted); font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bd-proj { font: 600 9.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bd-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 2px; font-size: 11px; }
.bd-meta .due { font-size: 11px; }
.bd-prog, .bd-cm { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); } .bd-prog.full { color: var(--accent); }
.bd-tag { color: var(--accent); opacity: .85; }
.bd-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 18px 6px; border: 1px dashed var(--line); border-radius: 10px; }
.bd-tasks { max-width: 760px; margin: 0 auto; width: 100%; }
.bd-grp { margin-bottom: 18px; }
.bd-grp h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font: 600 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.bd-grp h4 i { font-style: normal; opacity: .7; }
.bd-grp.g-late h4 { color: #ff6b6b; } .bd-grp.g-today h4 { color: #e8b04b; }
.bd-task { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; }
.bd-task:hover { background: color-mix(in srgb, var(--ink, #fff) 5%, transparent); }
.bd-ck { width: 20px; height: 20px; flex: none; border-radius: 6px; border: 2px solid var(--line-2, var(--muted)); background: none; color: #03140c; display: grid; place-items: center; cursor: pointer; padding: 0; }
.bd-ck:hover { border-color: var(--accent); }
.bd-task.done .bd-ck { background: var(--accent); border-color: var(--accent); }
.bd-tt { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; padding: 0; }
.bd-tt span { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .bd-tt small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 40%; }
.bd-task.done .bd-tt span { text-decoration: line-through; color: var(--muted); }
.bd-none { max-width: 420px; margin: 60px auto; text-align: center; color: var(--muted); line-height: 1.6; } .bd-none b { color: var(--ink); font-size: 16px; }
@media (max-width: 1000px) { .bd-cols { grid-template-columns: repeat(2, minmax(200px, 1fr)); } }
@media (max-width: 560px) { .bd-cols { grid-template-columns: 1fr; } .bd-scope { display: none; } }

/* the topbar has more buttons now: the less-used ones drop their words first, so the note title keeps room */
@media (max-width: 1700px) { #boardBtn .lbl, #layersTopBtn .lbl, #commentsBtn .lbl { display: none; } #boardBtn, #layersTopBtn, #commentsBtn { padding: 0 10px; } }
@media (max-width: 1250px) { #mapBtn .lbl, #presentBtn .lbl { display: none; } #mapBtn, #presentBtn { padding: 0 10px; } }
#noteTitle { min-width: 120px; }

.icard.ocr-flash { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 6px; animation: ocrFlash 2.2s ease-out; }
@keyframes ocrFlash { 0%, 50% { outline-color: var(--accent); } 100% { outline-color: transparent; } }

/* account & server sync */
.acct-btn { position: relative; }
.acct-btn.in { color: var(--accent); }
.acct-btn::after { content: ''; position: absolute; right: 5px; bottom: 5px; width: 7px; height: 7px; border-radius: 50%; border: 2px solid var(--panel); background: transparent; }
.acct-btn[data-state=ok]::after { background: var(--accent); }
.acct-btn[data-state=busy]::after { background: var(--accent); animation: syncPulse 1s ease-in-out infinite; }
.acct-btn[data-state=error]::after { background: #ff8f73; }
.acct-btn[data-state=offline]::after { background: var(--muted); }
.acct-tabs { display: flex; margin-bottom: 14px; } .acct-tabs button.on { background: var(--hover); color: var(--ink); }
.acct-body { display: flex; flex-direction: column; gap: 10px; min-width: min(380px, 80vw); }
.acct-f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.acct-f input { font-size: 14px; }
.acct-go { align-self: flex-start; margin-top: 4px; }
.acct-link { align-self: flex-start; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; }
.acct-link:hover { color: var(--ink); }
.acct-tip { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 4px 0 0; }
.acct-err { color: #ff8f73; font-size: 13px; margin: 10px 0 0; }
.acct-err.hidden, .acct-step2.hidden { display: none; }
.acct-step2 { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.acct-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.adm-wrap { max-height: 60vh; overflow: auto; }
.adm { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm th { text-align: left; font: 600 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; }
.adm td { padding: 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.adm td small { display: block; color: var(--muted); font-size: 11.5px; }
.adm td .btn + .btn { margin-left: 6px; }
.adm-t { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }
