/* ── a board on a page (BB-111, web/board.js) ─────────────────────────────────────────────────────────
   A canvas of dots, sticky notes with a shadow, frames with a tinted paper and a title above, connectors under a
   label pill, the bars floating over it. The colours of the notes are the same on every theme; the canvas follows
   the light or the dark look. */
.bd-card { padding: 14px 14px 10px; }
.bd-card .pb-h { margin-bottom: 10px; }
.bd-wrap { --bd-bg: #F6F7F8; --bd-dot: #D6DBE0; --bd-line: #56606B; --bd-frame-line: rgba(12, 27, 39, .16);
  /* (a layer of its own: whatever the board stacks inside it, the app's dialogs and menus are above all of it) */
  position: relative; isolation: isolate; height: clamp(440px, calc(100vh - 300px), 920px); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--bd-bg); }
:root[data-mode="dark"] .bd-wrap { --bd-bg: #141619; --bd-dot: #2B3036; --bd-line: #A7B0BA; --bd-frame-line: rgba(255, 255, 255, .16); }
.bd-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; outline: none; cursor: default;
  background-color: var(--bd-bg); background-image: radial-gradient(circle, var(--bd-dot) 1.1px, transparent 1.3px); }
.bd-stage[data-tool="hand"], .bd-stage.space { cursor: grab; }
.bd-stage.panning { cursor: grabbing; }
.bd-stage[data-tool="sticky"], .bd-stage[data-tool="text"], .bd-stage[data-tool="rect"], .bd-stage[data-tool="ellipse"], .bd-stage[data-tool="diamond"], .bd-stage[data-tool="frame"], .bd-stage[data-tool="line"], .bd-stage[data-tool="pen"] { cursor: crosshair; }
.bd-world { position: absolute; left: 0; top: 0; width: 1px; height: 1px; transform-origin: 0 0; }
.bd-el { position: absolute; box-sizing: border-box; }

/* the colours: --c the paper of a note, --cs the line of a shape, a stroke, a coloured text */
.bd-c-yellow { --c: #FFE58F; --cs: #B88A00; } .bd-c-orange { --c: #FFC891; --cs: #D46A00; } .bd-c-red { --c: #FFB3A8; --cs: #D23B2C; }
.bd-c-pink { --c: #FDBAD8; --cs: #BF3579; } .bd-c-violet { --c: #D6C7FF; --cs: #6B4FD6; } .bd-c-blue { --c: #AED5FF; --cs: #2C6CD4; }
.bd-c-teal { --c: #A3E7DC; --cs: #11877A; } .bd-c-green { --c: #BEE8A6; --cs: #3A8C28; } .bd-c-gray { --c: #E3E6EA; --cs: #6B7380; }
.bd-c-white { --c: #FFFFFF; --cs: #8E96A0; } .bd-c-ink { --c: #23282E; --cs: #23282E; } .bd-c-none { --c: transparent; --cs: var(--bd-line); }
:root[data-mode="dark"] .bd-c-ink { --c: #343B44; --cs: #E3E6EA; }
/* (white and gray stay two colours in the dark look too) */
:root[data-mode="dark"] .bd-c-white { --c: #F6F7F8; } :root[data-mode="dark"] .bd-c-gray { --c: #AAB2BC; --cs: #C3C9D0; }

/* a sticky note */
.bd-sticky { background: var(--c); color: #1B1D20; border-radius: 3px; padding: 12px 14px; overflow: hidden;
  box-shadow: 0 1px 1px rgba(15, 20, 25, .10), 0 6px 14px rgba(15, 20, 25, .10); }
.bd-sticky.bd-c-white { box-shadow: 0 0 0 1px rgba(15, 20, 25, .10), 0 4px 12px rgba(15, 20, 25, .08); }
.bd-sticky.bd-c-ink { color: #F3F4F6; }
.bd-in { --fs: 1; --sz: 1; font-size: calc(13px * var(--fs) * var(--sz)); line-height: 1.42; height: 100%; overflow: hidden; overflow-wrap: anywhere; }
.bd-s-s .bd-in { --sz: .86; } .bd-s-l .bd-in { --sz: 1.32; } .bd-s-xl .bd-in { --sz: 1.9; }
.bd-tt { display: block; font-size: 1.16em; font-weight: 650; line-height: 1.28; margin-bottom: 5px; white-space: pre-wrap; letter-spacing: -.005em; }
.bd-tx { white-space: pre-wrap; }
.bd-tag { display: inline-block; font-size: .78em; font-weight: 600; line-height: 1.5; padding: 0 8px; border-radius: 999px; background: rgba(0, 0, 0, .09); margin: 0 0 7px; }
.bd-c-ink .bd-tag { background: rgba(255, 255, 255, .16); }
.bd-sticky.concept { padding-right: 26px; }
.bd-mark { position: absolute; right: 7px; top: 8px; width: 15px; height: 15px; opacity: .5; }
.bd-mark .bd-ic { width: 15px; height: 15px; }
.bd-s-s.bd-sticky .bd-in { font-style: italic; }
/* a text */
.bd-text { color: var(--fg); }
.bd-text:not(.bd-c-none) { color: var(--cs); }
.bd-text .bd-in { font-size: calc(16px * var(--fs) * var(--sz)); line-height: 1.38; overflow: visible; }
/* a shape */
.bd-shp { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bd-shp > * { fill: color-mix(in srgb, var(--c) 60%, var(--bd-bg)); stroke: var(--cs); stroke-width: 2; vector-effect: non-scaling-stroke; }
.bd-c-none .bd-shp > * { fill: transparent; }
.bd-rect .bd-in, .bd-ellipse .bd-in, .bd-diamond .bd-in { position: relative; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px 16px; color: var(--fg); }
.bd-ellipse .bd-in { padding: 14% 18%; } .bd-diamond .bd-in { padding: 22% 24%; }
/* a frame: a tinted paper, its name above it at a size that reads at any zoom */
.bd-frame { border: 1.5px solid var(--bd-frame-line); border-radius: 12px; background: color-mix(in srgb, var(--c) 20%, var(--bd-bg)); }
.bd-frame.bd-c-white { background: color-mix(in srgb, var(--paper) 70%, var(--bd-bg)); }
.bd-frame.bd-c-yellow { background: color-mix(in srgb, var(--c) 34%, var(--bd-bg)); }
.bd-ft { position: absolute; left: 2px; bottom: 100%; margin-bottom: calc(6px / var(--k, 1)); max-width: 100%; font-weight: 650; font-size: max(15px, calc(12px / var(--k, 1))); line-height: 1.25;
  color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* a picture */
.bd-image { background: var(--paper); border-radius: 8px; box-shadow: 0 0 0 1px rgba(15, 20, 25, .08), 0 6px 16px rgba(15, 20, 25, .10); }
.bd-image img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; border-radius: 8px; pointer-events: none; }
.bd-cap { position: absolute; left: 0; right: 0; top: 100%; margin-top: 8px; font-size: 13px; line-height: 1.35; color: var(--fg-muted); }
/* a stroke of the pen */
.bd-pen { pointer-events: none; }
.bd-pen svg { position: absolute; left: -4px; top: -4px; overflow: visible; }
.bd-pen path.bd-hit { stroke: transparent; stroke-width: 14; pointer-events: stroke; }
.bd-pen.sel { outline: none !important; }
.bd-pen.sel path:not(.bd-hit) { stroke: var(--blue); }
.bd-pen path { fill: none; stroke: var(--cs); stroke-linecap: round; stroke-linejoin: round; }
.bd-pen.bd-c-none path { stroke: var(--fg); }
/* a connector */
.bd-line { pointer-events: none; }
.bd-lsv { display: block; overflow: visible; }
.bd-hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.bd-stroke { fill: none; stroke: var(--bd-line); stroke-width: 1.8; stroke-linecap: round; }
.bd-line:not(.bd-c-none) .bd-stroke { stroke: var(--cs); } .bd-line:not(.bd-c-none) .bd-arrow { fill: var(--cs); }
.bd-stroke.dash { stroke-dasharray: 6 5; opacity: .8; }
.bd-arrow { fill: var(--bd-line); }
.bd-line.sel .bd-stroke { stroke: var(--blue); stroke-width: 3; } .bd-line.sel .bd-arrow { fill: var(--blue); }
.bd-lbl { position: absolute; z-index: 100000; transform: translate(-50%, -50%); padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--paper); color: var(--fg-muted);
  font-size: 12px; line-height: 1.4; white-space: nowrap; pointer-events: auto; cursor: pointer; }
/* what is selected: a ring, four corners to pull, a dot to draw a connector from */
.bd-el.sel:not(.bd-line) { outline: calc(2px / var(--k, 1)) solid var(--blue); outline-offset: calc(3px / var(--k, 1)); }
.bd-h { position: absolute; width: calc(11px / var(--k, 1)); height: calc(11px / var(--k, 1)); background: #fff; border: calc(1.5px / var(--k, 1)) solid var(--blue); border-radius: 2px; z-index: 3; }
.bd-h-nw { left: calc(-9px / var(--k, 1)); top: calc(-9px / var(--k, 1)); cursor: nwse-resize; } .bd-h-se { right: calc(-9px / var(--k, 1)); bottom: calc(-9px / var(--k, 1)); cursor: nwse-resize; }
.bd-h-ne { right: calc(-9px / var(--k, 1)); top: calc(-9px / var(--k, 1)); cursor: nesw-resize; } .bd-h-sw { left: calc(-9px / var(--k, 1)); bottom: calc(-9px / var(--k, 1)); cursor: nesw-resize; }
.bd-dot { position: absolute; top: 50%; right: calc(-28px / var(--k, 1)); width: calc(14px / var(--k, 1)); height: calc(14px / var(--k, 1)); margin-top: calc(-7px / var(--k, 1)); border-radius: 50%;
  background: var(--blue); border: calc(2px / var(--k, 1)) solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: crosshair; z-index: 3; }
.bd-href { position: absolute; right: 6px; bottom: 6px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: rgba(255, 255, 255, .78); color: #1B1D20; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.bd-href .bd-ic { width: 14px; height: 14px; }
/* writing in place */
.bd-el.editing { overflow: visible; }
.bd-edit { position: absolute; inset: 0; width: 100%; height: 100%; box-sizing: border-box; padding: 12px 14px; border: 0; border-radius: inherit; outline: none; resize: none;
  background: transparent; color: inherit; font: inherit; font-size: 14px; line-height: 1.42; }
.bd-edit.frame { position: static; width: 22em; height: 1.5em; padding: 0 6px; font-size: inherit; font-weight: 650; background: var(--paper); border-radius: 6px; box-shadow: 0 0 0 2px var(--blue); }
/* while a hand draws */
.bd-marq { position: absolute; border: 1px solid var(--blue); background: color-mix(in srgb, var(--blue) 10%, transparent); pointer-events: none; border-radius: 2px; }
.bd-ghost { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.bd-ghost .g-box { fill: color-mix(in srgb, var(--blue) 8%, transparent); stroke: var(--blue); stroke-dasharray: 4 3; }
.bd-ghost .g-line { stroke: var(--blue); stroke-width: 2; stroke-dasharray: 5 4; fill: none; }
.bd-ghost .g-pen { stroke: var(--fg); fill: none; stroke-linecap: round; stroke-linejoin: round; }
.bd-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; gap: 6px; max-width: 320px; text-align: center; color: var(--fg-subtle); font-size: 13px; line-height: 1.5; pointer-events: none; }
.bd-empty b { color: var(--fg-muted); font-size: 15px; }
.bd-empty[hidden] { display: none; }

/* the bars over the board */
.bd-tools, .bd-ctx, .bd-zoom { position: absolute; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 5px; background: var(--paper); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); }
.bd-tools { left: 10px; top: 50%; transform: translateY(-50%); flex-direction: column; max-height: calc(100% - 16px); overflow-y: auto; scrollbar-width: thin; }
/* (placed over or under the selection by web/board.js placeCtx; a bar too wide for the board wraps, it never scrolls out of sight) */
.bd-ctx { left: 10px; top: 10px; max-width: calc(100% - 16px); flex-wrap: wrap; justify-content: center; row-gap: 4px; z-index: 6; }
.bd-ctx[hidden] { display: none; }
.bd-zoom { right: 10px; bottom: 10px; box-shadow: var(--shadow-sm); }
.bd-b { flex: none; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--fg-muted); cursor: pointer; font: inherit; }
.bd-b:hover { background: var(--n95); color: var(--fg); }
.bd-b.on { background: var(--ink); color: var(--on-ink); }
:root[data-mode="dark"] .bd-b.on { background: var(--fg); color: var(--paper); }
.bd-b:focus-visible, .bd-cw:focus-visible, .bd-zt:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.bd-ic { width: 18px; height: 18px; display: block; }
.bd-sep { display: block; flex: none; width: 22px; height: 1px; margin: 4px auto; background: var(--border); }
.bd-ctx .bd-sep, .bd-zoom .bd-sep { width: 1px; height: 22px; margin: 0 3px; }
/* the colour: the bar's swatch opens the palette of eleven */
.bd-colb .bd-cw { pointer-events: none; width: 20px; height: 20px; }
.bd-pal { position: absolute; z-index: 7; display: grid; grid-template-columns: repeat(6, 24px); gap: 8px; padding: 10px; background: var(--paper); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); }
.bd-pal[hidden] { display: none; }
.bd-pal .bd-cw { width: 24px; height: 24px; }
/* a desk shows every action on the bar; a phone keeps the rarer ones under «Ще» and steps through the sizes */
.bd-phone { display: none; }
.bd-sw { display: flex; align-items: center; gap: 4px; padding: 0 4px; }
/* every swatch has an edge of its own, in either look: white on a white bar, the dark one on a dark bar */
.bd-cw { --edge: rgba(15, 20, 25, .32); flex: none; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px var(--edge); cursor: pointer; }
:root[data-mode="dark"] .bd-cw { --edge: rgba(255, 255, 255, .5); }
.bd-cw.bd-c-none { background: var(--paper); }
.bd-cw.on { box-shadow: inset 0 0 0 1px var(--edge), 0 0 0 2px var(--paper), 0 0 0 4px var(--blue); }
.bd-sz { display: flex; gap: 1px; }
.bd-tz { width: 30px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.bd-b.bd-wide { width: auto; display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 13px; white-space: nowrap; }
.bd-lbl.sel { border-color: var(--blue); color: var(--blue); }
.bd-zt { min-width: 50px; padding: 0 4px; border: 0; background: none; color: var(--fg-muted); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; }
.bd-status { min-width: 0; max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-status.bad { color: var(--error-fg); }
.bd-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 14px; flex-wrap: wrap; margin: 8px 2px 0; }
.bd-hint { min-width: 0; }

/* the whole screen */
/* (over the rail and the bars of the app, under a dialog: the dialogs of the board open over it) */
.bd-card.bd-full { position: fixed; inset: 0; z-index: 75; margin: 0; border-radius: 0; border: 0; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); display: flex; flex-direction: column; }
.bd-card.bd-full .bd-wrap { flex: 1; height: auto; }
.bd-card.bd-full .bd-foot { display: none; }
html.bd-noscroll, html.bd-noscroll body { overflow: hidden; }

/* a phone: the tools along the bottom, what is selected along the top, the zoom on the side */
@media (max-width: 640px) {
  .bd-card { padding: 10px 10px 8px; }
  .bd-wrap { height: 62vh; height: 62svh; min-height: 360px; }
  .bd-tools { left: 8px; right: 8px; top: auto; bottom: 8px; transform: none; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .bd-tools::-webkit-scrollbar { display: none; }
  .bd-tools .bd-sep { width: 1px; height: 22px; margin: 0 3px; }
  .bd-b { width: 38px; height: 38px; }
  .bd-ctx { left: 8px; right: 8px; top: 8px; max-width: none; padding: 4px; }
  /* (on a phone the long buttons are their icons: the words are in their names for a long press and a reader) */
  .bd-b.bd-wide { width: 38px; padding: 0; justify-content: center; }
  .bd-b.bd-wide span { display: none; }
  .bd-pal { grid-template-columns: repeat(6, 30px); gap: 10px; }
  .bd-pal .bd-cw { width: 30px; height: 30px; }
  /* (two fingers zoom on a phone: the bar keeps undo, «show all» and «whole screen») */
  .bd-zoom { right: 8px; bottom: 64px; flex-direction: column; padding: 3px; }
  .bd-zoom .bd-zm { display: none; }
  .bd-zoom .bd-sep { width: 22px; height: 1px; margin: 3px auto; }
  .bd-desk, .bd-ctx .bd-sz.bd-desk { display: none; }
  .bd-b.bd-phone { display: grid; }
  .bd-zoom .bd-b { width: 34px; height: 34px; }
  .bd-status { max-width: 22ch; }
}
