/* pasteboard: a cutting mat for code, screenshots and files */

:root {
  --font-ui: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;

  --mat: #25463e;
  --mat-line: rgba(232, 242, 236, 0.055);
  --mat-line-major: rgba(232, 242, 236, 0.12);
  --ruler-bg: #1d3a33;
  --ruler-ink: rgba(232, 242, 236, 0.6);
  --ui-bg: #1b352f;
  --ui-bg-2: #234139;
  --ui-ink: #e8efea;
  --ui-muted: #a3b8af;
  --ui-line: rgba(232, 242, 236, 0.12);
  --accent: #f2c94c;
  --accent-ink: #2b2410;
  --danger: #e0664b;
  --shadow-ui: 0 18px 50px -20px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.25);

  --r-note: 4px;
  --r-ui: 10px;
  --bar-h: 56px;
  --ruler: 20px;
}

body[data-mat="slate"] {
  --mat: #2e3642;
  --mat-line: rgba(226, 232, 240, 0.05);
  --mat-line-major: rgba(226, 232, 240, 0.11);
  --ruler-bg: #262d37;
  --ruler-ink: rgba(226, 232, 240, 0.55);
  --ui-bg: #232a33;
  --ui-bg-2: #2c3440;
  --ui-ink: #e6ebf1;
  --ui-muted: #9ea9b7;
  --ui-line: rgba(226, 232, 240, 0.12);
  --accent: #8fc7ff;
  --accent-ink: #0f2233;
}

/* Syntax colours for editor surfaces. The post-it paper has its own set further down. */
:root {
  --syn-comment: #8d9a95; --syn-keyword: #d3a6f0; --syn-string: #a8d59a; --syn-number: #f0b27a;
  --syn-title: #8cc4f0; --syn-type: #7fd6bf; --syn-attr: #e8c77a; --syn-tag: #f09a9a;
  --syn-meta: #a9b0e0; --syn-deleted: #f08080;
}
body[data-tone="light"] {
  color-scheme: light;
  --syn-comment: #7b8683; --syn-keyword: #7a3a93; --syn-string: #3a7334; --syn-number: #a4541f;
  --syn-title: #1c5d8a; --syn-type: #19705b; --syn-attr: #8a5a00; --syn-tag: #a33a3a;
  --syn-meta: #5d6497; --syn-deleted: #b0322b;
}

body[data-mat="paper"] {
  --mat: #dfe4dd;
  --mat-line: rgba(26, 48, 40, 0.06);
  --mat-line-major: rgba(26, 48, 40, 0.13);
  --ruler-bg: #d1d8d0;
  --ruler-ink: rgba(26, 48, 40, 0.62);
  --ui-bg: #f6f7f4;
  --ui-bg-2: #e9ede7;
  --ui-ink: #1c2623;
  --ui-muted: #5b6b65;
  --ui-line: rgba(26, 48, 40, 0.14);
  --accent: #1f6f5c;
  --accent-ink: #f3faf7;
  --shadow-ui: 0 18px 50px -24px rgba(20, 40, 30, 0.35), 0 2px 6px rgba(20, 40, 30, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 400 14px/1.45 var(--font-ui);
  color: var(--ui-ink);
  background: var(--mat);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ui-muted); }
.grow { flex: 1 1 auto; }

.wordmark {
  font-weight: 700;
  letter-spacing: -0.035em;
  font-size: 34px;
  margin: 0;
  line-height: 1;
}
.wordmark.small { font-size: 19px; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--ui-line);
  background: var(--ui-bg-2); color: var(--ui-ink);
  font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: color-mix(in srgb, var(--ui-ink) 30%, transparent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; height: 42px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 16px; height: 16px; stroke-width: 2.2; }

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 8px;
  border: 0; background: transparent; color: var(--ui-ink);
}
.icon-btn:hover, .icon-btn[aria-pressed="true"]:hover { background: var(--ui-bg-2); }
.icon-btn[aria-pressed="false"] { color: var(--ui-muted); }

/* Quiet on purpose: a small smiley next to the other editor controls that only asserts itself
   once you're actually pointing at it. */
.emoji-btn { opacity: 0.45; }
.emoji-btn:hover, .emoji-btn:focus-visible { opacity: 1; }

.chip {
  height: 28px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--ui-line); background: transparent;
  color: var(--ui-muted); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.chip:hover { color: var(--ui-ink); }
.chip.on, .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.badge {
  position: absolute; top: 2px; right: 1px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

/* ---------- app layout ---------- */

body.app {
  --split: 60%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  grid-template-columns: minmax(0, 1fr); /* let the rows shrink instead of widening the page */
  height: 100dvh;
  overflow: hidden;
}
/* Pin each child to its row explicitly. Without this, hiding .tabs (the "Hide board tabs"
   button sets [hidden] on it) takes it out of grid flow entirely, so auto-placement slides
   .board up into the second, auto-sized row and it collapses to nothing. */
body.app > .bar { grid-row: 1; }
body.app > .tabs { grid-row: 2; }
body.app > .board, body.app > .split-bar, body.app > .list { grid-row: 3; }

/* Split view: board on the left, list on the right, with a divider you can drag. */
body.app.is-split {
  grid-template-columns: minmax(280px, var(--split)) 6px minmax(280px, 1fr);
}
body.app.is-split > .bar, body.app.is-split > .tabs { grid-column: 1 / -1; }
body.app.is-split > .board { grid-column: 1; }
body.app.is-split > .split-bar { grid-column: 2; }
body.app.is-split > .list { grid-column: 3; border-left: 1px solid var(--ui-line); }
.split-bar {
  position: relative; z-index: 5; cursor: col-resize;
  background: var(--ui-line);
}
.split-bar:hover, .split-bar:focus-visible, body.splitting .split-bar { background: var(--accent); outline: none; }
body.splitting, body.splitting * { cursor: col-resize !important; user-select: none; }
body.app.is-split .list-inner { max-width: none; padding: 16px 14px 60px; }

.bar {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--bar-h); padding: 8px 14px;
  background: var(--ui-bg);
  border-bottom: 1px solid var(--ui-line);
  z-index: 30;
}
.bar-group { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bar-group.grow { justify-content: center; gap: 10px; }

/* only shown while the server can't be reached */
.live { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; font-size: 12px; color: var(--ui-muted); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }

.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--ui-bg-2); }
.seg button { border: 0; background: transparent; color: var(--ui-muted); height: 28px; padding: 0 12px; border-radius: 6px; font-weight: 500; }
.seg button[aria-selected="true"] { background: var(--ui-bg); color: var(--ui-ink); box-shadow: 0 1px 2px rgba(0,0,0,.25); }

.search {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  width: min(340px, 34vw); min-width: 0; height: 34px; padding: 0 10px;
  border-radius: 8px; background: var(--ui-bg-2); color: var(--ui-muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ui-ink); }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- board ---------- */

.board {
  --gs: 20px;
  position: relative;
  overflow: hidden;
  touch-action: none;
  outline: none;
  cursor: default;
  background-color: var(--mat);
  background-image:
    linear-gradient(var(--mat-line-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line-major) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: calc(var(--gs) * 5) calc(var(--gs) * 5), calc(var(--gs) * 5) calc(var(--gs) * 5), var(--gs) var(--gs), var(--gs) var(--gs);
}
.board.fine-off { --mat-line: transparent; }
.board.panning, .board.panning * { cursor: grabbing !important; }
.board.space-pan { cursor: grab; }
.board.grabbing-mod .note, .board.grabbing-mod .note * { cursor: move; }

.ruler { position: absolute; z-index: 20; background: var(--ruler-bg); pointer-events: none; }
.ruler.top { top: 0; left: 0; right: 0; height: var(--ruler); border-bottom: 1px solid var(--ui-line); }
.ruler.left { top: 0; left: 0; bottom: 0; width: var(--ruler); border-right: 1px solid var(--ui-line); }

.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }

.marquee {
  position: absolute; z-index: 25; pointer-events: none;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.empty {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
  pointer-events: none; padding: 24px;
}
.empty h2 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.03em; font-weight: 600; }
.empty p { margin: 0 auto; max-width: 46ch; color: var(--ui-muted); font-size: 15px; }

.zoom {
  position: absolute; right: 16px; bottom: 16px; z-index: 22;
  display: flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: var(--r-ui); background: var(--ui-bg); border: 1px solid var(--ui-line);
  box-shadow: var(--shadow-ui);
}
.zoom button { height: 30px; min-width: 30px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; display: grid; place-items: center; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.zoom button:hover { background: var(--ui-bg-2); }
.zoom #zoomReset { min-width: 52px; }

.drop-hint {
  position: absolute; inset: 12px; z-index: 40; pointer-events: none;
  display: grid; place-items: center;
  border: 2px dashed var(--accent); border-radius: 14px;
  background: color-mix(in srgb, var(--mat) 70%, transparent);
}
.drop-hint p { font-size: 22px; font-weight: 600; margin: 0; }

/* ---------- notes ---------- */

.note, .card {
  --paper: #eef0ea;
  --ink: #22282b;
  --ink-soft: rgba(34, 40, 43, 0.58);
  --edge: rgba(34, 40, 43, 0.12);
  --head: color-mix(in srgb, var(--paper) 88%, #000);
  color: var(--ink);
  background: var(--paper);
  border-radius: var(--r-note);
  display: flex; flex-direction: column;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.16), 0 10px 22px -14px rgba(0, 0, 0, 0.6);
}
.c-paper    { --paper: #eef0ea; }
.c-manila   { --paper: #ebdcae; }
.c-sky      { --paper: #cfe0ee; }
.c-rose     { --paper: #efd3d3; }
.c-sage     { --paper: #d2e3c9; }
.c-lilac    { --paper: #ddd6ee; }
.c-graphite { --paper: #343a40; --ink: #e5e9ec; --ink-soft: rgba(229, 233, 236, 0.6); --edge: rgba(229, 233, 236, 0.14); --head: #2b3035; }

.note { position: absolute; left: 0; top: 0; min-width: 160px; }
.note.is-selected { box-shadow: 0 0 0 2px var(--accent), 0 14px 30px -14px rgba(0, 0, 0, 0.7); }
.note.is-dragging { box-shadow: 0 0 0 2px var(--accent), 0 30px 50px -20px rgba(0, 0, 0, 0.75); }
.note.is-dim { opacity: 0.22; }

.n-head {
  display: flex; align-items: center; gap: 7px;
  height: 34px; flex: none; padding: 0 4px 0 10px;
  background: var(--head);
  border-radius: var(--r-note) var(--r-note) 0 0;
  cursor: grab; user-select: none; -webkit-user-select: none;
  touch-action: none;
}
.note.is-pinned .n-head { cursor: default; }
.n-ico { display: grid; color: var(--ink-soft); }
.n-ico svg, .n-flag svg { width: 15px; height: 15px; }
.n-title { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.005em; }
.n-title-host { flex: 1; min-width: 0; display: flex; }
.n-title-edit {
  width: 100%; min-width: 0;
  font: inherit; font-weight: 600; font-size: 13px; letter-spacing: -0.005em;
  color: var(--ink); background: color-mix(in srgb, var(--ink) 9%, transparent);
  border: 1px solid var(--accent); border-radius: 4px;
  padding: 1px 5px; margin: -1px 0;
  cursor: text; user-select: text; -webkit-user-select: text;
}
.n-title-edit:focus { outline: none; }
.n-flag { display: grid; color: var(--ink-soft); }
.n-timer {
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink);
  white-space: nowrap;
}
.note.is-burning .n-timer, .card.is-burning .n-timer { background: var(--danger); color: #fff; }
.n-btn {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px;
  border: 0; background: transparent; color: var(--ink);
}
.n-btn:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.n-btn svg { width: 16px; height: 16px; }

.n-body { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
/* While a click-drag text selection is in progress in one note's body, nothing else on the page
   is selectable, so leaving the note doesn't drag the selection across everything else. */
html.selecting-in-note { user-select: none; -webkit-user-select: none; }
html.selecting-in-note .n-body.is-selecting { user-select: text; -webkit-user-select: text; }

.n-foot {
  display: flex; align-items: center; gap: 6px; flex: none;
  height: 32px; padding: 0 4px 0 10px;
  border-top: 1px solid var(--edge);
  font-size: 11.5px; color: var(--ink-soft);
}
.n-meta { flex: 1; min-width: 0; display: flex; white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; }
/* The size gives way first, so when it was last changed stays readable on a narrow note. */
.n-size { flex: 0 1000 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.n-when { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Narrow notes drop the size, then the language chip, before the time gets squeezed out. */
.n-foot { container-type: inline-size; }
@container (max-width: 420px) { .n-size, .n-sep { display: none; } }
@container (max-width: 330px) { .n-lang { display: none; } }
.n-when time { cursor: default; }
.n-actions { display: flex; gap: 1px; opacity: 0.55; }
.note:hover .n-actions, .note.is-selected .n-actions, .card .n-actions, .n-actions:focus-within { opacity: 1; }
@media (hover: none) { .n-actions { opacity: 1; } }

.n-resize {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px;
  cursor: nwse-resize; touch-action: none;
  background:
    linear-gradient(135deg, transparent 55%, var(--ink-soft) 55%, var(--ink-soft) 60%, transparent 60%, transparent 72%, var(--ink-soft) 72%, var(--ink-soft) 77%, transparent 77%);
  opacity: 0; border-bottom-right-radius: var(--r-note);
}
.note:hover .n-resize { opacity: 0.7; }
.note.is-pinned .n-resize { display: none; }

/* search: a soft overlay so the underlying text (paper ink, syntax colour, link) stays as it was */
mark.hit {
  background: color-mix(in srgb, var(--accent) 38%, transparent);
  color: inherit;
  border-radius: 2px;
}

/* code */
.code {
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: flex-start;
  overflow: auto;
  font: 400 var(--note-font, 12.5px)/1.6 var(--font-code);
  font-variant-ligatures: none;
  tab-size: 4; -moz-tab-size: 4;
  overscroll-behavior: contain;
}
.code pre { margin: 0; padding: 10px 0 14px; font: inherit; }
.code .gutter {
  position: sticky; left: 0; z-index: 1;
  flex: none; min-width: 3ch; padding-left: 10px; padding-right: 10px;
  text-align: right; color: var(--ink-soft); opacity: 0.7;
  background: var(--paper);
  user-select: none; -webkit-user-select: none;
  border-right: 1px solid var(--edge);
}
.code .src { flex: 1 0 auto; padding-left: 12px; padding-right: 16px; white-space: pre; }
.code code { font: inherit; background: none; padding: 0; }
.wrap .code .gutter, .code.wrapped .gutter { display: none; }
.wrap .code .src, .code.wrapped .src { white-space: pre-wrap; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; }
.code.big { font-size: 13.5px; }

.n-more {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; font-size: 11.5px; color: var(--ink-soft);
  border-top: 1px dashed var(--edge);
}
.n-more button { border: 0; background: none; padding: 0; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }

/* image */
.n-img { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px; cursor: zoom-in; }
.n-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 2px; user-select: none; -webkit-user-drag: none; }

/* file / locked / progress */
.n-center {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; text-align: center; color: var(--ink-soft);
}
.n-center svg { width: 30px; height: 30px; stroke-width: 1.4; }
.n-center strong { color: var(--ink); font-weight: 600; word-break: break-all; max-width: 100%; }
.n-center .btn { height: 30px; background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); border-color: var(--edge); }
.n-center .btn.primary { background: var(--ink); color: var(--paper); }

.n-progress { width: 70%; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.n-progress i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.15s linear; }

/* deleted ghosts: faded, flattened to their header, behind everything, still draggable */
.note.is-deleted {
  height: auto !important;
  opacity: 0.4; filter: grayscale(1);
  box-shadow: none;
  outline: 1px dashed var(--ui-muted);
}
.note.is-deleted .n-head { cursor: grab; }
.note.is-deleted.is-fading { opacity: 0; transition: opacity 1.2s ease-in; }
.note.is-deleted .n-body, .note.is-deleted .n-foot, .note.is-deleted .n-resize, .note.is-deleted .n-btn, .note.is-deleted .n-timer { display: none; }
.note.is-deleted .n-head { border-radius: var(--r-note); cursor: default; }
.note.is-deleted .n-ghost { pointer-events: auto; }
.note.is-deleted:hover { opacity: 0.85; }
.n-ghost {
  border: 0; border-radius: 6px; height: 24px; padding: 0 9px; margin-right: 2px;
  background: var(--ink); color: var(--paper); font-size: 11.5px; font-weight: 600;
}

.note.burned { animation: burn 0.55s ease-in forwards; pointer-events: none; }
@keyframes burn {
  to { opacity: 0; transform: var(--pos) scale(0.92); filter: blur(4px) sepia(1); }
}
.note.appear { animation: appear 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes appear { from { opacity: 0; transform: var(--pos) scale(0.94); } }

/* ---------- folders ---------- */
/* A folder is a note-like card with a tab on its top left, so it reads as a folder on the mat. */
.note.is-folder, .card.is-folder { --head: color-mix(in srgb, var(--paper) 78%, #000); }
.c-graphite.is-folder { --head: #24282c; }
.note.is-folder::before, .card.is-folder::before {
  content: ""; position: absolute; left: 0; top: -10px; width: min(42%, 150px); height: 11px;
  background: var(--head); border-radius: 6px 0 0 0;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 100%, 0 100%);
}
.is-folder .n-head { border-top-left-radius: 0; }
.board .note.is-folder .n-body { cursor: grab; user-select: none; -webkit-user-select: none; }
.board .note.is-folder.is-pinned .n-body { cursor: default; }
.note.drop-into { box-shadow: 0 0 0 3px var(--accent), 0 20px 40px -16px rgba(0, 0, 0, 0.75); }
.note.drop-into .f-prev { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.f-count {
  flex: none; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink-soft); background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.f-prev {
  flex: 1; min-height: 0; display: grid; gap: 7px; padding: 9px;
  grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  transition: background-color 0.12s;
}
/* A list card is wide: the tiles sit in a row (two by two on a phone). */
.card .f-prev { flex: none; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-template-rows: none; grid-auto-rows: 120px; }
.card .f-prev.is-empty { height: 90px; }
.f-prev.is-empty {
  display: grid; place-items: center; grid-template: none;
  margin: 9px; border: 1.5px dashed var(--edge); border-radius: 8px;
}
.f-empty { margin: 0; padding: 8px; text-align: center; font-size: 12.5px; color: var(--ink-soft); }
/* Each tile is a tiny copy of the note in its own colour, with ink to match. */
.f-tile {
  --ink: #22282b; --ink-soft: rgba(34, 40, 43, 0.58);
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
  border-radius: 5px; background: var(--paper); color: var(--ink);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.14), 0 4px 10px -6px rgba(0, 0, 0, 0.45);
}
.f-tile.c-graphite { --ink: #e5e9ec; --ink-soft: rgba(229, 233, 236, 0.6); }
.f-text { padding: 6px 7px 0; gap: 3px; }
.f-text strong { font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-text pre {
  flex: 1; min-height: 0; margin: 0; overflow: hidden; white-space: pre;
  font: 400 8px/1.4 var(--font-code); color: var(--ink-soft);
}
.f-img img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.f-img > svg { margin: auto; width: 24px; height: 24px; color: var(--ink-soft); }
.f-file, .f-locked { align-items: center; justify-content: center; gap: 5px; padding: 6px; text-align: center; font-size: 10.5px; color: var(--ink-soft); }
.f-file svg, .f-locked svg { width: 22px; height: 22px; stroke-width: 1.5; }
.f-file span {
  color: var(--ink); font-weight: 600; word-break: break-all; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* "Board › Folder" with Back, over the board and at the top of the list while inside a folder. */
.crumbs {
  display: flex; align-items: center; gap: 4px; min-width: 0; padding: 4px;
  border-radius: var(--r-ui); background: var(--ui-bg); color: var(--ui-ink);
  border: 1px solid var(--ui-line); box-shadow: var(--shadow-ui); font-size: 13px;
}
.crumbs[hidden] { display: none; }
.board .crumbs { position: absolute; z-index: 22; top: calc(var(--ruler) + 12px); left: calc(var(--ruler) + 12px); max-width: calc(100% - var(--ruler) - 24px); }
.list-crumbs { position: sticky; top: 0; z-index: 3; width: fit-content; max-width: 100%; margin-bottom: 14px; }
.crumbs button {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 30px; padding: 0 10px;
  border: 0; border-radius: 6px; background: transparent; color: inherit; font-weight: 500;
}
.crumbs button:hover { background: var(--ui-bg-2); }
.crumbs .crumb-back { flex: none; background: var(--ui-bg-2); font-weight: 600; }
.crumbs svg { width: 16px; height: 16px; }
.crumbs .crumb-board { color: var(--ui-muted); }
.crumb-board > span:last-child, .crumb-here > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { flex: none; color: var(--ui-muted); }
.crumb-here { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 0 10px 0 4px; font-weight: 600; }
.folder-chip svg { width: 13px; height: 13px; }

/* ---------- syntax colors (paper notes) ---------- */
.hljs-comment, .hljs-quote { color: #7b8683; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag { color: #7a3a93; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-template-string { color: #3a7334; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #a4541f; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #1c5d8a; }
.hljs-title.class_, .hljs-type, .hljs-built_in { color: #19705b; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-property { color: #8a5a00; }
.hljs-tag, .hljs-name, .hljs-selector-id, .hljs-selector-class { color: #a33a3a; }
.hljs-meta, .hljs-meta .hljs-keyword { color: #5d6497; }
.hljs-deletion { color: #b0322b; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }
.c-graphite .hljs-comment { color: #8d989f; }
.c-graphite .hljs-keyword, .c-graphite .hljs-literal, .c-graphite .hljs-selector-tag { color: #d3a6f0; }
.c-graphite .hljs-string, .c-graphite .hljs-addition, .c-graphite .hljs-regexp { color: #a8d59a; }
.c-graphite .hljs-number, .c-graphite .hljs-symbol { color: #f0b27a; }
.c-graphite .hljs-title, .c-graphite .hljs-section { color: #8cc4f0; }
.c-graphite .hljs-built_in, .c-graphite .hljs-type, .c-graphite .hljs-title.class_ { color: #7fd6bf; }
.c-graphite .hljs-attr, .c-graphite .hljs-attribute, .c-graphite .hljs-variable, .c-graphite .hljs-property { color: #e8c77a; }
.c-graphite .hljs-tag, .c-graphite .hljs-name, .c-graphite .hljs-selector-class { color: #f09a9a; }
.c-graphite .hljs-meta { color: #a9b0e0; }
/* The editor on a note or card takes the same paper colours, not the ones for dark UI surfaces. */
.note, .card {
  --syn-comment: #7b8683; --syn-keyword: #7a3a93; --syn-string: #3a7334; --syn-number: #a4541f;
  --syn-title: #1c5d8a; --syn-type: #19705b; --syn-attr: #8a5a00; --syn-tag: #a33a3a;
  --syn-meta: #5d6497; --syn-deleted: #b0322b;
}
.note.c-graphite, .card.c-graphite {
  --syn-comment: #8d989f; --syn-keyword: #d3a6f0; --syn-string: #a8d59a; --syn-number: #f0b27a;
  --syn-title: #8cc4f0; --syn-type: #7fd6bf; --syn-attr: #e8c77a; --syn-tag: #f09a9a;
  --syn-meta: #a9b0e0; --syn-deleted: #f08080;
}

/* ---------- list view ---------- */

.list { overflow: auto; }
.list-inner { max-width: 980px; margin: 0 auto; padding: 22px 18px 80px; }
.list-filters { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.list-filters button {
  height: 30px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--ui-line); background: transparent; color: var(--ui-muted); font-weight: 500;
}
.list-filters button[aria-pressed="true"] { background: var(--ui-ink); color: var(--mat); border-color: transparent; }
.list-items { display: flex; flex-direction: column; gap: 14px; }
.card { position: relative; }
.card .n-head { cursor: default; }
.card .n-body { max-height: 440px; }
.card .n-img { max-height: 440px; justify-content: start; }
.card .n-img img { max-height: 420px; }
.card .n-center { flex-direction: row; justify-content: flex-start; padding: 16px 14px; text-align: left; }
.card .n-resize { display: none; }
.list-empty { text-align: center; color: var(--ui-muted); padding: 60px 0; font-size: 15px; }
.list-day { margin: 18px 2px -4px; font-size: 12.5px; font-weight: 600; color: var(--ui-muted); }

/* ---------- drawer, menu, toasts ---------- */

.drawer {
  position: fixed; top: calc(var(--bar-top, 56px) + 8px); right: 8px; bottom: 8px; z-index: 35;
  width: min(380px, calc(100vw - 16px));
  display: flex; flex-direction: column;
  background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: 14px;
  box-shadow: var(--shadow-ui);
}
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 4px 16px; }
.drawer h2 { margin: 0; font-size: 17px; font-weight: 600; }
.drawer-note { margin: 0; padding: 0 16px 10px; color: var(--ui-muted); font-size: 12.5px; }
.drawer-items { flex: 1; overflow: auto; padding: 4px 8px; }
.drawer footer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--ui-line); }
.drawer footer .btn { flex: 1; }
.trash-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.trash-item:hover { background: var(--ui-bg-2); }
.trash-swatch { width: 10px; height: 30px; border-radius: 2px; background: var(--paper); flex: none; }
.trash-text { flex: 1; min-width: 0; }
.trash-text strong { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trash-text span { font-size: 12px; color: var(--ui-muted); }
.trash-empty { padding: 40px 12px; text-align: center; color: var(--ui-muted); }

.menu {
  position: fixed; z-index: 60; min-width: 230px; max-width: 300px; padding: 5px;
  max-height: calc(100dvh - 12px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: var(--r-ui);
  box-shadow: var(--shadow-ui);
}
.menu button.mi {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 32px; padding: 0 10px; border: 0; border-radius: 6px;
  background: transparent; text-align: left;
}
.menu button.mi:hover, .menu button.mi:focus-visible { background: var(--ui-bg-2); outline: none; }
.menu button.mi svg { width: 16px; height: 16px; color: var(--ui-muted); }
.menu button.mi .kbd { margin-left: auto; color: var(--ui-muted); font-size: 12px; }
.menu button.mi.danger { color: var(--danger); }
.menu button.mi.danger svg { color: var(--danger); }
.menu button.mi[aria-checked="true"]::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.menu hr { border: 0; border-top: 1px solid var(--ui-line); margin: 5px 2px; }
.menu .mh { padding: 6px 10px 2px; font-size: 12px; color: var(--ui-muted); }
.menu .swatches { display: flex; gap: 6px; padding: 6px 10px 8px; }
.menu .swatches button {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent;
  background: var(--paper); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.menu .swatches button[aria-checked="true"] { border-color: var(--accent); }

/* ---------- emoji picker ---------- */

.emoji-pop {
  position: fixed; z-index: 61; width: 300px; max-height: min(400px, calc(100vh - 24px));
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: var(--r-ui);
  box-shadow: var(--shadow-ui);
}
.emoji-search {
  height: 32px; padding: 0 10px; flex: none;
  border: 1px solid var(--ui-line); border-radius: 7px;
  background: var(--ui-bg-2); color: var(--ui-ink);
}
.emoji-cats { display: flex; gap: 2px; flex: none; overflow-x: auto; scrollbar-width: none; }
.emoji-cats::-webkit-scrollbar { display: none; }
.emoji-tab {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px;
  border: 0; border-radius: 7px; background: transparent;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 16px;
}
.emoji-tab:hover { background: var(--ui-bg-2); }
.emoji-tab[aria-selected="true"] { background: var(--accent); }
.emoji-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 2px;
  min-height: 120px; max-height: 220px; overflow-y: auto; overflow-x: hidden;
  padding: 2px; border-radius: 8px; background: var(--ui-bg-2);
}
.emoji-cell {
  display: grid; place-items: center; height: 34px;
  border: 0; border-radius: 7px; background: transparent;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 19px;
}
.emoji-cell:hover, .emoji-cell:focus-visible { background: var(--ui-bg); outline: none; }
.emoji-status { grid-column: 1 / -1; margin: 0; padding: 14px; text-align: center; color: var(--ui-muted); font-size: 13px; }
.emoji-recent { flex: none; display: flex; flex-direction: column; gap: 4px; }
.emoji-recent-label { font-size: 11.5px; font-weight: 600; color: var(--ui-muted); padding: 0 2px; }
.emoji-recent-row { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.emoji-recent-row::-webkit-scrollbar { display: none; }
.emoji-recent-row .emoji-cell { flex: none; width: 34px; }

/* ---------- emoji shortcode suggestions ---------- */

.sc-pop {
  position: fixed; z-index: 61; min-width: 140px; max-width: 220px; max-height: 220px;
  overflow-y: auto; padding: 4px;
  background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: var(--r-ui);
  box-shadow: var(--shadow-ui);
}
.sc-row {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px;
  border: 0; border-radius: 6px; background: transparent; text-align: left;
}
.sc-row:hover, .sc-row.is-active { background: var(--ui-bg-2); }
.sc-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 17px; }
.sc-code { color: var(--ui-muted); font-size: 12.5px; font-family: var(--font-code); }

.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 6px 6px 6px 14px; border-radius: 10px;
  background: var(--ui-ink); color: var(--mat);
  box-shadow: var(--shadow-ui); font-weight: 500; max-width: min(520px, 92vw);
}
.toast.error { background: var(--danger); color: #fff; }
.toast button { border: 0; border-radius: 7px; height: 28px; padding: 0 10px; background: color-mix(in srgb, currentColor 16%, transparent); color: inherit; font-weight: 600; }
.toast:not(:has(button)) { padding-right: 14px; }

/* ---------- dialogs ---------- */

dialog { border: 0; padding: 0; color: var(--ui-ink); background: transparent; }
dialog::backdrop { background: rgba(8, 16, 13, 0.55); backdrop-filter: blur(2px); }

.modal { width: min(460px, calc(100vw - 24px)); max-width: 100%; overflow-x: hidden; }
.modal-inner {
  padding: 20px; border-radius: 14px;
  background: var(--ui-bg); border: 1px solid var(--ui-line); box-shadow: var(--shadow-ui);
  display: flex; flex-direction: column; gap: 12px;
  max-width: 100%; overflow-x: hidden;
}
.modal h2 {
  margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.modal p { margin: 0; overflow-wrap: anywhere; }
.fields { display: flex; flex-direction: column; gap: 10px; }
.fields.row { flex-direction: row; }
.fields.row > * { flex: 1; }
.fields label, .auth-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ui-muted); }
.fields input, .fields select, .auth-form input, .sheet-head select {
  height: 38px; padding: 0 11px; border-radius: 8px;
  border: 1px solid var(--ui-line); background: var(--ui-bg-2); color: var(--ui-ink);
}
.fields input:focus, .auth-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.fields label.check, .auth-form label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ui-ink); font-weight: 400; }
.fields label.check input, .auth-form label.check input { height: auto; accent-color: var(--accent); }
.form-error { margin: 0; color: var(--danger); font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.share-list { display: flex; flex-direction: column; gap: 6px; }
.share-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--ui-bg-2); }
.share-row code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px var(--font-code); }
.share-row span { font-size: 12px; color: var(--ui-muted); white-space: nowrap; }
.share-row button { height: 26px; padding: 0 9px; font-size: 12px; }

.sheet { width: calc(100vw - 24px); height: calc(100dvh - 24px); max-height: none; max-width: none; }
.sheet-inner {
  height: 100%; display: flex; flex-direction: column;
  border-radius: 12px; overflow: hidden;
  background: var(--ui-bg); border: 1px solid var(--ui-line); box-shadow: var(--shadow-ui);
}
.sheet-head, .sheet-foot { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; flex: none; }
.sheet-head { border-bottom: 1px solid var(--ui-line); }
.sheet-foot { border-top: 1px solid var(--ui-line); flex-wrap: wrap; }
.title-input { flex: 1; min-width: 0; height: 36px; border: 0; background: transparent; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; outline: none; }
.sheet-head select { height: 30px; font-size: 12.5px; max-width: 150px; }
.sheet-body { position: relative; flex: 1; min-height: 0; display: flex; }
.sheet .code { --paper: var(--ui-bg); --ink: var(--ui-ink); --ink-soft: var(--ui-muted); --edge: var(--ui-line); color: var(--ui-ink); height: 100%; }
.editor-text {
  flex: 1; width: 100%; height: 100%; resize: none; border: 0; outline: none; margin: 0;
  padding: 12px 16px 40px; background: var(--ui-bg); color: var(--ui-ink);
  font: 400 13.5px/1.6 var(--font-code); font-variant-ligatures: none;
  tab-size: 4; -moz-tab-size: 4; white-space: pre; overflow: auto;
}
.editor-text.wrapped { white-space: pre-wrap; }
.sheet-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ui-muted); background: var(--ui-bg); }
.new-opts { display: inline-flex; gap: 6px; }
.remote { color: var(--accent); }

.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; }
.viewer-inner { height: 100%; display: flex; flex-direction: column; background: rgba(6, 12, 10, 0.92); }
.viewer img { flex: 1; min-height: 0; object-fit: contain; width: 100%; padding: 20px; }
.viewer-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; }
#viewerMeta { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* the editor dialog uses the surface palette above */
.sheet .hljs-comment, .md-pane .hljs-comment { color: var(--syn-comment); }
.sheet .hljs-keyword, .sheet .hljs-literal, .sheet .hljs-selector-tag { color: var(--syn-keyword); }
.sheet .hljs-string, .sheet .hljs-addition, .sheet .hljs-regexp { color: var(--syn-string); }
.sheet .hljs-number, .sheet .hljs-symbol { color: var(--syn-number); }
.sheet .hljs-title, .sheet .hljs-section { color: var(--syn-title); }
.sheet .hljs-built_in, .sheet .hljs-type, .sheet .hljs-title.class_ { color: var(--syn-type); }
.sheet .hljs-attr, .sheet .hljs-attribute, .sheet .hljs-variable, .sheet .hljs-property { color: var(--syn-attr); }
.sheet .hljs-tag, .sheet .hljs-name, .sheet .hljs-selector-class { color: var(--syn-tag); }
.sheet .hljs-meta { color: var(--syn-meta); }
.sheet .hljs-deletion { color: var(--syn-deleted); }

/* ---------- auth + share pages ---------- */

body.auth, body.share {
  min-height: 100dvh;
  background-color: var(--mat);
  background-image:
    linear-gradient(var(--mat-line-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line-major) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  background-position: -1px -1px;
}
.auth-mat { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-slip {
  position: relative; width: min(400px, 100%);
  padding: 34px 28px 28px; border-radius: var(--r-note);
  background: #eef0ea; color: #22282b;
  box-shadow: 0 1px 0 rgba(0,0,0,.16), 0 30px 60px -30px rgba(0,0,0,.7);
  transform: rotate(-0.6deg);
}
.auth-tape {
  position: absolute; top: -12px; left: 50%; width: 110px; height: 26px; transform: translateX(-50%) rotate(2deg);
  background: rgba(242, 201, 76, 0.75); box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.auth-sub { margin: 10px 0 22px; color: rgba(34,40,43,.66); max-width: 34ch; }
.auth-tabs { display: flex; gap: 18px; margin-bottom: 16px; border-bottom: 1px solid rgba(34,40,43,.14); }
.auth-tabs a { padding: 0 0 8px; color: rgba(34,40,43,.6); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.auth-tabs a[aria-current="page"] { color: #22282b; border-color: #22282b; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { color: rgba(34,40,43,.7); }
.auth-form input { background: #fff; color: #22282b; border-color: rgba(34,40,43,.18); }
.auth-form input:focus { outline-color: #1f6f5c; }
.auth-form label.check { color: #22282b; }
.auth-form .btn.primary { background: #22282b; color: #eef0ea; margin-top: 6px; }
.auth-error { margin: 0 0 12px; padding: 9px 12px; border-radius: 6px; background: #f6d9d1; color: #8a2c17; font-weight: 500; }
/* The page an app sends you to when connecting (oauth.php) */
.oauth-title { margin: 14px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.oauth-title + .auth-sub { margin-bottom: 14px; overflow-wrap: anywhere; }
.oauth-where, .oauth-warn { margin: 0 0 16px; font-size: 14px; overflow-wrap: anywhere; }
.oauth-warn { padding: 9px 12px; border-radius: 6px; background: #f7e7b7; color: #5c4507; }
.oauth-perms { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 10px; }
.oauth-perms legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: rgba(34,40,43,.7); }
.oauth-perms label.check { align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: #fff; border: 1px solid rgba(34,40,43,.14); min-height: 44px; }
.oauth-perms label.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.oauth-perms label.check span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: rgba(34,40,43,.72); }
.oauth-perms label.check strong { font-size: 14px; color: #22282b; }
.oauth-note { margin: 2px 0 0; font-size: 13px; color: rgba(34,40,43,.66); }
.oauth-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.oauth-actions .btn { min-height: 44px; padding: 0 20px; }
.auth-form .oauth-actions .btn.primary { margin-top: 0; }
.auth-form .oauth-actions .btn:not(.primary) { background: transparent; color: #22282b; border-color: rgba(34,40,43,.25); }

.share-mat { max-width: 1100px; margin: 0 auto; padding: 28px 16px 40px; }
.share-slip.note { position: relative; }
.share-slip { display: flex; flex-direction: column; min-height: 200px; }
.share-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 16px 14px 18px; border-bottom: 1px solid var(--edge); flex-wrap: wrap; }
.share-brand { margin: 0 0 4px; font-weight: 700; letter-spacing: -0.03em; color: var(--ink-soft); }
.share-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; font-weight: 600; word-break: break-word; }
.share-meta { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-actions .btn { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); border-color: var(--edge); }
.share-actions .btn.primary { background: var(--ink); color: var(--paper); }
.share-body { display: flex; min-height: 160px; }
.share-body .code { max-height: none; overflow-x: auto; }
.share-body .n-img { cursor: default; padding: 14px; }
.share-body .n-img img { max-height: 80vh; }
.share-unlock { display: flex; gap: 8px; margin-top: 8px; }
.share-unlock input { height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--edge); background: #fff; color: #22282b; }
.share-foot { text-align: center; color: var(--ui-muted); font-size: 13px; margin-top: 14px; }

/* ---------- responsive + motion ---------- */

@media (max-width: 900px) {
  .bar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .bar-group.grow { order: 3; width: 100%; justify-content: space-between; }
  .search { flex: 1; width: auto; }
  .bar .btn.primary { padding: 0 10px; }
  #defTtl, #defLock { display: none; }
  .live span { display: none; }
  .fields.row { flex-direction: column; }
}
@media (max-width: 520px) {
  .bar .btn.primary { font-size: 0; gap: 0; width: 34px; padding: 0; }
  .bar .btn.primary svg { width: 18px; height: 18px; }
  .zoom { right: 10px; bottom: 10px; }
  .sheet { width: 100vw; height: 100dvh; }
  .sheet-inner { border-radius: 0; }
}

/* html.reduce-motion is set from Settings > Animations, which follows the system by default. */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after, .reduce-motion dialog::backdrop {
  animation-duration: 0.001ms !important; transition-duration: 0.001ms !important;
}

/* ---------- small additions ---------- */
.keys { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, max-content); gap: 7px 18px; margin: 0; }
.keys dt { color: var(--ui-ink); }
.keys dd { margin: 0; text-align: right; }
.keys kbd {
  display: inline-block; padding: 1px 7px; border-radius: 5px;
  border: 1px solid var(--ui-line); background: var(--ui-bg-2);
  font: 500 12px var(--font-code); color: var(--ui-ink); white-space: normal; overflow-wrap: anywhere; text-align: left;
}
.n-up { font-size: 12px; }
.n-img img { pointer-events: none; }
.card .n-img { cursor: zoom-in; }
.menu button.mi[aria-checked="false"]::after { content: ""; margin-left: auto; width: 7px; height: 7px; }
.menu button.mi .kbd + span, .menu button.mi[aria-checked] .kbd { margin-left: 8px; }
.btn.danger:hover { border-color: var(--danger); }
.share-row .btn.danger { color: var(--danger); }
#edRemote { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.list-day:first-child { margin-top: 0; }
.note .n-foot { padding-right: 18px; }
.n-meta, .share-meta, #edStats, #viewerMeta, .trash-text span { word-spacing: 0.14em; }

/* ---------- boards ---------- */

.bicon { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; line-height: 1; }
.bicon.emoji { font-size: 14.5px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.bicon svg { width: 16px; height: 16px; }
.menu button.mi .bicon { color: var(--ui-muted); }

.tabs {
  position: relative; z-index: 29;
  display: flex; align-items: flex-end; gap: 2px;
  height: 40px; padding: 0 8px;
  background: var(--ui-bg);
  border-bottom: 1px solid var(--ui-line);
}
.tab-list {
  display: flex; align-items: flex-end; gap: 2px;
  min-width: 0; height: 100%;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.tab-list::-webkit-scrollbar { display: none; }
.tab-list.fade-l { mask-image: linear-gradient(to right, transparent, #000 32px); }
.tab-list.fade-r { mask-image: linear-gradient(to left, transparent, #000 32px); }
.tab-list.fade-l.fade-r { mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.tab {
  position: relative; flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; max-width: 220px; padding: 0 13px; margin-bottom: -1px;
  border: 1px solid transparent; border-bottom: 0; border-radius: 9px 9px 0 0;
  background: transparent; color: var(--ui-muted);
  font-weight: 500; font-size: 13px; white-space: nowrap;
  touch-action: pan-x; user-select: none; -webkit-user-select: none;
}
.tab:hover { color: var(--ui-ink); background: var(--ui-bg-2); }
.tab[aria-selected="true"] {
  color: var(--ui-ink); background: var(--mat);
  border-color: var(--ui-line);
  box-shadow: inset 0 2px 0 var(--accent);
}
.tab-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.tab.dragging { z-index: 2; background: var(--ui-bg-2); box-shadow: var(--shadow-ui); transition: none; }
.tab-list:has(.dragging) .tab:not(.dragging) { transition: transform 0.15s ease; }
.tab.drop { color: var(--ui-ink); background: color-mix(in srgb, var(--accent) 24%, var(--ui-bg)); outline: 2px dashed var(--accent); outline-offset: -3px; }
.tab-add, .tab-hide { width: 30px; height: 30px; align-self: center; flex: none; color: var(--ui-muted); }
.tab-add:hover, .tab-hide:hover { color: var(--ui-ink); }

.board-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; max-width: 200px; margin-left: 8px; padding: 0 10px;
  border: 1px solid var(--ui-line); border-radius: 8px;
  background: var(--ui-bg-2); color: var(--ui-ink); font-weight: 500;
}
.board-btn[hidden] { display: none; }

.board-chip {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle;
  height: 19px; max-width: 150px; padding: 0 7px 0 4px; margin-right: 4px;
  border-radius: 999px; background: var(--ui-bg-2); color: var(--ui-muted);
  font-size: 11.5px; font-weight: 500; white-space: nowrap; word-spacing: normal;
}
.board-chip span:last-child { overflow: hidden; text-overflow: ellipsis; }
.board-chip .bicon { width: 14px; height: 14px; }
.board-chip .bicon.emoji { font-size: 11.5px; }
.board-chip .bicon svg { width: 13px; height: 13px; }
.board-chip.gone span:last-child { text-decoration: line-through; }

/* search scope and results from every board */
.search .scope {
  flex: none; height: 22px; padding: 0 7px; border-radius: 6px;
  border: 1px solid var(--ui-line); background: transparent; color: var(--ui-muted);
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.search .scope:hover { color: var(--ui-ink); }
.search .scope[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  width: max(100%, min(440px, 92vw)); max-height: min(60vh, 480px); overflow: auto; padding: 5px;
  background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: var(--r-ui); box-shadow: var(--shadow-ui);
}
.search-results .result {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%;
  padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; text-align: left; color: var(--ui-ink);
}
.search-results .result:hover, .search-results .result:focus-visible { background: var(--ui-bg-2); outline: none; }
.result-title { font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-meta { display: flex; align-items: center; gap: 2px; max-width: 100%; font-size: 12px; color: var(--ui-muted); white-space: nowrap; overflow: hidden; }
.result-more { margin: 0; padding: 8px 9px; font-size: 12.5px; color: var(--ui-muted); }

/* mat swatches */
.mat-swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.menu .mat-swatches { padding: 4px 10px 8px; max-width: 280px; }
.mat-sw {
  position: relative; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}
.mat-sw[aria-checked="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.mat-sw.default {
  width: auto; padding: 0 9px; font-size: 12px; font-weight: 500;
  background: var(--ui-bg-2); color: var(--ui-ink);
}
.mat-sw.custom {
  display: grid; place-items: center; overflow: hidden;
  background: conic-gradient(from 90deg, #e0664b, #f2c94c, #6fd39a, #8fc7ff, #b48cf0, #e0664b);
}
.mat-sw.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* board dialog */
.board-dlg { width: min(520px, calc(100vw - 24px)); }
.field-label { font-size: 13px; font-weight: 500; color: var(--ui-muted); }
.picker { display: flex; flex-direction: column; gap: 8px; }
.picker-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.picker-head .field-label { margin-right: auto; }
.picker-search {
  width: 150px; height: 32px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--ui-line); background: var(--ui-bg-2); color: var(--ui-ink);
}
.icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px;
  max-height: 176px; overflow: auto; padding: 4px;
  border-radius: 10px; background: var(--ui-bg-2);
}
.icon-pick {
  display: grid; place-items: center; height: 38px;
  border: 0; border-radius: 7px; background: transparent; color: var(--ui-ink);
}
.icon-pick:hover { background: var(--ui-bg); }
.icon-pick[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.icon-pick .bicon { width: 22px; height: 22px; }
.icon-pick .bicon.emoji { font-size: 19px; }
.icon-pick .bicon svg { width: 20px; height: 20px; }
.icon-none { grid-column: 1 / -1; margin: 0; padding: 14px; text-align: center; }
.board-dlg .modal-actions { align-items: center; }
.board-dlg .modal-actions .btn.danger[hidden] + .grow { display: none; }

/* settings: a docked, non-modal panel (not a <dialog>) so the board and list keep working
   underneath it. It sits in board/list view as an overlay on the right, and in split view it
   takes the list pane's place (the list itself is hidden while it is open). */
.settings-panel {
  position: fixed; top: var(--bar-top, 56px); right: 0; bottom: 0; z-index: 45;
  width: min(640px, 100vw); max-width: 100vw;
  display: none; flex-direction: column; overflow: hidden;
  background: var(--ui-bg); border-left: 1px solid var(--ui-line); box-shadow: var(--shadow-ui);
  transform: translateX(100%);
  transition: transform 0.22s var(--ease-out), display 0.22s allow-discrete, overlay 0.22s allow-discrete;
}
.settings-panel[open] { display: flex; transform: none; }
@starting-style { .settings-panel[open] { transform: translateX(100%); } }

/* Drag handle on the left edge, since the panel is pinned to the right. Widens the hit area past
   the visible edge without eating into the border itself. */
.settings-resize {
  position: absolute; top: 0; bottom: 0; left: 0; width: 9px; margin-left: -5px; z-index: 1;
  cursor: col-resize; background: transparent; border: 0; padding: 0;
}
.settings-resize::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: transparent;
}
.settings-resize:hover::after, .settings-resize:focus-visible::after,
body.settings-resizing .settings-resize::after { background: var(--accent); }
.settings-resize:focus-visible { outline: none; }
body.settings-resizing, body.settings-resizing * { cursor: col-resize !important; user-select: none; }
.settings-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--ui-line); flex: none; }
.settings-head h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin-right: auto; }
.settings-search { width: min(280px, 45vw); }
.settings-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 170px 1fr; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; border-right: 1px solid var(--ui-line); }
.settings-nav button {
  height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent;
  color: var(--ui-ink); text-align: left; font-weight: 500;
}
.settings-nav button:hover { background: var(--ui-bg-2); }
.settings-nav button:disabled { color: var(--ui-muted); opacity: 0.5; cursor: default; background: none; }
.settings-pane { position: relative; overflow: auto; padding: 4px 22px 30px; container-type: inline-size; }
.set-section h3 { margin: 18px 0 4px; font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ui-muted); }
.set-row { display: flex; align-items: center; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--ui-line); }
.set-row:last-child { border-bottom: 0; }
.set-row.type-mat, .set-row.type-keys, .set-row.type-mcp { flex-direction: column; align-items: stretch; gap: 10px; }
.set-row.type-mcp .set-control { justify-content: stretch; }
.set-text { flex: 1; min-width: 0; }
.set-label { font-weight: 500; }
.set-device {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; vertical-align: 1px;
  background: var(--ui-bg-2); color: var(--ui-muted); font-size: 11px; font-weight: 500;
}
.set-help { margin: 3px 0 0; font-size: 12.5px; color: var(--ui-muted); max-width: 52ch; }
.set-control { display: flex; justify-content: flex-end; flex: none; }
.set-control select, .set-control input[type=text] {
  height: 34px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--ui-line); background: var(--ui-bg-2); color: var(--ui-ink);
}
.set-control select { max-width: min(240px, 60cqi); }
.set-control input[type=text] { width: 200px; font: inherit; }

/* Text and control side by side while the pane has room; below ~460px of its own width
   (dragging the settings panel narrower, or a small viewport) they stack instead, the label
   never squeezed down to one word per line. */
@container (max-width: 460px) {
  .set-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .set-control { justify-content: flex-start; }
  .set-control select { max-width: 100%; }
}
.set-control .swatches { display: flex; gap: 6px; }
.set-control .swatches button {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent;
  background: var(--paper); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.set-control .swatches button[aria-checked="true"] { border-color: var(--accent); }
.set-empty { padding: 40px 0; text-align: center; color: var(--ui-muted); }
.switch {
  appearance: none; -webkit-appearance: none; position: relative; margin: 0;
  width: 38px; height: 22px; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--ui-muted) 40%, transparent);
  transition: background 0.15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ui-ink); transition: transform 0.15s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); background: var(--accent-ink); }

/* ---------- responsive tweaks for the parts above ---------- */

@media (max-width: 900px) {
  .tabs { padding: 0 4px; }
  .tab { max-width: 150px; padding: 0 10px; }
  .settings-body { grid-template-columns: 1fr; }
  .settings-nav { display: none; }
}
@media (max-width: 520px) {
  .search .scope { font-size: 0; padding: 0 6px; }
  .search .scope::after { content: "All"; font-size: 11.5px; }
  .board-btn { max-width: 120px; }
}

/* ---------- text size, more lines, trash picking ---------- */

/* Out of the way until you want it, so the footer text keeps its room. */
.n-font {
  display: flex; align-items: center; gap: 1px; overflow: hidden;
  max-width: 0; opacity: 0; transition: max-width 0.12s ease, opacity 0.12s ease;
  font-variant-numeric: tabular-nums;
}
.note:hover .n-font, .note.is-selected .n-font, .card:hover .n-font, .n-font:focus-within { max-width: 94px; opacity: 1; }
.n-font .n-btn { width: 22px; height: 22px; flex: none; }
.n-font .n-btn svg { width: 13px; height: 13px; stroke-width: 2.2; }
.n-font-v {
  min-width: 3ch; text-align: center; font-size: 11px;
  border: none; background: none; color: inherit; font: inherit; padding: 0; cursor: pointer;
}
.n-font-host { display: flex; }
.n-font-edit {
  width: 3ch; min-width: 0;
  font: inherit; font-size: 11px; text-align: center;
  color: var(--ink); background: color-mix(in srgb, var(--ink) 9%, transparent);
  border: 1px solid var(--accent); border-radius: 4px;
  padding: 1px 2px; margin: -1px 0;
  cursor: text; user-select: text; -webkit-user-select: text;
}
.n-font-edit:focus { outline: none; }
@media (hover: none) { .n-font { opacity: 1; } }

.n-body { position: relative; }
.code-fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 56px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--paper));
}
.n-more {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; max-width: calc(100% - 20px); padding: 0 12px;
  border: 1px solid var(--edge); border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.n-more:hover { background: color-mix(in srgb, var(--ink) 8%, var(--paper)); }
.n-more svg { width: 14px; height: 14px; stroke-width: 2.2; }
.note.is-loading-more .n-more { opacity: 0.6; }
.note.is-loading-more .n-more svg { animation: nudge-down 0.8s ease-in-out infinite; }
@keyframes nudge-down { 50% { transform: translateY(2px); } }

.drawer header .trash-check { margin-right: 2px; }
.trash-check { display: grid; place-items: center; width: 24px; height: 24px; flex: none; }
.trash-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.trash-item.is-picked { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.drawer footer .btn { font-variant-numeric: tabular-nums; }

.steps { display: flex; align-items: center; gap: 2px; }
.steps .icon-btn { width: 28px; height: 28px; border: 1px solid var(--ui-line); }
.steps .icon-btn svg { width: 14px; height: 14px; stroke-width: 2.2; }
.steps-v { min-width: 3ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 500; }
.range { display: flex; align-items: center; gap: 10px; }
.range input[type=range] { width: 160px; accent-color: var(--accent); }
.range-v { min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---------- editing on the note and in the sheet ---------- */

.cm-host { flex: 1; min-width: 0; height: 100%; overflow: hidden; }
.cm-editor { height: 100%; }
.cm-editor .cm-scroller { font-variant-ligatures: none; }
.editor-text.plain { flex: 1; width: 100%; height: 100%; }

.note.is-editing .n-body, .card.is-editing .n-body { overflow: visible; }
/* min-width: 0 keeps a long line scrolling inside the note instead of stretching the editor past it. */
.n-edit { flex: 1; min-height: 0; min-width: 0; display: flex; overflow: hidden; }
.n-edit .cm-editor { flex: 1; min-width: 0; height: 100%; background: var(--paper); }
.n-edit .cm-editor {
  --cm-panel-bg: color-mix(in srgb, var(--ink) 6%, var(--paper));
  --cm-panel-field: var(--paper);
  --cm-panel-ink: var(--ink);
  --cm-panel-muted: var(--ink-soft);
  --cm-panel-line: var(--edge);
}
.n-edit .cm-editor .cm-scroller { font-size: var(--note-font, 12.5px); line-height: 1.6; }
/* The note's own paper colours, so the editor looks like the note it replaces. */
.n-edit .cm-editor, .n-edit .cm-content { color: var(--ink); }
.n-edit .cm-gutters { background: var(--paper); color: var(--ink-soft); border-right: 1px solid var(--edge); }
.n-edit .cm-activeLine { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.n-edit .cm-activeLineGutter { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.n-edit .cm-cursor { border-left-color: var(--ink); }
.n-edit .editor-text.plain { background: var(--paper); color: var(--ink); padding: 8px 10px; font-size: var(--note-font, 12.5px); }
.note.is-editing { box-shadow: 0 0 0 2px var(--accent), 0 18px 34px -16px rgba(0, 0, 0, 0.7); }
/* A card in the list being edited gets a fixed height so the editor has room and scrolls inside. */
.card.is-editing { box-shadow: 0 0 0 2px var(--accent), 0 10px 24px -14px rgba(0, 0, 0, 0.6); }
.card.is-editing .n-body { height: min(440px, 62vh); }
/* The other pane of a note being edited in split view: the draft, read-only. */
.n-edit-mirror {
  flex: 1; min-width: 0; margin: 0; padding: 6px 10px; overflow: auto;
  font: var(--note-font, 12.5px)/1.6 var(--font-code); color: var(--ink-soft); white-space: pre; tab-size: 4;
}
.wrap .n-edit-mirror { white-space: pre-wrap; overflow-wrap: anywhere; }

.n-remote {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 6px 8px; border-bottom: 1px solid var(--edge);
  background: color-mix(in srgb, var(--accent) 22%, var(--paper));
  color: var(--ink); font-size: 11.5px; font-weight: 600;
}
.n-remote .btn { height: 24px; padding: 0 9px; font-size: 11.5px; background: var(--paper); color: var(--ink); border-color: var(--edge); }

.n-lang {
  flex: none; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  height: 20px; padding: 0 7px; border-radius: 999px;
  border: 1px solid var(--edge); background: transparent; color: var(--ink-soft);
  font-size: 11px; font-weight: 500;
}
.n-lang:hover { color: var(--ink); border-color: var(--ink-soft); }

.menu-filter {
  width: calc(100% - 8px); height: 30px; margin: 2px 4px 6px; padding: 0 9px;
  border: 1px solid var(--ui-line); border-radius: 7px;
  background: var(--ui-bg-2); color: var(--ui-ink);
}
.json-tools { display: inline-flex; gap: 4px; }

a.pb-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
a.pb-link:hover { text-decoration-color: currentColor; }

/* ---------- link previews: the card on a link-only note, and the hover popover ---------- */

.lp-note {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; overflow: hidden; font-size: var(--note-font, 12.5px);
}
.lp-line { margin: 0; flex: none; line-height: 1.45; overflow-wrap: anywhere; }
.lp-card {
  flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--edge); border-radius: 6px;
  background: color-mix(in srgb, var(--paper) 72%, #fff);
}
.c-graphite .lp-card { background: color-mix(in srgb, var(--paper) 85%, #fff); }
.lp-img { position: relative; flex: 0 1 auto; min-height: 0; display: flex; overflow: hidden; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.lp-img img { display: block; width: 100%; height: auto; max-height: 300px; min-height: 0; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.lp-img-empty { min-height: 110px; align-items: center; justify-content: center; }

/* The play button that loads an embed in place of the card. Never in the hover popover. */
.lp-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1;
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  display: inline-grid; place-items: center;
  background: color-mix(in srgb, #000 55%, transparent); color: #fff; cursor: pointer;
}
.lp-play:hover, .lp-play:focus-visible { background: color-mix(in srgb, #000 72%, transparent); }
.lp-play svg { width: 20px; height: 20px; margin-left: 2px; }
.lp-small .lp-play { width: 28px; height: 28px; }
.lp-small .lp-play svg { width: 13px; height: 13px; margin-left: 1px; }
/* "Show page" for a link whose page may be framed: a pill with words instead of a round icon. */
.lp-play.lp-show-page { width: auto; height: 32px; padding: 0 14px; border-radius: 16px; font: inherit; font-size: 0.9em; white-space: nowrap; }
.lp-small .lp-play.lp-show-page { height: 24px; padding: 0 9px; font-size: 0.8em; }

/* The embed itself, in place of the card. */
.lp-embed { position: relative; flex: 1; min-height: 0; display: flex; }
.lp-embed-host {
  width: 100%; max-height: 100%; margin: auto; aspect-ratio: var(--embed-ratio, 16 / 9);
  border-radius: 6px; overflow: hidden; background: #000;
}
.lp-embed-host .n-center { color: #aaa; }
/* A framed page fills the space the card had instead of keeping a player's aspect ratio. */
.lp-embed-host.lp-embed-page { margin: 0; aspect-ratio: auto; background: #fff; }
.lp-embed-page .n-center { color: #888; }
.lp-embed-frame { display: block; width: 100%; height: 100%; border: 0; }
.note .lp-embed-frame { pointer-events: none; }
.note.is-selected .lp-embed-frame { pointer-events: auto; }
.board.grabbing-mod .lp-embed-frame, .board.panning .lp-embed-frame, .board.space-pan .lp-embed-frame,
.note.is-dragging .lp-embed-frame { pointer-events: none; }
.card .lp-embed { height: 240px; flex: none; }
.lp-embed-close {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  width: 26px; height: 26px; border-radius: 50%; border: 0;
  display: inline-grid; place-items: center;
  background: color-mix(in srgb, #000 55%, transparent); color: #fff; cursor: pointer;
}
.lp-embed-close:hover, .lp-embed-close:focus-visible { background: color-mix(in srgb, #000 72%, transparent); }
.lp-embed-close svg { width: 14px; height: 14px; }
.lp-body { flex: none; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 8px 10px 9px; }
.lp-site { font-size: 0.85em; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-title, .lp-desc { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lp-title { font-weight: 600; line-height: 1.3; -webkit-line-clamp: 2; line-clamp: 2; }
.lp-desc { color: var(--ink-soft); line-height: 1.4; -webkit-line-clamp: 3; line-clamp: 3; }
.lp-url { font-size: 0.85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }
.lp-small { flex-direction: row; align-items: center; }
.lp-small .lp-img { flex: none; width: 52px; height: 52px; margin-left: 10px; border-radius: 4px; }
.lp-small .lp-img img { height: 100%; }
.lp-small .lp-body { flex: 1; }
.card .lp-card { max-width: 480px; }
/* A short note on the board: picture beside the text instead of above it. */
.note .lp-note { container-type: size; }
@container (max-height: 170px) {
  .lp-card { flex-direction: row; }
  .lp-img { flex: none; width: 96px; }
  .lp-img img { height: 100%; max-height: none; }
  .lp-small .lp-img { width: 52px; height: 52px; align-self: center; }
  .lp-body { flex: 1; justify-content: center; }
  .lp-title { -webkit-line-clamp: 1; line-clamp: 1; }
  .lp-desc { display: none; }
}

.link-pop {
  --paper: var(--ui-bg); --ink: var(--ui-ink); --ink-soft: var(--ui-muted); --edge: var(--ui-line);
  position: fixed; z-index: 62; width: 320px; max-width: calc(100vw - 16px);
  color: var(--ink); font-size: 12.5px; pointer-events: none;
  border-radius: 8px; box-shadow: var(--shadow-ui);
}
.link-pop .lp-card { background: var(--ui-bg); border-radius: 8px; }
.link-pop .lp-img img { max-height: 170px; }
.link-pop .lp-small .lp-img img { max-height: none; }

/* ---------- rendered markdown ---------- */

.md { padding: 10px 14px; overflow: auto; flex: 1; min-height: 0; font-size: var(--note-font, 12.5px); line-height: 1.55; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 0.9em 0 0.35em; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.md h1 { font-size: 1.7em; }
.md h2 { font-size: 1.4em; }
.md h3 { font-size: 1.2em; }
.md p { margin: 0 0 0.7em; }
.md ul, .md ol { margin: 0 0 0.7em; padding-left: 1.4em; }
.md li { margin: 0.15em 0; }
.md li.md-task { list-style: none; margin-left: -1.2em; }
.md li.md-task input { margin-right: 6px; accent-color: currentColor; }
.md blockquote {
  margin: 0 0 0.7em; padding: 2px 0 2px 12px;
  border-left: 3px solid color-mix(in srgb, currentColor 25%, transparent); color: var(--ink-soft);
}
.md hr { border: 0; border-top: 1px solid var(--edge); margin: 1em 0; }
.md code { font: 0.92em var(--font-code); background: color-mix(in srgb, currentColor 9%, transparent); padding: 1px 4px; border-radius: 4px; }
.md pre.md-code {
  margin: 0 0 0.7em; padding: 9px 11px; overflow: auto; border-radius: 6px;
  background: color-mix(in srgb, currentColor 7%, transparent);
}
.md pre.md-code code { background: none; padding: 0; font-size: 0.95em; }
.md img { max-width: 100%; border-radius: 4px; }
.md table { border-collapse: collapse; }

/* ---------- rich text (assets/rich.js sanitises it; only these tags ever reach the page) ---------- */

.rich {
  padding: 10px 14px; overflow: auto; flex: 1; min-height: 0;
  font-size: var(--note-font, 12.5px); line-height: 1.55; overflow-wrap: anywhere;
}
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich h1, .rich h2, .rich h3 { margin: 0.9em 0 0.35em; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.rich h1 { font-size: 1.7em; }
.rich h2 { font-size: 1.4em; }
.rich h3 { font-size: 1.2em; }
.rich p, .rich pre, .rich ul, .rich ol, .rich blockquote { margin: 0 0 0.7em; }
.rich ul, .rich ol { padding-left: 1.4em; }
.rich li { margin: 0.15em 0; }
.rich blockquote {
  padding: 2px 0 2px 12px;
  border-left: 3px solid color-mix(in srgb, currentColor 25%, transparent); color: var(--ink-soft);
}
.rich hr { border: 0; border-top: 1px solid var(--edge); margin: 1em 0; }
.rich code { font: 0.92em var(--font-code); background: color-mix(in srgb, currentColor 9%, transparent); padding: 1px 4px; border-radius: 4px; }
.rich pre {
  padding: 9px 11px; overflow: auto; border-radius: 6px; white-space: pre;
  font: 0.92em/1.5 var(--font-code); background: color-mix(in srgb, currentColor 7%, transparent);
}
.rich pre code { background: none; padding: 0; font-size: 1em; }
.rich mark:not(.hit) { background: color-mix(in srgb, #f2c94c 55%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.rich sub, .rich sup { font-size: 0.75em; line-height: 0; }
.share-body .rich { font-size: 15px; padding: 18px 22px; }

/* The rich text editor: a quiet toolbar over the formatted text (08-rich-edit.js). */
.rich-ed { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); }
.rich-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1px; flex: none;
  padding: 3px 6px; border-bottom: 1px solid var(--edge);
}
.rich-bar button {
  height: 24px; min-width: 24px; padding: 0 4px; border: 0; border-radius: 5px;
  display: grid; place-items: center; background: transparent; color: var(--ink-soft);
  font: 600 12.5px/1 var(--font-ui);
}
.rich-bar button:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink); }
.rich-bar button[aria-pressed="true"] { background: color-mix(in srgb, var(--ink) 14%, transparent); color: var(--ink); }
.rich-bar button:disabled { opacity: 0.35; }
.rich-bar svg { width: 15px; height: 15px; }
.rich-bar .rich-html { font: 600 10.5px/1 var(--font-code); letter-spacing: 0.02em; }
.rich-sep { width: 1px; height: 16px; margin: 0 3px; background: var(--edge); }
.rich-ed .rich-text { outline: none; cursor: text; }
.rich-ed .rich-text a { cursor: text; }
.rich-src { flex: 1; min-width: 0; min-height: 0; display: flex; }
.rich-src .cm-editor, .rich-src .editor-text { flex: 1; min-width: 0; height: 100%; }
.n-edit .rich-src .cm-editor { background: var(--paper); }
.n-edit-mirror.rich { font: inherit; font-size: var(--note-font, 12.5px); line-height: 1.55; white-space: normal; padding: 10px 14px; }
/* In the big editor it uses the surface colours and reads like a page. */
.sheet .rich-ed { --paper: var(--ui-bg); --ink: var(--ui-ink); --ink-soft: var(--ui-muted); --edge: var(--ui-line); }
.sheet .rich-bar { padding: 5px 12px; }
.sheet .rich-ed .rich-text { font-size: 15px; padding: 18px 26px 40px; }
/* Viewing a rich note in the big editor: the formatted text instead of the code view. */
.code.is-rich { display: block; font: 400 15px/1.55 var(--font-ui); }
.code.is-rich > pre { display: none; }
.code.is-rich > .rich { padding: 18px 26px 40px; overflow: visible; font-size: 15px; }

.md-pane { flex: 1; min-width: 0; overflow: auto; padding: 18px 22px; background: var(--ui-bg); color: var(--ui-ink); }
.md-pane .md { padding: 0; font-size: 14.5px; max-width: 80ch; margin: 0 auto; }
.md-pane blockquote { color: var(--ui-muted); }

/* ---------- history and diffs ---------- */

.hist .sheet-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.hist-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.hist-list { overflow: auto; padding: 8px; border-right: 1px solid var(--ui-line); display: flex; flex-direction: column; gap: 2px; }
.hist-row {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ui-ink);
}
.hist-row:hover { background: var(--ui-bg-2); }
.hist-row.is-picked { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.hist-row.is-current { background: var(--ui-bg-2); font-weight: 600; }
.hist-when { font-size: 13px; }
.hist-meta { font-size: 11.5px; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.hist-empty { padding: 20px; }
.hist-main { display: flex; flex-direction: column; min-width: 0; }
.hist-heads { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; padding: 8px 14px; border-bottom: 1px solid var(--ui-line); font-size: 12px; color: var(--ui-muted); }
.hist-diff { flex: 1; overflow: auto; font: 400 12.5px/1.55 var(--font-code); padding: 6px 0 30px; }
.hist-diff.side { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--ui-line); }
.hist-diff .dside { background: var(--ui-bg); min-width: 0; overflow-x: auto; }
.hist-diff .dl { display: flex; gap: 8px; padding: 0 12px; white-space: pre; }
.hist-diff .dl-sign { width: 1ch; flex: none; color: var(--ui-muted); }
.hist-diff .dl-text { min-width: 0; }
.hist-diff .dl.add { background: color-mix(in srgb, #4caf50 22%, transparent); }
.hist-diff .dl.del { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.hist-diff .dl.pad { background: color-mix(in srgb, var(--ui-muted) 8%, transparent); }
.hist-diff .dl.same { color: var(--ui-muted); }

@media (max-width: 900px) {
  .hist-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .hist-list { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--ui-line); }
  .hist-row { min-width: 150px; }
  .hist-diff.side { grid-template-columns: 1fr; }
}

.storage-used { display: flex; flex-direction: column; gap: 2px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ui-muted); }
.storage-used strong { color: var(--ui-ink); }

/* Settings > Connections (MCP) */
.mcp { display: flex; flex-direction: column; gap: 12px; width: 100%; min-width: 0; }
.mcp .set-help { margin: 0; }
.mcp-copy-row, .mcp-new { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mcp input[type=text] {
  flex: 1 1 200px; min-width: 0; width: auto; height: 34px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--ui-line); background: var(--ui-bg-2); color: var(--ui-ink); font: inherit;
}
.mcp .mcp-url, .mcp .mcp-token { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; }
.mcp-check { display: inline-flex; align-items: center; gap: 5px; }
.mcp-fresh {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.mcp-fresh p { margin: 0; }
.mcp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mcp-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 0; border-top: 1px solid var(--ui-line); }
.mcp-name { flex: 1 1 120px; min-width: 0; display: flex; flex-direction: column; }
.mcp-name strong { font-weight: 500; overflow-wrap: anywhere; }
.mcp-meta, .mcp-empty { font-size: 12.5px; color: var(--ui-muted); }
.mcp-empty { margin: 0; }
.mcp-perm { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- picking lines ---------- */

.code .gutter { position: sticky; }
.code .ln { display: block; cursor: pointer; }
.code .ln:hover { color: var(--ink); }
.line-band {
  position: absolute; left: 0; right: 0; z-index: 0; pointer-events: none;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-left: 2px solid var(--accent);
}
.code { position: relative; }
.n-lines {
  position: absolute; right: 10px; bottom: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--edge); background: var(--paper); color: var(--ink);
  font-size: 11.5px; font-weight: 600; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.n-lines svg { width: 13px; height: 13px; }
.share-body .line-band { background: color-mix(in srgb, #f2c94c 26%, transparent); border-left-color: #f2c94c; }

/* ---------- the pill inside a note when it changes ---------- */

.n-flash {
  position: absolute; left: 50%; bottom: 42px; z-index: 5;
  display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 24px);
  padding: 5px 11px 5px 8px; border-radius: 999px;
  background: var(--ui-bg); color: var(--ui-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.55);
  font-size: 11.5px; font-weight: 600; white-space: nowrap; pointer-events: none;
  animation: pb-flash 3.2s ease both;
}
.n-flash span { overflow: hidden; text-overflow: ellipsis; }
.n-flash svg { flex: none; width: 14px; height: 14px; stroke: var(--accent); stroke-width: 2.4; fill: none; }
.n-flash.remote { border-color: color-mix(in srgb, var(--ui-ink) 30%, transparent); }
.card .n-flash { bottom: 44px; }
@keyframes pb-flash {
  0% { opacity: 0; transform: translate(-50%, 6px); }
  7%, 82% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 0); }
}
/* The global reduced-motion rule would end it at once; it only fades, so it may keep its time. */
.reduce-motion .n-flash { animation: pb-flash-still 3.2s ease both !important; }
@keyframes pb-flash-still { 0%, 100% { opacity: 0; transform: translate(-50%, 0); } 5%, 85% { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- picking several notes ---------- */

.card.is-selected { box-shadow: 0 0 0 2px var(--accent), 0 10px 24px -14px rgba(0, 0, 0, 0.6); }
.n-pick {
  flex: none; display: none; place-items: center; width: 18px; height: 18px; padding: 0;
  border: 1.5px solid var(--ink-soft); border-radius: 50%; background: transparent; color: transparent;
}
.n-pick svg { width: 12px; height: 12px; stroke-width: 3; }
/* The tick takes the kind icon's place, so nothing shifts when it appears. */
.card:hover .n-pick, .has-sel .n-pick, .n-pick:focus-visible { display: grid; }
.card:hover .n-ico, .has-sel .card .n-ico, .card:focus-within .n-pick:focus-visible + .n-ico { display: none; }
.n-pick[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (hover: none) { .n-pick { display: grid; } .card .n-ico { display: none; } }

.sel-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 65;
  display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px;
  border-radius: 12px; background: var(--ui-bg); border: 1px solid var(--ui-line);
  box-shadow: var(--shadow-ui); max-width: calc(100vw - 32px);
}
.sel-bar[hidden] { display: none; }
.sel-count { font-weight: 600; margin-right: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sel-bar .btn { height: 32px; }
.has-selbar .toasts { bottom: 74px; }

/* ---------- live HTML preview ---------- */

.n-html { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.n-html-host { position: relative; flex: 1; min-height: 0; display: flex; background: #fff; }
.n-html-host .n-center { color: #555; }
.html-frame { display: block; flex: 1; width: 100%; height: 100%; border: 0; background: #fff; color-scheme: light; }
/* On the board a preview takes the pointer only once its note is selected, so dragging, panning
   and zooming over it keep working. */
.note .html-frame { pointer-events: none; }
.note.is-selected .html-frame { pointer-events: auto; }
.board.grabbing-mod .html-frame, .board.panning .html-frame, .board.space-pan .html-frame,
.note.is-dragging .html-frame { pointer-events: none; }
.card .n-html { height: 420px; flex: none; }
.n-html-bar {
  display: flex; align-items: center; gap: 8px; flex: none; padding: 4px 6px 4px 10px;
  border-bottom: 1px solid var(--edge); background: color-mix(in srgb, var(--ink) 6%, var(--paper));
  color: var(--ink-soft); font-size: 11.5px; font-weight: 500;
}
.n-html-bar[hidden] { display: none; }
.n-html-bar .btn { margin-left: auto; height: 24px; padding: 0 9px; font-size: 11.5px; background: var(--paper); color: var(--ink); border-color: var(--edge); }
.n-html.is-running .n-html-bar { background: color-mix(in srgb, var(--danger) 18%, var(--paper)); color: var(--ink); }

.md-pane.is-html { padding: 0; display: flex; }
.md-pane .ed-html { flex: 1; --paper: var(--ui-bg-2); --ink: var(--ui-ink); --ink-soft: var(--ui-muted); --edge: var(--ui-line); }
.sheet.ed-side .md-pane { border-left: 1px solid var(--ui-line); }
.sheet.ed-side .cm-host, .sheet.ed-side .md-pane { flex: 1 1 50%; }

.scan { margin: 4px 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--ui-bg-2); font-size: 13px; }
.scan-list { margin: 6px 0 0; padding-left: 18px; }
.scan-list li { margin: 2px 0; }
.scan-none { margin: 6px 0 0; color: var(--ui-muted); }

/* ---------- motion ----------
   Switching boards and layouts uses view transitions (withTransition in 02-render.js); dialogs,
   menus, toasts and panels animate with plain CSS. All of it goes when html.reduce-motion is set. */

:root { --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Only the board and list panes are captured, never the whole page, so the bars stay live and
   clicks and drags keep working while a transition runs. */
html[data-vt] { view-transition-name: none; }
html[data-vt] .board { view-transition-name: pb-board; }
html[data-vt] .list { view-transition-name: pb-list; }
::view-transition { pointer-events: none; }
::view-transition-group(pb-board), ::view-transition-group(pb-list) { overflow: clip; animation-duration: 0.3s; animation-timing-function: var(--ease-out); }
/* Snapshots keep their size and get cropped as a pane grows or shrinks, instead of stretching. */
::view-transition-old(pb-board), ::view-transition-new(pb-board),
::view-transition-old(pb-list), ::view-transition-new(pb-list) { height: 100%; object-fit: none; object-position: left top; }

/* Boards: the old one slides out one way while the new one comes in from the other side. */
html[data-vt="board-next"]::view-transition-old(pb-board), html[data-vt="board-next"]::view-transition-old(pb-list) { animation: vt-out-left 0.34s var(--ease-out) both; }
html[data-vt="board-next"]::view-transition-new(pb-board), html[data-vt="board-next"]::view-transition-new(pb-list) { animation: vt-in-right 0.34s var(--ease-out) both; }
html[data-vt="board-prev"]::view-transition-old(pb-board), html[data-vt="board-prev"]::view-transition-old(pb-list) { animation: vt-out-right 0.34s var(--ease-out) both; }
html[data-vt="board-prev"]::view-transition-new(pb-board), html[data-vt="board-prev"]::view-transition-new(pb-list) { animation: vt-in-left 0.34s var(--ease-out) both; }
@keyframes vt-out-left { to { transform: translateX(-35%); opacity: 0; } }
@keyframes vt-out-right { to { transform: translateX(35%); opacity: 0; } }
@keyframes vt-in-right { from { transform: translateX(45%); opacity: 0; } }
@keyframes vt-in-left { from { transform: translateX(-45%); opacity: 0; } }
/* Board, List and Split: the panes resize and cross-fade (the browser's default for a named pair). */

/* Dialogs rise in and fade out. While closing they stay drawn for a moment, so they must not catch clicks. */
dialog {
  opacity: 0; transform: translateY(10px) scale(0.98);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out),
    overlay 0.2s allow-discrete, display 0.2s allow-discrete;
}
dialog[open] { opacity: 1; transform: none; }
dialog:not([open]) { pointer-events: none; }
@starting-style { dialog[open] { opacity: 0; transform: translateY(10px) scale(0.98); } }
dialog::backdrop { opacity: 0; transition: opacity 0.2s ease, overlay 0.2s allow-discrete, display 0.2s allow-discrete; }
dialog[open]::backdrop { opacity: 1; }
@starting-style { dialog[open]::backdrop { opacity: 0; } }
/* The big editor only rises, since it fills the screen. */
dialog.sheet { transform: translateY(14px); }
dialog.sheet[open] { transform: none; }
@starting-style { dialog.sheet[open] { transform: translateY(14px); } }

.menu:not([hidden]), .search-results:not([hidden]) { animation: pop-in 0.14s var(--ease-out); }
@keyframes pop-in { from { opacity: 0; translate: 0 -4px; } }
.toast { animation: toast-in 0.22s var(--ease-out); }
.toast.out { opacity: 0; translate: 0 6px; transition: opacity 0.16s ease, translate 0.16s ease; }
@keyframes toast-in { from { opacity: 0; translate: 0 10px; } }
.drawer:not([hidden]) { animation: drawer-in 0.24s var(--ease-out); }
@keyframes drawer-in { from { opacity: 0; translate: 24px 0; } }
.sel-bar:not([hidden]) { animation: toast-in 0.2s var(--ease-out); }

/* ---------- phones and touch screens ---------- */

/* The + button: on phones it replaces the header's Paste, Upload and New note (openAddMenu). */
.fab { display: none; }

/* Split needs room; below 900px it isn't offered (setView already falls back). */
@media (max-width: 899px) {
  .seg [data-view="split"] { display: none; }
}

@media (max-width: 760px) {
  #btnPaste, #btnUpload, #btnNew { display: none; }
  .fab {
    display: grid; place-items: center;
    position: fixed; z-index: 40;
    right: calc(16px + env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom));
    width: 58px; height: 58px; border: 0; border-radius: 18px;
    background: var(--accent); color: var(--accent-ink);
    box-shadow: 0 8px 22px -8px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.2) inset;
  }
  .fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
  .fab:active { transform: scale(0.96); }
  /* Out from under the + button. */
  .zoom { left: calc(10px + env(safe-area-inset-left)); right: auto; bottom: calc(18px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(92px + env(safe-area-inset-bottom)); width: calc(100% - 24px); }
  .toast { max-width: 100%; }
  .list-inner { padding: 14px 12px calc(110px + env(safe-area-inset-bottom)); }
  .bar { padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left)); }
  .bar .wordmark.small { font-size: 18px; }
  .bar-group.grow { gap: 8px; }
  .seg { flex: none; }
  .settings-resize { display: none; }
  .bar > .bar-group:last-child { margin-left: auto; }
  /* Download and Share link are in the note's menu; the footer keeps what a phone needs. */
  .card .n-btn[data-act="download"], .card .n-btn[data-act="share"] { display: none; }
  .card .lp-img img { max-height: 200px; }
  .ruler { display: none; }
  .board .crumbs { top: 10px; left: calc(10px + env(safe-area-inset-left)); max-width: calc(100% - 20px); }
  /* The whole screen: a phone has no board to keep working beside it. */
  .settings-panel { top: 0; width: 100vw !important; border-left: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  /* The image viewer's bar: meta on its own line, the buttons filling the next one. */
  .viewer-bar { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  #viewerMeta { flex: 1 1 100%; }
  .viewer-bar .grow { display: none; }
  .viewer-bar .btn { flex: 1; }
}

/* On the board a finger on a note's text is handled by startTouchBody() (scroll the text, else pan),
   so the browser must not start scrolling the note's inner scroll areas itself and cancel it. */
.board .note .n-body, .board .note .n-body * { touch-action: none; }

/* A card's header never drags (only a board note's does), so a swipe starting on it, or anything
   inside it, must still scroll the list. */
.card .n-head { touch-action: pan-y; }

/* Fingers, not a mouse: everything you tap is at least about 40 px. */
@media (pointer: coarse) {
  .icon-btn { width: 42px; height: 42px; }
  .icon-btn svg { width: 22px; height: 22px; }
  .btn { min-height: 42px; }
  .chip { min-height: 36px; }
  .seg button { height: 36px; padding: 0 16px; font-size: 15px; }
  .search { height: 42px; }
  .search input { font-size: 16px; } /* 16px keeps phones from zooming in on focus */
  .tab { height: 40px; font-size: 14px; }
  .tabs .icon-btn { width: 40px; height: 40px; }
  .list-filters button { min-height: 38px; padding: 0 16px; font-size: 14px; }
  .menu button.mi { min-height: 46px; font-size: 15px; }
  .menu button.mi svg { width: 20px; height: 20px; }
  .toast button { height: 36px; padding: 0 14px; }
  .zoom button { height: 40px; min-width: 40px; }
  .crumbs button { height: 42px; padding: 0 14px; font-size: 15px; }
  .crumbs svg { width: 20px; height: 20px; }
  .crumb-here { font-size: 15px; }
  .card .n-head { min-height: 50px; gap: 4px; }
  .card .n-title { font-size: 15px; }
  .card .n-btn { width: 40px; height: 40px; border-radius: 9px; }
  .card .n-btn svg { width: 20px; height: 20px; }
  .card .n-foot { min-height: 50px; }
  .card .n-lang { min-height: 32px; padding: 0 10px; }
  .card .n-pick { width: 28px; height: 28px; }
  .n-resize { width: 30px; height: 30px; }
  .card .n-pick svg { width: 15px; height: 15px; }
  .card .n-font .n-btn { width: 34px; height: 34px; }
  .sel-bar .btn { min-height: 42px; }
  .drawer .icon-btn { width: 42px; height: 42px; }
  input, select, textarea { font-size: max(16px, 1em); }
  /* Copy is what a phone mostly does with a note, so it gets a word as well as an icon. */
  .card .n-btn[data-act="copy"] {
    width: auto; padding: 0 14px 0 11px; gap: 6px; display: inline-flex; align-items: center;
    background: color-mix(in srgb, var(--ink) 9%, transparent); font-weight: 600; font-size: 14px;
  }
  .card .n-btn[data-act="copy"]::after { content: "Copy"; }
  .set-control .swatches, .menu .swatches { gap: 10px; flex-wrap: wrap; }
  .set-control .swatches button, .menu .swatches button { width: 34px; height: 34px; }
  .switch { width: 50px; height: 30px; }
  .switch::after { top: 4px; left: 4px; width: 22px; height: 22px; }
  .switch:checked::after { transform: translateX(20px); }
}

/* ---------- Pibbi: the floppy-disk cat who gives tips (09-pibbi.js) ----------
   Poses are data-pose on the <svg>; every moving part has its own class. */

.pibbi {
  --pb-fur: #7193f2; --pb-edge: #2b3667; --pb-ink: #232634; --pb-pink: #ff9db3;
  display: block; width: 100%; height: auto; overflow: visible; stroke: none; fill: none;
}
.pibbi .pb-body { fill: var(--pb-fur); stroke: var(--pb-edge); stroke-width: 2.5; stroke-linejoin: round; }
.pibbi .pb-tail-edge { fill: none; stroke: var(--pb-edge); stroke-width: 10; stroke-linecap: round; }
.pibbi .pb-tail-fur { fill: none; stroke: var(--pb-fur); stroke-width: 5.5; stroke-linecap: round; }
.pibbi .pb-inner { fill: var(--pb-pink); }
.pibbi .pb-shutter { fill: #d6dce5; stroke: var(--pb-edge); stroke-width: 2; }
.pibbi .pb-slot { fill: #3d4458; }
.pibbi .pb-tab { fill: var(--pb-edge); }
.pibbi .pb-label { fill: #fffaf0; }
.pibbi .pb-stripe { fill: #ffb44f; }
.pibbi .pb-whiskers { fill: none; stroke: var(--pb-ink); stroke-width: 1.5; stroke-linecap: round; opacity: 0.65; }
.pibbi .pb-blush { fill: var(--pb-pink); opacity: 0.6; }
.pibbi .pb-eyes ellipse, .pibbi .pb-eyes circle, .pibbi .pb-mouth-smile, .pibbi .pb-mouth-o { fill: var(--pb-ink); }
.pibbi .pb-eyes .pb-glint { fill: #fff; }
.pibbi .pb-line, .pibbi .pb-line path { fill: none; stroke: var(--pb-ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.pibbi .pb-thin { stroke-width: 1.5; }
.pibbi .pb-bean { fill: var(--pb-pink); }
.pibbi .pb-nose { fill: var(--pb-pink); stroke: #d9718a; stroke-width: 0.8; stroke-linejoin: round; }
.pibbi .pb-prop { opacity: 0; fill: var(--accent); }
.pibbi .pb-prop text { font: 700 20px var(--font-ui); fill: var(--accent); }
.pibbi .pb-spark { fill: #ffd34d; }
.pibbi .pb-sweat { fill: #8fd3ff; }
.pibbi .pb-heart { fill: #ff6b8b; }

/* What each pose shows */
.pibbi .pb-eyes, .pibbi .pb-mouth, .pibbi .pb-paw { display: none; }
.pibbi .pb-eyes-open, .pibbi .pb-mouth-cat { display: inline; }
.pibbi:is([data-pose="wave"], [data-pose="happy"], [data-pose="shush"], [data-pose="surprised"], [data-pose="wink"], [data-pose="sleepy"]) .pb-eyes-open { display: none; }
.pibbi:is([data-pose="wave"], [data-pose="happy"]) .pb-eyes-happy { display: inline; }
.pibbi:is([data-pose="shush"], [data-pose="wink"]) .pb-eyes-wink { display: inline; }
.pibbi[data-pose="surprised"] .pb-eyes-wide { display: inline; }
.pibbi[data-pose="sleepy"] .pb-eyes-sleep { display: inline; }
.pibbi:is([data-pose="wave"], [data-pose="happy"], [data-pose="point"], [data-pose="wink"], [data-pose="surprised"], [data-pose="shush"], [data-pose="think"]) .pb-mouth-cat { display: none; }
.pibbi[data-pose="think"] .pb-mouth-hmm { display: inline; }
.pibbi:is([data-pose="wave"], [data-pose="happy"], [data-pose="point"], [data-pose="wink"]) .pb-mouth-smile { display: inline; }
.pibbi[data-pose="surprised"] .pb-mouth-o { display: inline; }
.pibbi[data-pose="shush"] .pb-paw-mouth { display: inline; }
.pibbi[data-pose="shush"] .pb-arm-r { display: none; }
.pibbi[data-pose="think"] .pb-arm-l { transform: rotate(28deg); }
.pibbi[data-pose="think"] .pb-q, .pibbi[data-pose="sleepy"] .pb-z, .pibbi:is([data-pose="happy"], [data-pose="wave"]) .pb-spark,
.pibbi[data-pose="surprised"] .pb-sweat { opacity: 1; }

/* Moving parts */
.pibbi .pb-rig, .pibbi .pb-arm, .pibbi .pb-ear, .pibbi .pb-tail, .pibbi .pb-eyes-open, .pibbi .pb-pupils, .pibbi .pb-shadow,
.pibbi .pb-prop { transform-box: fill-box; }
.pibbi .pb-rig { transform-origin: 50% 100%; animation: pb-breathe 3.2s ease-in-out infinite; }
.pibbi .pb-shadow { fill: rgba(0, 0, 0, 0.28); transform-origin: 50% 50%; animation: pb-shadow 3.2s ease-in-out infinite; }
.pibbi .pb-tail { transform-origin: 0% 100%; animation: pb-tail 2.4s ease-in-out infinite alternate; }
.pibbi .pb-eyes-open { transform-origin: 50% 50%; animation: pb-blink var(--pb-blink-len, 4.6s) var(--pb-blink-delay, 0s) infinite; }
.pibbi .pb-pupils { transition: transform 0.3s var(--ease-out); }
.pibbi .pb-ear { transform-origin: 50% 100%; transition: transform 0.3s var(--ease-out); }
.pibbi:is([data-pose="idle"], [data-pose="look"], [data-pose="point"]) .pb-ear-l { animation: pb-twitch 7s 2s infinite; }
.pibbi .pb-arm { transform-origin: 50% 12%; transition: transform 0.35s var(--ease-out); }
.pibbi .pb-arm-l { transform: rotate(10deg); }
.pibbi .pb-arm-r { transform: rotate(-10deg); }
.pibbi .pb-prop { transform-origin: 50% 50%; transition: opacity 0.25s ease; }

.pibbi[data-pose="wave"] .pb-arm-r { transform: rotate(-150deg); animation: pb-wave 0.32s ease-in-out infinite alternate; }
.pibbi[data-pose="point"] .pb-arm-r { transform: rotate(-105deg); }
.pibbi[data-pose="point"] .pb-pupils { transform: translate(2.5px, -0.5px); }
.pibbi[data-pose="point"] .pb-ear { transform: rotate(0deg) scaleY(1.06); }
.pibbi[data-pose="think"] .pb-pupils { transform: translate(-2px, -2.5px); }
.pibbi[data-pose="think"] .pb-ear-r { transform: rotate(12deg); }
.pibbi[data-pose="think"] .pb-q { animation: pb-float 1.6s ease-in-out infinite alternate; }
.pibbi[data-pose="look"] .pb-pupils { animation: pb-look 2.6s ease-in-out; }
.pibbi[data-pose="surprised"] .pb-ear-l { transform: rotate(-10deg) scaleY(1.1); }
.pibbi[data-pose="surprised"] .pb-ear-r { transform: rotate(10deg) scaleY(1.1); }
.pibbi[data-pose="surprised"] .pb-arm-l { transform: rotate(40deg); }
.pibbi[data-pose="surprised"] .pb-arm-r { transform: rotate(-40deg); }
.pibbi[data-pose="surprised"] .pb-rig { animation: pb-jump 0.45s var(--ease-out), pb-breathe 3.2s 0.5s ease-in-out infinite; }
.pibbi:is([data-pose="happy"], [data-pose="wave"]) .pb-rig { animation: pb-hop 0.55s ease-out 2, pb-breathe 3.2s 1.1s ease-in-out infinite; }
.pibbi:is([data-pose="happy"], [data-pose="wave"]) .pb-spark { animation: pb-twinkle 1.1s ease-in-out infinite alternate; }
.pibbi[data-pose="happy"] .pb-arm-l { transform: rotate(35deg); }
.pibbi[data-pose="happy"] .pb-arm-r { transform: rotate(-35deg); }
.pibbi[data-pose="sleepy"] .pb-ear-l { transform: rotate(-24deg) translateY(3px); }
.pibbi[data-pose="sleepy"] .pb-ear-r { transform: rotate(24deg) translateY(3px); }
.pibbi[data-pose="sleepy"] .pb-rig { animation: pb-breathe 4.8s ease-in-out infinite; }
.pibbi[data-pose="sleepy"] .pb-tail { animation-duration: 4.8s; }
.pibbi[data-pose="sleepy"] .pb-z { animation: pb-float 2.4s ease-in-out infinite alternate; }
.pibbi[data-pose="wink"] .pb-ear-r { transform: rotate(8deg); }
.pibbi.is-giggle .pb-rig { animation: pb-wiggle 0.22s ease-in-out 4; }
.pibbi.is-giggle .pb-heart { animation: pb-heart 1.2s ease-out both; }

@keyframes pb-breathe { 0%, 100% { transform: none; } 50% { transform: translateY(-1.5px) scaleY(1.015); } }
@keyframes pb-shadow { 0%, 100% { transform: none; } 50% { transform: scaleX(0.95); } }
@keyframes pb-tail { from { transform: rotate(-7deg); } to { transform: rotate(9deg); } }
@keyframes pb-blink { 0%, 91%, 100% { transform: none; } 94% { transform: scaleY(0.1); } }
@keyframes pb-twitch { 0%, 94%, 100% { transform: none; } 96% { transform: rotate(-9deg); } 98% { transform: rotate(3deg); } }
@keyframes pb-wave { from { transform: rotate(-155deg); } to { transform: rotate(-118deg); } }
@keyframes pb-look { 0%, 100% { transform: none; } 25%, 40% { transform: translate(-3px, 0); } 60%, 80% { transform: translate(3px, 0); } }
@keyframes pb-float { from { transform: translateY(1px); } to { transform: translateY(-3px); } }
@keyframes pb-twinkle { from { transform: scale(0.7); opacity: 0.4; } to { transform: scale(1.1); opacity: 1; } }
@keyframes pb-hop { 0%, 100% { transform: none; } 30% { transform: translateY(0) scale(1.05, 0.95); } 60% { transform: translateY(-9px) scale(0.97, 1.03); } }
@keyframes pb-jump { 0% { transform: none; } 35% { transform: translateY(-10px) scale(0.95, 1.06); } 100% { transform: none; } }
@keyframes pb-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes pb-heart { 0% { opacity: 0; transform: translateY(6px) scale(0.6); } 25% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-16px) scale(0.9); } }

/* The dock: Pibbi in the bottom-left corner with a speech bubble. */
.pibbi-dock {
  position: fixed; z-index: 66; left: calc(var(--ruler) + 14px); bottom: 12px;
  display: flex; align-items: flex-end; gap: 2px;
  max-width: min(470px, calc(100vw - 32px)); pointer-events: none;
}
.pibbi-dock[hidden] { display: none; }
.pibbi-me {
  pointer-events: auto; flex: none; width: 84px; padding: 0; border: 0; background: transparent;
  cursor: pointer; border-radius: 16px;
}
.pibbi-me:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pibbi-bubble {
  pointer-events: auto; position: relative; margin: 0 0 50px 6px; padding: 12px 14px 10px;
  border-radius: 14px; background: var(--ui-bg); border: 1px solid var(--ui-line); box-shadow: var(--shadow-ui);
  min-width: 0;
}
.pibbi-bubble::before {
  content: ""; position: absolute; left: -7px; bottom: 16px; width: 12px; height: 12px;
  background: var(--ui-bg); border-left: 1px solid var(--ui-line); border-bottom: 1px solid var(--ui-line);
  transform: rotate(45deg);
}
.pibbi-text { margin: 0; font-size: 14px; line-height: 1.45; }
.pibbi-text kbd, .welcome kbd {
  font: 500 12px var(--font-code); padding: 1px 5px; border-radius: 5px; white-space: nowrap;
  background: var(--ui-bg-2); border: 1px solid var(--ui-line); border-bottom-width: 2px;
}
.pibbi-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.pibbi-actions:empty { display: none; }
.pibbi-actions .btn { height: 30px; padding: 0 11px; font-size: 13px; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ui-muted); }
.btn.quiet:hover { color: var(--ui-ink); border-color: transparent; }

.pibbi-dock.is-in .pibbi-me { animation: pb-enter 0.75s var(--ease-out) both; }
.pibbi-dock.is-in .pibbi-bubble { animation: pb-bubble-in 0.32s 0.3s var(--ease-out) both; }
.pibbi-dock.is-in .pibbi-bubble.is-swap { animation: pb-bubble-swap 0.28s var(--ease-out); }
@keyframes pb-bubble-swap { 40% { transform: scale(1.03); } }
.pibbi-dock.is-out .pibbi-me { animation: pb-exit 0.5s ease-in both; }
.pibbi-dock.is-out .pibbi-bubble { animation: pb-bubble-out 0.18s ease-in both; }
.pibbi-dock.is-out * { pointer-events: none; }
@keyframes pb-enter {
  0% { transform: translateY(130%) scale(0.85, 1.12); }
  55% { transform: translateY(-9%) scale(1.06, 0.94); }
  78% { transform: translateY(2%) scale(0.98, 1.02); }
  100% { transform: none; }
}
@keyframes pb-exit {
  0% { transform: none; }
  25% { transform: translateY(-8%) scale(1.05, 0.95); }
  100% { transform: translateY(135%) scale(0.9, 1.1); opacity: 0; }
}
@keyframes pb-bubble-in { from { opacity: 0; transform: translateX(-8px) scale(0.92); transform-origin: left bottom; } }
@keyframes pb-bubble-out { to { opacity: 0; transform: translateX(-6px) scale(0.95); } }

/* Whatever a tip is about lights up for a moment. */
.pib-spot { outline: 3px solid var(--accent); outline-offset: 5px; animation: pib-spot 0.9s ease-in-out 3; }
@keyframes pib-spot { 50% { outline-offset: 10px; outline-color: color-mix(in srgb, var(--accent) 40%, transparent); } }

/* Reduced motion: Pibbi holds still. A near-zero duration on an endless animation would flicker. */
.reduce-motion .pibbi, .reduce-motion .pibbi *, .reduce-motion .pibbi-dock *, .reduce-motion .pib-spot { animation: none !important; }

/* ---------- welcome (09-welcome.js) ---------- */

.welcome { width: min(560px, calc(100vw - 24px)); }
.welcome-inner { gap: 14px; padding: 20px 24px 18px; max-height: calc(100dvh - 32px); }
.welcome-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.welcome-pibbi { width: 104px; transition: width 0.3s var(--ease-out); }
.welcome:is([data-step="hello"], [data-step="done"]) .welcome-pibbi { width: 132px; }
.welcome-dots { display: flex; gap: 6px; }
.welcome-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--ui-line); transition: width 0.25s var(--ease-out), background 0.25s; }
.welcome-dots i.done { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.welcome-dots i.on { width: 20px; background: var(--accent); }
.welcome h2 { text-align: center; font-size: 22px; }
.welcome-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 2px; }
.welcome-body > p { text-align: center; font-size: 15px; color: var(--ui-ink); }
.welcome-body > p:first-child { margin-top: -4px; }
.welcome-check { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--ui-muted); margin-top: 4px; cursor: pointer; }
.welcome-check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.welcome-info { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.welcome-info li { display: flex; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--ui-bg-2); }
.welcome-info strong { display: block; margin-bottom: 2px; font-weight: 600; }
.welcome-info p { color: var(--ui-muted); font-size: 13.5px; line-height: 1.45; }
.welcome-ico {
  flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.welcome-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.welcome-sec h3 { margin: 0 0 3px; font-size: 14px; font-weight: 600; }
.welcome-sec > p.muted { font-size: 13px; color: var(--ui-muted); margin-bottom: 8px; }
.welcome-sec + .welcome-sec { margin-top: 4px; }
.welcome-boards { display: flex; flex-direction: column; gap: 6px; }
.welcome-board { display: flex; align-items: center; gap: 6px; }
.welcome-board input, #welcomeDevice {
  flex: 1; min-width: 0; height: 38px; padding: 0 11px; border-radius: 8px;
  border: 1px solid var(--ui-line); background: var(--ui-bg-2); color: var(--ui-ink);
}
#welcomeDevice { width: 100%; }
.welcome-board input:focus, #welcomeDevice:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.welcome-board-ico {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center; font-size: 18px;
  border-radius: 8px; border: 1px solid var(--ui-line); background: var(--ui-bg-2);
}
.welcome-board-ico .bicon svg { width: 18px; height: 18px; }
.welcome-board-ico[aria-expanded="true"] { border-color: var(--accent); }
.welcome-emoji {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; margin: 6px 0 2px;
  padding: 6px; border-radius: 10px; background: var(--ui-bg-2); max-height: 172px; overflow-y: auto;
}
.welcome-emoji button { height: 38px; border: 0; border-radius: 8px; background: transparent; font-size: 19px; }
.welcome-emoji button:hover, .welcome-emoji button[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.welcome-ideas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.welcome-ideas .chip:disabled { opacity: 0.45; }
.welcome-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.welcome-option {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; text-align: left;
  border-radius: 10px; border: 1.5px solid var(--ui-line); background: var(--ui-bg-2);
}
.welcome-option strong { font-size: 14px; font-weight: 600; }
.welcome-option span { font-size: 12.5px; color: var(--ui-muted); line-height: 1.35; }
.welcome-option[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--ui-bg-2)); }
.welcome-sec .swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.welcome-sec .swatches button {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent;
  background: var(--paper); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.welcome-sec .swatches button[aria-checked="true"] { border-color: var(--accent); }
.welcome-preview {
  height: 112px; border-radius: 12px; border: 1px solid var(--ui-line); display: grid; place-items: center;
  background-color: var(--mat);
  background-image: linear-gradient(var(--mat-line-major) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line-major) 1px, transparent 1px);
  background-size: 28px 28px;
}
.wp-note {
  width: 132px; height: 74px; padding: 9px 10px; border-radius: 4px; background: var(--paper);
  display: flex; flex-direction: column; gap: 7px; transform: rotate(-3deg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.16), 0 10px 22px -12px rgba(0, 0, 0, 0.6);
}
.wp-note:not(.c-graphite) { --ink: #22282b; }
.wp-note b { display: block; width: 55%; height: 7px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 55%, transparent); }
.wp-note i { display: block; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 25%, transparent); }
.wp-note i.short { width: 60%; }
.welcome-actions { align-items: center; }
.welcome-actions .btn[hidden] { display: none; }

@media (max-width: 760px) {
  .pibbi-dock {
    left: calc(10px + env(safe-area-inset-left)); bottom: calc(74px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 96px - env(safe-area-inset-right));
  }
  .pibbi-me { width: 64px; }
  .pibbi-bubble { margin-bottom: 38px; }
  .welcome { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; }
  .welcome-inner { height: 100%; max-height: none; border-radius: 0; border: 0; padding: max(16px, env(safe-area-inset-top)) 18px max(14px, env(safe-area-inset-bottom)); }
  .welcome-pibbi { width: 84px; }
  .welcome:is([data-step="hello"], [data-step="done"]) .welcome-pibbi { width: 112px; }
}

/* Passphrases: an ordinary text box drawn as dots, so password managers don't offer to save them
   (passphraseInput in 03-actions.js, showLocked in share.js). */
input.masked { -webkit-text-security: disc; font-family: var(--font-code); letter-spacing: 0.08em; }
