/* Nástěnka (kolaborativní whiteboard). Layout nekonečného plátna v tokenech směru C.
   Vše žije uvnitř .bd-root, který vyplní #mainContent na celou plochu. */

.bd-root {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: inherit;
}

/* ── Nekonečné plátno ────────────────────────────────────────────────────────
   Tečkovaná mřížka je na viewportu; JS jí přepočítává background-size a -position
   z pan/zoom, takže vypadá nekonečně a škáluje se se zoomem. */
.bd-viewport {
  position: absolute;
  inset: 0;
  cursor: default;
  touch-action: none;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--bd-dot) 1.4px, transparent 1.6px);
  background-repeat: repeat;
}
:root { --bd-dot: rgba(255, 255, 255, 0.10); }
body.theme-light { --bd-dot: rgba(18, 23, 21, 0.11); }

.bd-viewport.is-pan { cursor: grab; }
.bd-viewport.is-panning { cursor: grabbing; }
.bd-viewport.tool-hand { cursor: grab; }
.bd-viewport.tool-sticky, .bd-viewport.tool-shape, .bd-viewport.tool-text { cursor: copy; }
.bd-viewport.tool-arrow { cursor: crosshair; }
.bd-viewport.tool-pen { cursor: crosshair; }
.bd-viewport.tool-highlighter { cursor: crosshair; }
.bd-viewport.tool-comment { cursor: crosshair; }
.bd-viewport.tool-eraser { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='13' cy='13' r='10' fill='rgba(150,150,150,0.28)' stroke='%23777' stroke-width='1.5'/%3E%3C/svg%3E") 13 13, crosshair; }

/* zvýrazňovač: průsvitný tah, ať prosvítá obsah pod ním.
   Tmavé téma: screen (barva se na tmavém rozzáří, nevymyje se do šeda).
   Světlé téma: multiply (klasický fix jako skutečný zvýrazňovač). */
.bd-hl { opacity: 0.5; }                                        /* tmavé: průhledné „barevné sklo" (předvídatelné na jakémkoli obsahu) */
body.theme-light .bd-hl { opacity: 0.5; mix-blend-mode: multiply; }   /* světlé: multiply jako skutečný fix na papíru */

/* Svět: transformovaný kontejner objektů. transform-origin 0 0. */
.bd-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  /* ŽÁDNÝ will-change: transform — na iOS WKWebView vytvoří „zamrzlou" GPU vrstvu,
     která se nepřekreslí, když do světa přibude objekt → uživatel nakreslí lísteček
     a nevidí ho, dokud neposune/nezoomne. Bez will-change se překresluje spolehlivě. */
  /* currentColor pro výchozí (nebarvené) šipky a pero = inkoust dle tématu appky */
  color: var(--text);
}

/* Vektorová vrstva (šipky + pero). Kreslí se ve world souřadnicích.
   POZOR: SVG s nulovou velikostí Chrome OŘÍZNE i s overflow:visible (Safari ne) →
   šipky byly v Chromu neviditelné. Proto obří plocha 100000×100000 se shodným
   viewBoxem (−50000…50000), takže user-coord = world-coord 1:1 a nic se neořízne. */
.bd-vec {
  position: absolute;
  left: -50000px;
  top: -50000px;
  width: 100000px;
  height: 100000px;
  overflow: visible;
  pointer-events: none;
}
.bd-vec .bd-hit { stroke: transparent; fill: none; pointer-events: stroke; cursor: pointer; }
.bd-vec .bd-vec-sel { pointer-events: none; }

/* ── Objekty ─────────────────────────────────────────────────────────────────
   Všechny objekty jsou absolutně umístěné ve world px (zoom 1). */
.bd-obj {
  position: absolute;
  box-sizing: border-box;
  --bd-c: #FFD966;
}
.bd-obj.is-selected { outline: 2px solid var(--brand); outline-offset: 1px; }
.bd-obj .bd-txt {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  overflow: hidden;
  font-family: inherit;
  text-align: center;
  color: #16110A;
  cursor: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  -webkit-user-select: text;
  user-select: text;
}
.bd-obj:not(.is-editing) .bd-txt { pointer-events: none; }
.bd-obj .bd-txt.is-editing, .bd-obj.is-editing .bd-txt { overflow: auto; }
/* Formátovaný text (rich) uvnitř karet */
.bd-txt a { color: #0b5; text-decoration: underline; pointer-events: auto; }
.bd-txt ul, .bd-txt ol { margin: 2px 0; padding-left: 1.35em; text-align: left; }
.bd-txt li { margin: 1px 0; }
.bd-txt b, .bd-txt strong { font-weight: 750; }
.bd-txt:empty::before { content: attr(data-ph); color: rgba(22, 17, 10, 0.34); }

/* Sticky note */
.bd-sticky {
  border-radius: 3px;
  box-shadow: 0 6px 16px -8px rgba(18, 23, 21, 0.4), 0 1px 2px rgba(18, 23, 21, 0.16);
  background: var(--bd-c);
  cursor: grab;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 20px;
}
.bd-sticky .bd-txt {
  flex: 1;
  min-height: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.bd-sticky .bd-author {
  position: absolute;
  left: 12px;
  bottom: 6px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(22, 17, 10, 0.5);
  pointer-events: none;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tvary */
.bd-shape { cursor: grab; }
.bd-shape .bd-shape-svg { position: absolute; inset: 0; overflow: visible; }
.bd-shape .bd-shape-fill { fill: var(--bd-c); stroke: rgba(18, 23, 21, 0.22); stroke-width: 1.5; }
.bd-shape .bd-txt {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 510; padding: 8px; color: #16110A;
}

/* Obrázek
   Žádná plocha pod obrázkem — průhledné PNG (logo, výřez) by pod sebou mělo šedý
   obdélník. Stín proto nedělá box-shadow (ten obkresluje rám prvku), ale
   drop-shadow: ten jde po skutečném obrysu, takže fotka má stín jako dřív a
   průhledný tvar dostane stín podle sebe. */
.bd-image {
  border-radius: 6px;
  overflow: hidden;
  background: transparent;
  filter: drop-shadow(0 5px 9px rgba(18, 23, 21, 0.34)) drop-shadow(0 1px 1px rgba(18, 23, 21, 0.18));
  cursor: grab;
}
.bd-image img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

/* Výběr tažením (marquee) + společný rámeček skupiny */
.bd-marquee {
  position: absolute; z-index: 6; pointer-events: none;
  border: 1px solid var(--brand);
  background: rgba(var(--brand-rgb), 0.10);
  border-radius: 2px;
}
.bd-groupbox {
  position: absolute; z-index: 4; pointer-events: none;
  border: 1.5px solid var(--brand); border-radius: 4px;
}

/* Rámeček (sekce) — pod objekty, s titulkem nad horní hranou */
.bd-frame {
  background: rgba(var(--tint-fg-rgb), 0.028);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: grab;
}
.bd-frame.is-selected { outline-offset: 2px; }
.bd-frame-title {
  position: absolute;
  left: 2px;
  top: -25px;
  max-width: 100%;
}
.bd-frame-title .bd-txt {
  text-align: left;
  color: var(--text-light);
  font-size: 13px;
  font-weight: 620;
  letter-spacing: -0.005em;
  width: 260px;
  max-width: 100%;
  height: 20px;
  padding: 0;
  cursor: inherit;
}

/* Text blok */
.bd-textblock { cursor: grab; height: auto; }
.bd-textblock .bd-txt {
  text-align: left;
  color: var(--text);
  font-size: 20px;
  font-weight: 560;
  line-height: 1.3;
  white-space: pre-wrap;
  word-break: break-word;
  display: block;
  height: auto;
  min-height: 1.3em;
  overflow: visible;
}

/* Úchyty pro změnu velikosti */
.bd-handle {
  position: absolute;
  width: 11px;
  height: 11px;
  background: var(--surface-100);
  border: 1.5px solid var(--brand);
  border-radius: 2px;
  z-index: 5;
}
.bd-handle.nw { cursor: nwse-resize; }
.bd-handle.ne { cursor: nesw-resize; }
.bd-handle.sw { cursor: nesw-resize; }
.bd-handle.se { cursor: nwse-resize; }

/* ── Levý panel nástrojů ─────────────────────────────────────────────────────*/
.bd-tools {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  background: var(--surface-100);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  box-shadow: 0 10px 30px -12px rgba(18, 23, 21, 0.3);
  z-index: 20;
  max-height: calc(100% - 24px);   /* na nízkých obrazovkách nepřetéct – radši scroll, ať jsou všechny nástroje dosažitelné */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.bd-tools::-webkit-scrollbar { display: none; }
.bd-tool {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: 10px;
  color: var(--text-light);
  cursor: pointer;
  transition: background var(--t-out) var(--ease), color var(--t-out) var(--ease);
}
.bd-tool:hover { background: var(--surface-200); color: var(--text); transition-duration: var(--t-in); }
.bd-tool.on { background: var(--brand); color: var(--brand-fg); }
.bd-tool .material-icons-outlined { font-size: 22px; }
.bd-tool-sep { height: 1px; background: var(--border-muted); margin: 4px 6px; }
.bd-tool.bd-act .material-icons-outlined { font-size: 20px; }
.bd-tool.disabled { opacity: .38; pointer-events: none; }

/* Barevný výběr (popover) */
.bd-colors {
  position: absolute;
  left: 70px;
  top: 50%;
  transform: translateY(-50%);   /* FIXNÍ pozice vedle nástrojů, svisle na střed (neposkakuje) */
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 132px;
  padding: 10px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 12px 34px -12px rgba(18, 23, 21, 0.35);
  z-index: 25;
}
.bd-swatch {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(18, 23, 21, 0.12);
}
.bd-swatch.on { border-color: var(--text); }

/* Volby tvaru / režimu trasy spojnice v popoveru */
.bd-shape-row, .bd-arrow-row { display: flex; }
.bd-shape-btn, .bd-mode-btn {
  flex: 1; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-default); background: var(--surface-100);
  border-radius: 7px; color: var(--text-light); cursor: pointer;
  transition: color var(--t-out) var(--ease), border-color var(--t-out) var(--ease);
}
.bd-shape-btn:hover, .bd-mode-btn:hover { color: var(--text); border-color: var(--border-strong); }
.bd-shape-btn.on, .bd-mode-btn.on { color: var(--brand); border-color: var(--brand); background: var(--brand-tint); }

/* Emoji / samolepky (popover) */
.bd-emoji {
  position: absolute;
  left: 70px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  width: 216px;
  padding: 8px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 12px 34px -12px rgba(18, 23, 21, 0.35);
  z-index: 26;
}
.bd-emoji-item {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 8px;
  font-size: 20px; line-height: 1; cursor: pointer;
  transition: background var(--t-out) var(--ease);
}
.bd-emoji-item:hover { background: var(--surface-200); }

/* Popisek uprostřed spojnice */
.bd-clabel {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: 240px;
  padding: 2px 7px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  background: var(--surface-100);
  border: 1px solid var(--border-default);
  border-radius: 7px;
  white-space: pre-wrap;
  pointer-events: none;
  box-shadow: 0 2px 8px -4px rgba(18, 23, 21, 0.3);
}
.bd-clabel.is-editing { pointer-events: auto; outline: 2px solid var(--brand); cursor: text; }

/* Kulaté úchyty na koncích šipky (přetáhnout / přepojit) */
.bd-handle.bd-ep {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface-100); border: 2px solid var(--brand);
  cursor: crosshair;
}

/* ── Přítomnost (avatary) vpravo nahoře ──────────────────────────────────────*/
.bd-topright {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 20;
}
.bd-cfilter {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-default);
  background: var(--surface-100);
  border-radius: 10px;
  color: var(--text-light);
  cursor: pointer;
  box-shadow: 0 2px 8px -4px rgba(18, 23, 21, 0.3);
  transition: color var(--t-out) var(--ease), border-color var(--t-out) var(--ease);
}
.bd-cfilter:hover { color: var(--text); border-color: var(--border-strong); }
.bd-cfilter.on { color: var(--brand); border-color: var(--brand); background: var(--brand-tint); }
.bd-cfilter .material-icons-outlined { font-size: 20px; }
.bd-presence {
  display: flex;
  align-items: center;
}
.bd-presence .bd-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  margin-left: -8px;
  border: 2px solid var(--surface-100);
  background: var(--surface-300);
  color: #fff;
  font-size: 12px; font-weight: 620;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 6px -2px rgba(18, 23, 21, 0.35);
}
.bd-presence .bd-av img { width: 100%; height: 100%; object-fit: cover; }

/* ── Živé kurzory ostatních ──────────────────────────────────────────────────*/
.bd-cursors { position: absolute; inset: 0; pointer-events: none; z-index: 18; overflow: hidden; }
.bd-cursor { position: absolute; left: 0; top: 0; }
.bd-cursor svg { display: block; filter: drop-shadow(0 1px 2px rgba(18, 23, 21, 0.3)); }
.bd-cursor .bd-cur-name {
  position: absolute;
  left: 14px; top: 16px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px; font-weight: 590;
  color: #fff;
  white-space: nowrap;
}

/* ── Komentáře (špendlíky + panel vlákna) ────────────────────────────────────*/
.bd-comments { position: absolute; inset: 0; pointer-events: none; z-index: 19; overflow: hidden; }
.bd-pin {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, -100%);
  min-width: 30px; height: 30px;
  padding: 0 6px;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  border: 0;
  border-radius: 14px 14px 14px 3px;
  color: #fff;
  font-size: 13px; font-weight: 640;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 3px 10px -3px rgba(18, 23, 21, 0.5);
  transition: transform var(--t-out) var(--ease);
}
.bd-pin:hover { transform: translate(-50%, -100%) scale(1.08); }
.bd-pin.active { outline: 2px solid #fff; outline-offset: 1px; }
.bd-pin.resolved { opacity: 0.5; }
.bd-pin.pending { opacity: 0.7; }
.bd-pin-n {
  font-size: 11px; font-weight: 700;
  background: rgba(255, 255, 255, 0.32);
  border-radius: 8px; padding: 0 5px; line-height: 16px;
}

.bd-cpanel {
  position: absolute;
  top: 14px; right: 16px; bottom: 14px;
  width: 320px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  box-shadow: 0 18px 48px -16px rgba(18, 23, 21, 0.45);
  z-index: 30;
  overflow: hidden;
}
.bd-cpanel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 12px 10px 16px;
  border-bottom: 1px solid var(--border-muted);
}
.bd-cpanel-title { font-size: 14px; font-weight: 660; color: var(--text); }
.bd-cpanel-actions { display: flex; align-items: center; gap: 2px; }
.bd-cbtn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 8px;
  color: var(--text-light); cursor: pointer;
  transition: background var(--t-out) var(--ease), color var(--t-out) var(--ease);
}
.bd-cbtn:hover { background: var(--surface-200); color: var(--text); }
.bd-cbtn.bd-cresolve:hover { color: var(--brand); }
.bd-cbtn .material-icons-outlined { font-size: 19px; }
.bd-cpanel-msgs { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 14px; }
.bd-cmsg { display: flex; gap: 9px; }
.bd-cmsg-av {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 640;
}
.bd-cmsg-main { min-width: 0; flex: 1; }
.bd-cmsg-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 1px; }
.bd-cmsg-author { font-size: 13px; font-weight: 620; color: var(--text); }
.bd-cmsg-time { font-size: 11px; color: var(--text-light); }
.bd-cmsg-body { font-size: 13.5px; line-height: 1.45; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.bd-cpanel-foot { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border-muted); }
.bd-cinput {
  flex: 1; resize: none;
  min-height: 38px; max-height: 120px;
  padding: 9px 11px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--surface-100);
  color: var(--text);
  font: inherit; font-size: 13.5px;
  outline: none;
}
.bd-cinput:focus { border-color: var(--brand); }
.bd-csend {
  flex: 0 0 auto; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px;
  background: var(--brand); color: var(--brand-fg);
  cursor: pointer;
}
.bd-csend:hover { filter: brightness(1.06); }
.bd-csend .material-icons-outlined { font-size: 19px; }

/* ── Ovládání zoomu vpravo dole ──────────────────────────────────────────────*/
.bd-zoom {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--surface-100);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 10px 30px -12px rgba(18, 23, 21, 0.3);
  z-index: 20;
}
.bd-zoom button {
  width: 34px; height: 34px;
  border: 0; background: transparent;
  color: var(--text-light); cursor: pointer;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.bd-zoom button:hover { background: var(--surface-200); color: var(--text); }
.bd-zoom .bd-zoom-val {
  min-width: 52px; text-align: center;
  font-size: 13px; font-weight: 560; color: var(--text);
  cursor: pointer; user-select: none;
}
.bd-zoom .material-icons-outlined { font-size: 20px; }

/* ── Prezentační tlačítko (top-right, jako filtr komentářů) ───────────────────*/
.bd-present-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-default);
  background: var(--surface-100);
  border-radius: 10px;
  color: var(--text-light);
  cursor: pointer;
  box-shadow: 0 2px 8px -4px rgba(18, 23, 21, 0.3);
  transition: color var(--t-out) var(--ease), border-color var(--t-out) var(--ease);
}
.bd-present-btn:hover { color: var(--brand); border-color: var(--brand); }
.bd-present-btn .material-icons-outlined { font-size: 20px; }

/* ── Minimapa (vpravo dole nad zoomem) ───────────────────────────────────────*/
.bd-minimap {
  position: absolute;
  right: 16px; bottom: 66px;
  width: 190px; height: 130px;
  background: var(--surface-100);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 10px 30px -12px rgba(18, 23, 21, 0.3);
  z-index: 20;
  overflow: hidden;
  transition: width var(--t-out) var(--ease), height var(--t-out) var(--ease);
}
.bd-mini-inner { position: absolute; inset: 0; cursor: pointer; touch-action: none; }
.bd-mini-inner i { position: absolute; display: block; box-sizing: border-box; }
.bd-mini-view {
  position: absolute; left: 0; top: 0;
  border: 1.5px solid var(--brand);
  background: var(--brand-tint);
  border-radius: 2px;
}
.bd-mini-toggle {
  position: absolute; top: 4px; right: 4px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: var(--surface-200); color: var(--text-light);
  border-radius: 7px; cursor: pointer; opacity: 0.7;
  transition: opacity var(--t-out) var(--ease);
}
.bd-mini-toggle:hover { opacity: 1; color: var(--text); }
.bd-mini-toggle .material-icons-outlined { font-size: 16px; }
.bd-minimap.collapsed { width: 38px; height: 38px; }
.bd-minimap.collapsed .bd-mini-inner, .bd-minimap.collapsed .bd-mini-view { display: none; }
.bd-minimap.collapsed .bd-mini-toggle { top: 6px; right: 6px; opacity: 1; }

/* ── Prezentační lišta ───────────────────────────────────────────────────────*/
.bd-present {
  position: absolute;
  left: 50%; bottom: 24px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
  padding: 7px 9px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: 0 16px 40px -14px rgba(18, 23, 21, 0.5);
  z-index: 60;
}
.bd-pv-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 10px;
  color: var(--text-light); cursor: pointer;
  transition: background var(--t-out) var(--ease), color var(--t-out) var(--ease);
}
.bd-pv-btn:hover { background: var(--surface-200); color: var(--text); }
.bd-pv-btn.disabled { opacity: 0.32; pointer-events: none; }
.bd-pv-btn .material-icons-outlined { font-size: 22px; }
.bd-pv-count { min-width: 54px; text-align: center; font-size: 13.5px; font-weight: 620; color: var(--text); font-variant-numeric: tabular-nums; }
.bd-pv-title { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-light); padding: 0 8px; }
.bd-pv-exit { margin-left: 4px; }
.bd-pv-exit:hover { background: var(--surface-200); color: var(--danger, #e0447c); }

/* Během prezentace uklidíme rozhraní (jen plátno + lišta). */
.bd-presenting .bd-tools,
.bd-presenting .bd-hint,
.bd-presenting .bd-minimap,
.bd-presenting .bd-topright,
.bd-presenting .bd-zoom,
.bd-presenting .bd-colors,
.bd-presenting .bd-comments,
.bd-presenting .bd-vote-banner,
.bd-presenting .bd-vote-layer,
.bd-presenting .bd-cpanel { display: none !important; }
/* během prezentace nejde plátno editovat (jen posun tažením řeší onPointerDown) */
.bd-presenting .bd-world { pointer-events: none; }
.bd-presenting .bd-viewport { cursor: grab; }
.bd-presenting .bd-viewport.is-panning { cursor: grabbing; }

/* ── Reakce (emoji) + časovač (top-right nástroje) ───────────────────────────*/
.bd-timer-btn, .bd-react-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-default);
  background: var(--surface-100);
  border-radius: 10px;
  color: var(--text-light);
  cursor: pointer;
  box-shadow: 0 2px 8px -4px rgba(18, 23, 21, 0.3);
  transition: color var(--t-out) var(--ease), border-color var(--t-out) var(--ease);
}
.bd-timer-btn:hover, .bd-react-btn:hover { color: var(--brand); border-color: var(--brand); }
.bd-react-btn.on { color: var(--brand); border-color: var(--brand); background: var(--brand-tint); }
.bd-timer-btn .material-icons-outlined, .bd-react-btn .material-icons-outlined { font-size: 20px; }
.bd-viewport.tool-react { cursor: crosshair; }

.bd-react-bar {
  position: absolute;
  top: 58px; right: 16px;
  display: flex; flex-wrap: wrap;
  gap: 2px; width: 224px;
  padding: 8px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 12px 34px -12px rgba(18, 23, 21, 0.35);
  z-index: 26;
}
.bd-react-item {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 8px;
  font-size: 20px; line-height: 1; cursor: pointer;
  transition: background var(--t-out) var(--ease);
}
.bd-react-item:hover { background: var(--surface-200); }

.bd-react-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 24; }
.bd-react {
  position: absolute; left: 0; top: 0;
  font-size: 34px; line-height: 1;
  will-change: transform, opacity;
  filter: drop-shadow(0 2px 4px rgba(18, 23, 21, 0.3));
  animation: bd-react-float 1.6s ease-out forwards;
}
@keyframes bd-react-float {
  0%   { transform: translate(calc(-50% + var(--rx, 0px)), -50%) scale(0.4); opacity: 0; }
  16%  { transform: translate(calc(-50% + var(--rx, 0px)), -60%) scale(1.18); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--rx, 0px)), -180px) scale(1); opacity: 0; }
}

/* ── Kontextová lišta výběru (plovoucí nad výběrem) ──────────────────────────*/
.bd-selbar {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, calc(-100% - 12px));
  display: flex; align-items: center; gap: 2px;
  padding: 4px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  box-shadow: 0 8px 24px -10px rgba(18, 23, 21, 0.45);
  z-index: 23;
}
.bd-sb-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 7px;
  color: var(--text-light); cursor: pointer;
  transition: background var(--t-out) var(--ease), color var(--t-out) var(--ease);
}
.bd-sb-btn:hover { background: var(--surface-200); color: var(--text); }
.bd-sb-del:hover { color: var(--danger, #e0447c); background: var(--surface-200); }
.bd-sb-btn .material-icons-outlined { font-size: 19px; }
.bd-sb-sep { width: 1px; height: 20px; background: var(--border-muted); margin: 0 3px; }

/* ── Formátovací lišta (rich-text) ───────────────────────────────────────────*/
.bd-richbar {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, calc(-100% - 12px));
  display: flex; align-items: center; gap: 2px;
  padding: 4px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  box-shadow: 0 8px 24px -10px rgba(18, 23, 21, 0.45);
  z-index: 24;
}
.bd-rb-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 7px;
  color: var(--text-light); cursor: pointer;
  transition: background var(--t-out) var(--ease), color var(--t-out) var(--ease);
}
.bd-rb-btn:hover { background: var(--surface-200); color: var(--text); }
.bd-rb-btn .material-icons-outlined { font-size: 19px; }

/* Okénko pro vložení odkazu */
.bd-linkbox {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 6px 6px 10px;
  width: 300px; max-width: calc(100vw - 24px);
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 12px 32px -12px rgba(18, 23, 21, 0.5);
  z-index: 25;
}
.bd-linkbox-ico { font-size: 18px; color: var(--text-light); flex: 0 0 auto; }
.bd-linkbox-input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--text);
  padding: 4px 2px;
}
.bd-linkbox-input::placeholder { color: var(--text-light); }
.bd-linkbox-ok {
  flex: 0 0 auto;
  border: 0; border-radius: 8px; cursor: pointer;
  background: var(--brand); color: var(--brand-fg);
  font-family: inherit; font-size: 13px; font-weight: 640;
  padding: 6px 12px;
  transition: filter var(--t-out) var(--ease);
}
.bd-linkbox-ok:hover { filter: brightness(1.06); }
.bd-linkbox-cancel {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 8px;
  color: var(--text-light); cursor: pointer;
}
.bd-linkbox-cancel:hover { background: var(--surface-200); color: var(--text); }
.bd-linkbox-cancel .material-icons-outlined { font-size: 18px; }

/* ── Myšlenková mapa (uzel = kompaktní lísteček) ──────────────────────────────*/
.bd-sticky.bd-mind {
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 4px 12px -6px rgba(18, 23, 21, 0.35), 0 1px 2px rgba(18, 23, 21, 0.14);
  border: 1px solid rgba(18, 23, 21, 0.10);
}
.bd-sticky.bd-mind .bd-txt {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  justify-content: center;
}

/* ── Šablony (picker) ────────────────────────────────────────────────────────*/
.bd-tpl-picker { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; }
.bd-tpl-backdrop { position: absolute; inset: 0; background: rgba(18, 23, 21, 0.5); }
.bd-tpl-panel {
  position: relative;
  width: 640px; max-width: calc(100vw - 32px); max-height: calc(100% - 40px);
  display: flex; flex-direction: column;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: 0 24px 60px -20px rgba(18, 23, 21, 0.6);
  overflow: hidden;
}
.bd-tpl-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-muted); font-size: 15px; font-weight: 660; color: var(--text); }
.bd-tpl-close, .bd-export-close { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 8px; color: var(--text-light); cursor: pointer; flex: 0 0 auto; }
.bd-tpl-close:hover, .bd-export-close:hover { background: var(--surface-200); color: var(--text); }
.bd-tpl-close .material-icons-outlined, .bd-export-close .material-icons-outlined { font-size: 20px; }
.bd-tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 16px; overflow-y: auto; }
.bd-tpl-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-default); background: var(--surface-100);
  border-radius: 12px; cursor: pointer;
  transition: border-color var(--t-out) var(--ease), transform var(--t-out) var(--ease);
}
.bd-tpl-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.bd-tpl-prev { height: 92px; background: var(--surface-200); border-radius: 8px; overflow: hidden; display: flex; }
.bd-tpl-name { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 580; color: var(--text); }
.bd-tpl-name .material-icons-outlined { font-size: 18px; color: var(--brand); }
@media (max-width: 768px) { .bd-tpl-grid { grid-template-columns: repeat(2, 1fr); } }

/* Okno exportu (náhled + uložení) */
.bd-export-modal { position: absolute; inset: 0; z-index: 42; display: flex; align-items: center; justify-content: center; }
.bd-export-panel {
  position: relative;
  width: 720px; max-width: calc(100vw - 32px); max-height: calc(100% - 40px);
  display: flex; flex-direction: column;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: 0 24px 60px -20px rgba(18, 23, 21, 0.6);
  overflow: hidden;
}
.bd-export-imgwrap { flex: 1; min-height: 0; overflow: auto; padding: 14px; display: flex; align-items: center; justify-content: center; background: var(--surface-200); }
.bd-export-img { max-width: 100%; max-height: 62vh; border-radius: 8px; box-shadow: 0 6px 20px -8px rgba(18, 23, 21, 0.5); }
.bd-export-foot { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border-muted); }
.bd-export-hint { flex: 1; font-size: 12px; color: var(--text-light); line-height: 1.35; }
.bd-export-save {
  flex: 0 0 auto; height: 40px; padding: 0 16px;
  display: flex; align-items: center; gap: 6px;
  border: 0; border-radius: 10px; background: var(--brand); color: var(--brand-fg);
  font-size: 13.5px; font-weight: 620; cursor: pointer;
}
.bd-export-save:hover { filter: brightness(1.06); }
.bd-export-save .material-icons-outlined { font-size: 18px; }
@media (max-width: 768px) { .bd-export-foot { flex-direction: column; align-items: stretch; } .bd-export-save { justify-content: center; } }

/* ── Hlasování (dot voting) ──────────────────────────────────────────────────*/
.bd-vote-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-default);
  background: var(--surface-100);
  border-radius: 10px;
  color: var(--text-light);
  cursor: pointer;
  box-shadow: 0 2px 8px -4px rgba(18, 23, 21, 0.3);
  transition: color var(--t-out) var(--ease), border-color var(--t-out) var(--ease);
}
.bd-vote-btn:hover { color: var(--brand); border-color: var(--brand); }
.bd-vote-btn.on { color: var(--brand); border-color: var(--brand); background: var(--brand-tint); }
.bd-vote-btn .material-icons-outlined { font-size: 20px; }

.bd-vote-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 22; }
.bd-votebadge {
  position: absolute; left: 0; top: 0;
  transform: translate(-40%, -40%);
  min-width: 24px; height: 24px;
  padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface-100);
  border-radius: 999px;
  background: var(--surface-300);
  color: var(--text);
  font-size: 12.5px; font-weight: 680;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px -3px rgba(18, 23, 21, 0.5);
}
.bd-votebadge.mine { background: var(--brand); color: var(--brand-fg); }
.bd-voting .bd-votebadge { pointer-events: auto; cursor: pointer; }
.bd-voting .bd-votebadge:hover { filter: brightness(1.08); }
.bd-voting .bd-viewport { cursor: pointer; }

.bd-vote-banner {
  position: absolute;
  left: 50%; top: 14px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 14px;
  background: var(--surface-overlay);
  border: 1px solid var(--brand);
  border-radius: 999px;
  box-shadow: 0 10px 30px -12px rgba(18, 23, 21, 0.4);
  z-index: 28;
  max-width: calc(100vw - 32px);
}
.bd-vote-banner .material-icons-outlined { font-size: 19px; color: var(--brand); }
.bd-vote-txt { font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-vote-txt b { font-variant-numeric: tabular-nums; }
.bd-vote-reset, .bd-vote-end {
  flex: 0 0 auto;
  height: 30px; padding: 0 12px;
  border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border-default); background: var(--surface-100); color: var(--text-light);
  transition: color var(--t-out) var(--ease), border-color var(--t-out) var(--ease);
}
.bd-vote-reset:hover { color: var(--danger, #e0447c); border-color: var(--danger, #e0447c); }
.bd-vote-end { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }
.bd-vote-end:hover { filter: brightness(1.06); }
.bd-voting .bd-timer-chip { top: 60px; }   /* ať se banner hlasování a čip časovače nepřekrývají nahoře uprostřed */
.bd-voting .bd-tools { pointer-events: none; opacity: 0.4; }   /* během hlasování se needituje → panel nástrojů neaktivní */

/* Odpočet – čip nahoře uprostřed (vidí ho všichni) */
.bd-timer-chip {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  box-shadow: 0 8px 24px -10px rgba(18, 23, 21, 0.4);
  color: var(--text);
  font-size: 15px; font-weight: 660;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  z-index: 27;
}
.bd-timer-chip .material-icons-outlined { font-size: 18px; color: var(--brand); }
.bd-timer-chip.paused { opacity: 0.65; }
.bd-timer-chip.done { animation: bd-timer-flash 0.7s ease-in-out 5; }
.bd-timer-chip.done .material-icons-outlined { color: inherit; }   /* ať ikona nezmizí (zelená na zelené) při flashi */
@keyframes bd-timer-flash {
  0%, 100% { background: var(--surface-overlay); color: var(--text); border-color: var(--border-default); }
  50% { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }
}

/* Panel časovače */
.bd-timer-panel {
  position: absolute;
  top: 58px; right: 16px;
  width: 240px;
  display: flex; flex-direction: column;
  padding: 14px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  box-shadow: 0 16px 44px -16px rgba(18, 23, 21, 0.45);
  z-index: 30;
}
.bd-timer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.bd-timer-title { font-size: 14px; font-weight: 660; color: var(--text); }
.bd-tp-close { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 7px; color: var(--text-light); cursor: pointer; }
.bd-tp-close:hover { background: var(--surface-200); color: var(--text); }
.bd-tp-close .material-icons-outlined { font-size: 18px; }
.bd-timer-big { text-align: center; font-size: 40px; font-weight: 680; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 1px; margin: 4px 0 12px; }
.bd-timer-presets { display: flex; gap: 6px; margin-bottom: 10px; }
.bd-tp-preset { flex: 1; height: 32px; border: 1px solid var(--border-default); background: var(--surface-100); border-radius: 8px; color: var(--text-light); font-size: 12.5px; font-weight: 560; cursor: pointer; transition: color var(--t-out) var(--ease), border-color var(--t-out) var(--ease); }
.bd-tp-preset:hover { color: var(--brand); border-color: var(--brand); }
.bd-timer-ctrls { display: flex; gap: 8px; }
.bd-tp-btn { flex: 1; height: 40px; display: flex; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.bd-tp-btn .material-icons-outlined { font-size: 18px; }
.bd-tp-start, .bd-tp-pause { background: var(--brand); color: var(--brand-fg); }
.bd-tp-start:hover, .bd-tp-pause:hover { filter: brightness(1.06); }
.bd-tp-reset { background: var(--surface-100); color: var(--text-light); border: 1px solid var(--border-default); }
.bd-tp-reset:hover { color: var(--text); border-color: var(--border-strong); }
.bd-tp-reset[disabled] { opacity: 0.4; pointer-events: none; }

/* ── Prázdný stav / nápověda ─────────────────────────────────────────────────*/
.bd-hint {
  position: absolute;
  left: 50%; bottom: 18px;               /* dole na střed — nahoře vpravo jsou bubliny/tlačítka */
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 320px));   /* nezasahovat do zoomu vpravo dole */
  padding: 7px 16px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  font-size: 12.5px; font-weight: 510;
  color: var(--text-light);
  text-align: center;
  box-shadow: 0 8px 22px -12px rgba(18, 23, 21, 0.3);
  z-index: 19;
  pointer-events: none;
}

/* Nástěnka na mobilu: čistá patra dole (zoom → nástroje → barvy), ať se nic nepřekrývá.
   safe-area zdola i shora (notch). */
@media (max-width: 768px) {
  /* Appka má dole vlastní tab bar (.mobile-tab-bar, výška var(--mobile-tab-height), z-index 1000).
     Spodní ovládání plátna MUSÍ být NAD ním, jinak zmizí za menu. */
  .bd-zoom { display: none; }    /* na dotyku se zoomuje prsty (pinch) → tlačítka zbytečná */
  .bd-tools {
    left: 8px; right: 8px;       /* plná šířka (ne left:50% — to omezí šířku na půlku a nástroje se zbytečně nakupí do mnoha řad) */
    top: auto;
    bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px) + 22px);   /* zoom je pryč → nástroje můžou níž */
    transform: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    max-width: none;
    max-height: none;            /* na mobilu se needituje svisle → zrušit desktop scroll */
    overflow: visible;
    border-radius: 14px;
  }
  .bd-tools .bd-tool-sep { display: none; }   /* v řádku je vodorovný oddělovač zbytečný */
  .bd-tool { width: 38px; height: 38px; }
  .bd-colors { left: 10px; right: 10px; top: auto; width: auto; transform: none; justify-content: center; bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px) + 186px); }
  .bd-emoji { left: 10px; right: 10px; top: auto; width: auto; transform: none; justify-content: center; bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px) + 186px); }
  .bd-cpanel { top: auto; left: 8px; right: 8px; width: auto; max-width: none; bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px) + 186px); height: 38vh; }
  .bd-timer-panel { top: auto; left: 8px; right: 8px; width: auto; bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px) + 186px); }
  .bd-minimap { display: none; }
  .bd-hint { display: none; }                 /* getting-started tip je pro desktop (myš/klávesy) */
  .bd-present { bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px) + 22px); }
  /* horní prvky pod notch (safe-area-top) */
  .bd-topright { top: calc(12px + env(safe-area-inset-top, 0px)); }
  .bd-timer-chip { top: calc(12px + env(safe-area-inset-top, 0px)); }
  .bd-react-bar { left: 8px; right: 8px; width: auto; justify-content: center; top: calc(56px + env(safe-area-inset-top, 0px)); }
  /* banner hlasování POD řádek tlačítek vpravo nahoře */
  .bd-vote-banner { top: calc(56px + env(safe-area-inset-top, 0px)); left: 8px; right: 8px; transform: none; width: auto; max-width: none; justify-content: center; }
  .bd-voting .bd-timer-chip { top: calc(102px + env(safe-area-inset-top, 0px)); }
}

/* Upozornění, že nástěnky se ve „Všech akcích" neslučují (objekty mají souřadnice,
   z několika nástěnek naráz by byla jedna přeplácaná). Sedí nad plátnem, neplave. */
.bd-kontext {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 6;
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; line-height: 1.4;
  background: var(--surface-100); border: 1px solid var(--border-default);
  box-shadow: var(--shadow-soft); color: var(--text-light); white-space: nowrap;
  max-width: calc(100vw - 40px); overflow: hidden; text-overflow: ellipsis;
}
.bd-kontext b { color: var(--text); font-weight: 620; }
