/* The Bots map (bot-map.js): the roster as a 2D grid. A quiet dotted ground
   you pan and zoom, bots as circles, folders as tinted regions, dotted lines
   between bots that talked in the last 24 hours.

   The look follows the platform's own habits: an 8pt rhythm, type that stays
   readable, colour used as a tint rather than a fill, hairlines and soft
   shadows, and motion that explains where things went. Every gap is
   guaranteed by the layout (bot-map.js), so nothing here ever needs to
   overlap. Colours come from the theme's tokens: light and dark follow. */

/* ---- The Bots page in map mode ----
   The map takes the whole page. Picking a bot slides its chat in from the
   right and the map folds down to a compact panel beside it; closing the chat
   lets the map grow back. One motion: the map's width, with the chat riding
   on its edge (its content is fixed-width and the map's is absolutely placed,
   so the reflow stays cheap; a scale would squash the map).
   Opening is the drawer; closing is instant (often Esc, and the chat has
   already gone, so a growing map would only sweep across an empty strip). */
/* The page around it stays put (heading, padding), and the list's control
   bar (team, List | Map, search, New) floats over the map's corner as a small
   island, every control exactly where it sat in the list: switching views
   moves nothing but what is under them. The map's own title and tools panels
   step aside for it. */
.bots-shell > .chat-list > .chat-list-head,
.bots-shell > .chat-list > .bots-view-switch-line,
.bots-shell > .chat-list > .chat-list-search {
  transition: padding 0.22s var(--ease-out);
}
.bots-shell.bots-map-mode {
  --bm-compact: clamp(300px, 32%, 420px);
  position: relative;
}
.bots-shell.bots-map-mode > .chat-list {
  position: absolute;
  z-index: 130;
  top: 12px;
  left: 12px;
  width: var(--bots-list-width, 300px) !important;
  height: auto;
  padding: 2px 0 4px;
  border: 1px solid var(--border-card);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  animation: bm-island-lift 0.24s var(--ease-out);
}
@keyframes bm-island-lift {
  from {
    transform: translate(-10px, -10px);
    border-color: transparent;
    box-shadow: 0 0 0 transparent;
  }
  to {
    transform: translate(0, 0);
    border-color: var(--border-card);
    box-shadow: var(--shadow-float);
  }
}
.bots-shell.bots-map-mode
  > .chat-list
  > :not(.chat-list-head):not(.bots-view-switch-line):not(.chat-list-search) {
  display: none;
}
.bots-shell.bots-map-mode > .chat-list > .chat-list-head {
  min-height: 46px;
  padding: 12px 14px 10px 16px;
  background: transparent;
  border-bottom: 0;
}
.bots-shell.bots-map-mode > .chat-list > .bots-view-switch-line {
  padding: 0 14px 10px;
}
.bots-shell.bots-map-mode > .chat-list > .chat-list-search {
  padding: 0 14px 12px;
  border-bottom: 0;
}
@media (prefers-reduced-motion: reduce) {
  .bots-shell > .chat-list > .chat-list-head,
  .bots-shell > .chat-list > .bots-view-switch-line,
  .bots-shell > .chat-list > .chat-list-search {
    transition: none;
  }
  .bots-shell.bots-map-mode > .chat-list {
    animation: none;
  }
}
.bots-shell.bots-map-mode .bm-title-panel,
.bots-shell.bots-map-mode .bm-tools-panel {
  visibility: hidden;
}
.bots-shell.bots-map-mode > .chat-list-resizer,
.bots-shell.bots-map-mode > .chat-mobile-list-backdrop {
  display: none;
}
.bots-shell.bots-map-mode > .bm-root {
  flex: 0 0 auto;
  width: 100%;
}
.bots-shell.bots-map-mode.bots-map-chat > .bm-root {
  width: var(--bm-compact);
  transition: width 0.36s var(--ease-drawer);
}
.bots-shell.bots-map-mode > .chat-work-area {
  flex: 0 0 auto;
  width: calc(100% - var(--bm-compact));
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 32px -28px rgba(26, 24, 43, 0.4);
}
.bots-shell.bots-map-mode:not(.bots-map-chat) > .chat-work-area {
  display: none;
}
/* The roster's own switch to the map. */
.chat-list-actions .bots-view-map {
  color: var(--text-muted);
}
.bot-folder-row .bot-folder-icon[style*='--folder-color'] {
  color: var(--folder-color);
}

/* The ground's dots follow the camera on every pan frame: registered as not
   inherited, so writing them restyles the stage alone, not every bot in it. */
@property --bm-dots {
  syntax: '<length>';
  inherits: false;
  initial-value: 28px;
}
@property --bm-dots-x {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}
@property --bm-dots-y {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}

.bm-root {
  --bm-ground: color-mix(in srgb, var(--surface-2) 45%, var(--surface));
  --bm-dot: rgba(26, 24, 43, 0.13);
  --bm-link: var(--accent);
  --bm-unread: #1084fe;
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
}
:root[data-theme='dark'] .bm-root {
  --bm-ground: #15141c;
  --bm-dot: rgba(255, 255, 255, 0.11);
}

.bm-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  outline: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background-color: var(--bm-ground);
  background-image: radial-gradient(circle at 1px 1px, var(--bm-dot) 1px, transparent 1.6px);
  background-size: var(--bm-dots, 28px) var(--bm-dots, 28px);
  background-position: var(--bm-dots-x, 0) var(--bm-dots-y, 0);
  /* Switched to from the list: the map fades in rather than cutting in. */
  transition: opacity 0.16s var(--ease-out);
}
@starting-style {
  .bm-stage {
    opacity: 0;
  }
}
/* A camera glide: the ground travels with the world above it. */
.bm-stage.is-gliding {
  transition:
    opacity 0.16s var(--ease-out),
    background-position 0.36s var(--ease-drawer),
    background-size 0.36s var(--ease-drawer);
}
/* The edges soften, so the map reads as wider than its window. */
.bm-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: radial-gradient(
    130% 100% at 50% 45%,
    transparent 68%,
    color-mix(in srgb, var(--bm-ground) 70%, transparent) 100%
  );
}
.bm-stage.is-panning,
.bm-stage.is-dragging {
  cursor: grabbing;
}
.bm-stage:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-ring);
}

.bm-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.bm-world.is-gliding {
  transition: transform 0.36s var(--ease-drawer);
}

.bm-bot,
.bm-zone,
.bm-pod,
.bm-region,
.bm-drop {
  position: absolute;
  left: 0;
  top: 0;
  transition:
    transform 0.3s var(--ease-out),
    opacity 0.2s ease;
}
/* Only a region changes size (as bots move in and out): it is absolutely
   placed with a few children, and a scale would stretch its frame. */
.bm-zone {
  transition:
    transform 0.3s var(--ease-out),
    width 0.3s var(--ease-out),
    height 0.3s var(--ease-out),
    opacity 0.2s ease;
}
/* A keyboard move: no glide, the next key press is already coming. */
.bm-stage.is-instant .bm-bot,
.bm-stage.is-instant .bm-zone,
.bm-stage.is-instant .bm-pod,
.bm-stage.is-instant .bm-region,
.bm-bot.is-new,
.bm-zone.is-new,
.bm-pod.is-new,
.bm-bot.is-dragging,
.bm-zone.is-dragging,
.bm-pod.is-dragging {
  transition: none;
}
.bm-tip[hidden],
.bm-drop[hidden],
.bm-empty[hidden],
.bm-region[hidden] {
  display: none;
}

/* ---- A bot: a circle in a 120px cell, its name under it ----
   8 clear, a 60px circle, 8, then up to two lines of name: the name keeps to
   its cell (104px of it), so two names side by side always have air. */
.bm-bot {
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 120px;
  height: 120px;
  padding-top: 8px;
  border-radius: 24px;
  outline: none;
  cursor: pointer;
  /* Only its circle and its name take the pointer: the rest of its cell lets
     a line passing through be pointed at, and the ground be dragged. */
  pointer-events: none;
}
.bm-disc,
.bm-bot-name {
  pointer-events: auto;
}
.bm-bot.is-dragging .bm-disc,
.bm-bot.is-dragging .bm-bot-name {
  pointer-events: none;
}
.bm-disc {
  --disc: color-mix(in srgb, var(--bot-tint, var(--text-faint)) 15%, var(--surface));
  --persona-eye: var(--disc);
  position: relative;
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--disc);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--bot-tint, var(--text-faint)) 30%, transparent),
    0 1px 2px rgba(26, 24, 43, 0.08),
    0 6px 14px -8px rgba(26, 24, 43, 0.35);
  transition:
    transform 0.15s var(--ease-out),
    box-shadow 0.15s ease,
    filter 0.2s ease;
}
/* The map's own card says who it is: no second, native tooltip from the avatar. */
.bm-disc .bot-avatar,
.bm-pod-face .bot-avatar {
  pointer-events: none;
}
.bm-disc .bot-avatar {
  width: var(--persona-size);
  height: var(--persona-size);
  font-size: calc(var(--persona-size) * 0.72);
}
.bm-disc.is-image .bot-avatar > img {
  border-radius: 50%;
}
/* The bot's own icon (its little 3D picture), on the circle's shoulder as in the list. */
.bm-disc .bot-avatar.has-icon::after {
  right: -15px;
  bottom: -13px;
  width: 27px;
  height: 27px;
}
.bm-disc.is-image .bot-avatar.has-icon::after {
  right: -6px;
  bottom: -5px;
}
@media (hover: hover) and (pointer: fine) {
  .bm-bot:hover .bm-disc {
    transform: translateY(-2px) scale(1.05);
    box-shadow:
      0 0 0 1.5px color-mix(in srgb, var(--bot-tint, var(--text-faint)) 55%, transparent),
      0 2px 4px rgba(26, 24, 43, 0.08),
      0 14px 22px -12px rgba(26, 24, 43, 0.45);
  }
}
/* Arrow keys walk focus across the map: it lifts at once, no lag behind the key. */
.bm-bot:focus-visible .bm-disc {
  transform: translateY(-2px) scale(1.05);
  box-shadow:
    0 0 0 1.5px color-mix(in srgb, var(--bot-tint, var(--text-faint)) 55%, transparent),
    0 2px 4px rgba(26, 24, 43, 0.08),
    0 14px 22px -12px rgba(26, 24, 43, 0.45);
  transition-duration: 0s;
}
.bm-bot-name {
  display: -webkit-box;
  flex-shrink: 0;
  max-width: 104px;
  margin-top: 8px;
  padding: 0 6px;
  overflow: hidden;
  border-radius: 8px;
  color: var(--text);
  /* Type holds its size a little as the map zooms out (--bm-label, 1 to 1.3). */
  font-size: calc(12.5px * var(--bm-label, 1));
  font-weight: 500;
  line-height: calc(16px * var(--bm-label, 1));
  letter-spacing: -0.005em;
  text-align: center;
  /* A halo of the ground, as a map label has, so a line passing under stays legible. */
  text-shadow:
    0 0 2px var(--bm-ground),
    0 0 2px var(--bm-ground),
    0 0 3px var(--bm-ground);
  overflow-wrap: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.bm-bot.is-unread .bm-bot-name {
  font-weight: 700;
}

/* The bot whose chat is open beside the map. */
.bm-bot.is-active .bm-disc {
  box-shadow:
    0 0 0 3px var(--bm-ground),
    0 0 0 5.5px var(--accent),
    0 12px 20px -10px rgba(255, 101, 35, 0.5);
}
.bm-bot.is-active .bm-bot-name {
  color: var(--accent-text);
  font-weight: 700;
}

/* Working: a ring that sweeps round it. */
.bm-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0 55%, var(--ok) 92%, transparent 100%);
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 3px),
    #000 calc(100% - 2.5px)
  );
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
}
.bm-bot.is-working .bm-ring {
  opacity: 1;
  animation: bm-spin 1.3s linear infinite;
}
@keyframes bm-spin {
  to {
    transform: rotate(360deg);
  }
}
.bm-bot.is-paused .bm-disc {
  filter: grayscale(0.9);
  opacity: 0.5;
}
.bm-bot.is-paused .bm-bot-name {
  color: var(--text-faint);
}
.bm-bot.has-error .bm-disc {
  box-shadow:
    0 0 0 2px var(--danger),
    0 0 0 6px var(--danger-soft),
    0 6px 14px -8px rgba(196, 35, 35, 0.45);
}
.bm-bot.has-error .bm-bot-name {
  color: var(--danger-text);
}

/* Selected (Ctrl/Cmd/Shift+click, or the rubber band): a ring and a tick. */
.bm-bot.is-selected .bm-disc {
  box-shadow:
    0 0 0 3px var(--bm-ground),
    0 0 0 5.5px var(--bm-unread),
    0 10px 18px -10px color-mix(in srgb, var(--bm-unread) 70%, transparent);
}
.bm-bot.is-selected .bm-disc::before {
  content: '';
  position: absolute;
  right: -5px;
  top: -5px;
  z-index: 2;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 8.4 2.6 2.6L12 5.4'/%3E%3C/svg%3E")
      center / 13px no-repeat,
    var(--bm-unread);
  box-shadow: 0 0 0 2.5px var(--bm-ground);
  animation: bm-tick 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes bm-tick {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
}
.bm-bot.is-selected .bm-bot-name {
  color: color-mix(in srgb, var(--bm-unread) 80%, var(--text));
  font-weight: 700;
}
/* The rubber band. */
.bm-marquee {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 98;
  border: 1.5px solid var(--bm-unread);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bm-unread) 10%, transparent);
  pointer-events: none;
}
.bm-marquee[hidden] {
  display: none;
}

/* Something new: a dot or numbered badge on its shoulder. */
.bm-badge {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bm-unread);
  box-shadow: 0 0 0 2.5px var(--bm-ground);
}
.bm-badge.is-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow:
    0 0 0 2.5px var(--bm-ground),
    0 2px 6px -2px rgba(26, 24, 43, 0.35);
}
.bm-disc > .bm-badge {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
}
.bm-disc > .bm-badge.is-count {
  top: -4px;
  left: -4px;
}
.bm-pod-card > .bm-badge.is-count {
  box-shadow: none;
}
.bm-badge.is-attention {
  background: var(--attention);
}
.bm-badge.is-error {
  background: var(--danger);
}
.bm-badge.is-muted {
  background: var(--text-faint);
}

/* Found, or not, by the search. */
.bm-bot.is-dim,
.bm-pod.is-dim {
  opacity: 0.22;
}
.bm-zone.is-dim .bm-zone-frame {
  opacity: 0.45;
}
.bm-bot.is-found .bm-disc {
  box-shadow:
    0 0 0 3px var(--bm-ground),
    0 0 0 5.5px var(--bm-unread);
}
/* The one a line under the pointer leads to. */
.bm-bot.is-partner .bm-disc {
  box-shadow:
    0 0 0 2px var(--bm-link),
    0 0 0 6px var(--accent-soft);
}
/* Flown to (from the search): one ring going out. */
.bm-bot.is-pinged .bm-disc::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid var(--bm-unread);
  animation: bm-ping 0.8s var(--ease-out);
  pointer-events: none;
}
@keyframes bm-ping {
  from {
    opacity: 0.9;
    transform: scale(0.9);
  }
  to {
    opacity: 0;
    transform: scale(1.9);
  }
}
/* ---- Picked up, carried, put down ----
   Pressed, a bot braces. Lifted, it pops out of its cell and grows (its face
   too, wide-eyed: bot-map.js changes its expression), leaves a shadow on the
   ground under it, and leans into the way it is carried. Put down, it lands
   with a squash and a puff; moved into a region, its neighbours hop. */
.bm-bot {
  /* One spring for all of it: a little past, then home. */
  --bm-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bm-bot.is-pressed .bm-disc {
  transform: scale(0.92);
  transition-duration: 0.12s;
}
.bm-bot.is-dragging {
  z-index: 95;
  pointer-events: none;
}
.bm-bot.is-held .bm-disc {
  transform: translateY(-14px) scale(1.24) rotate(var(--bm-lean, 0deg));
  /* It swings back upright past the middle when it stops. */
  transition:
    transform 0.32s var(--bm-spring),
    box-shadow 0.2s ease;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--bot-tint, var(--text-faint)) 70%, transparent),
    0 0 0 7px color-mix(in srgb, var(--bot-tint, var(--text-faint)) 16%, transparent),
    0 30px 34px -16px rgba(26, 24, 43, 0.55);
  animation: bm-pickup 0.42s var(--bm-spring);
}
@keyframes bm-pickup {
  0% {
    transform: translateY(0) scale(0.92);
  }
  45% {
    transform: translateY(-20px) scale(1.34, 1.22);
  }
  70% {
    transform: translateY(-12px) scale(1.2, 1.27);
  }
  100% {
    transform: translateY(-14px) scale(1.24);
  }
}
/* The face grows a little more than its circle, and wriggles while it is carried. */
.bm-bot.is-held .bm-disc .bot-avatar {
  animation:
    bm-face-pop 0.42s var(--bm-spring) both,
    bm-face-carry 0.9s ease-in-out 0.42s infinite;
}
@keyframes bm-face-pop {
  0% {
    transform: scale(1);
  }
  55% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1.14);
  }
}
@keyframes bm-face-carry {
  0%,
  100% {
    transform: scale(1.14) rotate(-4deg);
  }
  50% {
    transform: scale(1.17) rotate(4deg);
  }
}
/* Its shadow stays on the ground, small and soft, the higher it is held. */
.bm-bot::before {
  content: '';
  position: absolute;
  top: 66px;
  left: 50%;
  width: 46px;
  height: 12px;
  margin-left: -23px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(26, 24, 43, 0.32), transparent);
  opacity: 0;
  transform: scale(0.4);
  transition:
    opacity 0.2s ease,
    transform 0.3s var(--ease-out);
  pointer-events: none;
}
.bm-bot.is-held::before {
  opacity: 1;
  transform: scale(1);
}
/* Its name waits on the ground. */
.bm-bot.is-held .bm-bot-name {
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}
/* Held over somewhere it may not go: it shivers. */
.bm-bot.is-held.is-unsure .bm-disc {
  box-shadow:
    0 0 0 2px var(--danger),
    0 0 0 7px var(--danger-soft),
    0 30px 34px -16px rgba(196, 35, 35, 0.45);
}
.bm-bot.is-held.is-unsure .bm-disc .bot-avatar {
  animation: bm-shiver 0.16s linear infinite;
}
@keyframes bm-shiver {
  0%,
  100% {
    transform: scale(1.1) translateX(-1.5px);
  }
  50% {
    transform: scale(1.1) translateX(1.5px);
  }
}
/* Down: a squash, a stretch, and still. */
.bm-bot.is-landed .bm-disc {
  animation: bm-land 0.62s var(--ease-out);
}
@keyframes bm-land {
  0% {
    transform: translateY(-14px) scale(1.24);
  }
  30% {
    transform: translateY(3px) scale(1.2, 0.8);
  }
  52% {
    transform: translateY(-7px) scale(0.94, 1.1);
  }
  72% {
    transform: translateY(1px) scale(1.05, 0.95);
  }
  88% {
    transform: translateY(-1px) scale(0.99, 1.02);
  }
  100% {
    transform: none;
  }
}
.bm-bot.is-landed .bm-bot-name {
  animation: bm-name-in 0.4s var(--ease-out) 0.12s both;
}
@keyframes bm-name-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
/* Not allowed: back in its place, shaking its head. */
.bm-bot.is-refused .bm-disc {
  animation: bm-refuse 0.5s ease-in-out;
}
@keyframes bm-refuse {
  0%,
  100% {
    transform: none;
  }
  18% {
    transform: translateX(-7px) rotate(-7deg);
  }
  38% {
    transform: translateX(6px) rotate(6deg);
  }
  58% {
    transform: translateX(-4px) rotate(-4deg);
  }
  78% {
    transform: translateX(2px) rotate(2deg);
  }
}
/* A newcomer in the region: the ones already there hop, nearest first. */
.bm-bot.is-greeting .bm-disc {
  animation: bm-hop 0.5s var(--ease-out) var(--bm-hop-delay, 0ms) both;
}
@keyframes bm-hop {
  0%,
  100% {
    transform: none;
  }
  30% {
    transform: translateY(1px) scale(1.06, 0.92);
  }
  55% {
    transform: translateY(-10px) scale(0.96, 1.06);
  }
  80% {
    transform: translateY(0) scale(1.03, 0.97);
  }
}

/* The puff: a ring going out and a few sparks, where it left the ground and
   where it came down. */
.bm-burst {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 96;
  width: 0;
  height: 0;
  pointer-events: none;
}
.bm-burst-ring {
  position: absolute;
  top: -32px;
  left: -32px;
  width: 64px;
  height: 64px;
  border: 3px solid color-mix(in srgb, var(--bot-tint, var(--accent)) 75%, transparent);
  border-radius: 50%;
  animation: bm-burst-ring 0.6s var(--ease-out) both;
}
.bm-burst-land .bm-burst-ring {
  /* On the ground: flattened, wider. */
  top: -2px;
  animation-name: bm-burst-ground;
}
@keyframes bm-burst-ring {
  from {
    opacity: 0.9;
    transform: scale(0.7);
  }
  to {
    opacity: 0;
    transform: scale(1.9);
  }
}
@keyframes bm-burst-ground {
  from {
    opacity: 0.85;
    transform: scale(0.6, 0.22);
  }
  to {
    opacity: 0;
    transform: scale(2.3, 0.75);
  }
}
.bm-spark {
  position: absolute;
  top: calc(var(--s) / -2);
  left: calc(var(--s) / -2);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: var(--bot-tint, var(--accent));
  animation: bm-spark 0.65s var(--ease-out) both;
}
.bm-spark.is-accent {
  border-radius: 2px;
  background: var(--attention);
}
.bm-burst-land .bm-spark {
  top: calc(26px - var(--s) / 2);
  animation-duration: 0.75s;
}
@keyframes bm-spark {
  0% {
    opacity: 1;
    transform: rotate(var(--a)) translateX(22px) scale(0.4);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--a)) translateX(var(--d)) scale(1) rotate(90deg);
  }
}
/* "Joined Finance": a word that floats up from where it landed. */
.bm-float {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 97;
  width: 0;
  display: flex;
  justify-content: center;
  color: var(--text);
  font-size: calc(12px * var(--bm-label, 1));
  font-weight: 700;
  white-space: nowrap;
  text-shadow:
    0 0 3px var(--bm-ground),
    0 0 3px var(--bm-ground),
    0 0 6px var(--bm-ground);
  pointer-events: none;
  animation: bm-float 1.4s var(--ease-out) both;
}
@keyframes bm-float {
  0% {
    opacity: 0;
    translate: 0 8px;
    scale: 0.8;
  }
  18% {
    opacity: 1;
    translate: 0 -6px;
    scale: 1.06;
  }
  30% {
    scale: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    translate: 0 -34px;
  }
}

/* ---- A folder: a tinted region around what it holds ----
   Its frame sits 12px inside its cells, so two regions are never closer than
   24px; its title row is inside the frame, so nothing reaches a neighbour. */
.bm-zone {
  pointer-events: none;
}
.bm-zone-frame {
  position: absolute;
  inset: 12px;
  border: 1px solid color-mix(in srgb, var(--zone) 28%, transparent);
  border-radius: 24px;
  pointer-events: auto;
  background: color-mix(in srgb, var(--zone) 9%, var(--bm-ground));
  box-shadow:
    0 1px 2px rgba(26, 24, 43, 0.04),
    0 12px 28px -20px color-mix(in srgb, var(--zone) 55%, transparent);
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background-color 0.2s ease,
    opacity 0.2s ease;
}
/* A region inside a region reads a step stronger. */
.bm-zone.is-nested .bm-zone-frame {
  border-radius: 20px;
  background: color-mix(in srgb, var(--zone) 15%, var(--bm-ground));
}
/* The title row: the region's handle. 12 + 12 from the cell's edge, 24 tall. */
.bm-zone-head {
  position: absolute;
  top: 24px;
  right: 24px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  color: color-mix(in srgb, var(--zone) 58%, var(--text));
  font-size: calc(14px * var(--bm-label, 1));
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: grab;
  pointer-events: auto;
}
.bm-zone-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bm-swatch {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--zone);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--zone) 22%, transparent);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .bm-swatch:hover {
    transform: scale(1.25);
  }
}
.bm-zone-lock {
  display: inline-flex;
  flex-shrink: 0;
  opacity: 0.7;
}
.bm-zone-count {
  flex-shrink: 0;
  color: color-mix(in srgb, var(--zone) 40%, var(--text-faint));
  font-size: calc(12.5px * var(--bm-label, 1));
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.bm-zone-toggle {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  transition:
    opacity 0.15s ease,
    background-color 0.15s ease;
}
.bm-zone:hover > .bm-zone-head .bm-zone-toggle,
.bm-zone-toggle:focus-visible {
  opacity: 1;
}
.bm-zone-toggle:hover {
  background: color-mix(in srgb, var(--zone) 20%, transparent);
}
.bm-swatch:focus-visible,
.bm-zone-toggle:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}
.bm-glyph {
  display: inline-flex;
  width: 14px;
  height: 14px;
}
.bm-glyph svg {
  width: 100%;
  height: 100%;
}
.bm-zone-empty {
  position: absolute;
  inset: 60px 24px 24px;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--zone) 40%, var(--text-faint));
  font-size: 12.5px;
}
/* Something held over it would land inside. */
.bm-zone.is-drop-target .bm-zone-frame {
  border-color: color-mix(in srgb, var(--zone) 70%, transparent);
  background: color-mix(in srgb, var(--zone) 16%, var(--bm-ground));
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--zone) 18%, transparent),
    0 12px 28px -20px color-mix(in srgb, var(--zone) 55%, transparent);
}
.bm-zone.is-dragging {
  z-index: 80 !important;
}
.bm-zone.is-held .bm-zone-frame {
  box-shadow:
    0 2px 4px rgba(26, 24, 43, 0.06),
    0 32px 44px -24px rgba(26, 24, 43, 0.5);
}
.bm-zone.is-held .bm-zone-head {
  cursor: grabbing;
}
.bm-zone.is-held .bm-zone-frame {
  transform: scale(1.012);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bm-zone.is-landed .bm-zone-frame {
  animation: bm-zone-land 0.5s var(--ease-out);
}
@keyframes bm-zone-land {
  0% {
    transform: scale(1.012);
  }
  40% {
    transform: scale(0.992);
  }
  100% {
    transform: none;
  }
}
/* A bot just moved in: the region takes it in. */
.bm-zone.is-welcoming .bm-zone-frame {
  animation: bm-zone-welcome 0.65s var(--ease-out);
}
@keyframes bm-zone-welcome {
  0% {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--zone) 45%, transparent),
      0 12px 28px -20px color-mix(in srgb, var(--zone) 55%, transparent);
  }
  35% {
    background: color-mix(in srgb, var(--zone) 20%, var(--bm-ground));
    transform: scale(1.008);
  }
  100% {
    box-shadow:
      0 0 0 14px color-mix(in srgb, var(--zone) 0%, transparent),
      0 12px 28px -20px color-mix(in srgb, var(--zone) 55%, transparent);
    transform: none;
  }
}

/* A collapsed region: a pod, two cells wide, with the same 12px of air. */
.bm-pod {
  z-index: 20;
  display: grid;
  place-items: center;
  outline: none;
  cursor: pointer;
}
.bm-pod-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 216px;
  height: 72px;
  padding: 0 12px 0 14px;
  border: 1px solid color-mix(in srgb, var(--zone) 30%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--zone) 12%, var(--surface));
  /* Two more cards under it: there is more inside. */
  box-shadow:
    0 5px 0 -2px color-mix(in srgb, var(--zone) 20%, var(--bm-ground)),
    0 10px 0 -4.5px color-mix(in srgb, var(--zone) 12%, var(--bm-ground)),
    0 18px 24px -18px color-mix(in srgb, var(--zone) 60%, transparent);
  transition:
    transform 0.2s var(--ease-out),
    box-shadow 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .bm-pod:hover .bm-pod-card {
    transform: translateY(-2px);
  }
}
.bm-pod:focus-visible .bm-pod-card {
  transform: translateY(-2px);
}
.bm-pod:focus-visible .bm-pod-card {
  outline: var(--focus-outline);
  outline-offset: 3px;
}
.bm-pod-stack {
  display: flex;
  flex-shrink: 0;
  padding-left: 10px;
}
.bm-pod-face {
  --disc: color-mix(in srgb, var(--bot-tint, var(--text-faint)) 18%, var(--surface));
  --persona-eye: var(--disc);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: -10px;
  border-radius: 50%;
  background: var(--disc);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--zone) 12%, var(--surface));
}
.bm-pod-face .bot-avatar {
  width: var(--persona-size);
  height: var(--persona-size);
  font-size: calc(var(--persona-size) * 0.72);
}
.bm-pod-face.is-empty {
  border: 1.5px dashed color-mix(in srgb, var(--zone) 45%, transparent);
  background: transparent;
  box-shadow: none;
}
.bm-pod-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.bm-pod-name {
  overflow: hidden;
  color: color-mix(in srgb, var(--zone) 58%, var(--text));
  font-size: calc(13px * var(--bm-label, 1));
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-pod-count {
  overflow: hidden;
  color: var(--text-muted);
  font-size: calc(11.5px * var(--bm-label, 1));
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-pod-open {
  display: inline-flex;
  flex-shrink: 0;
  color: color-mix(in srgb, var(--zone) 50%, var(--text-muted));
}
.bm-pod.is-working .bm-pod-card::after {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2.5px var(--bm-ground);
  animation: bm-blink 1.4s ease-in-out infinite;
}
.bm-pod.is-dragging {
  z-index: 90;
  pointer-events: none;
}
.bm-pod.is-pressed .bm-pod-card {
  transform: scale(0.97);
}
.bm-pod.is-held .bm-pod-card {
  transform: translateY(-8px) scale(1.06) rotate(var(--bm-lean, 0deg));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bm-pod.is-landed .bm-pod-card {
  animation: bm-pod-land 0.5s var(--ease-out);
}
@keyframes bm-pod-land {
  0% {
    transform: translateY(-8px) scale(1.06);
  }
  40% {
    transform: translateY(2px) scale(1.03, 0.95);
  }
  70% {
    transform: translateY(-2px) scale(0.99, 1.02);
  }
  100% {
    transform: none;
  }
}
@keyframes bm-blink {
  50% {
    opacity: 0.35;
  }
}

/* The two sides' names: a title, a quiet count. */
.bm-region {
  z-index: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
  pointer-events: none;
}
.bm-region-name {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.bm-region-count,
.bm-region-note {
  color: var(--text-faint);
  font-size: 12.5px;
}
.bm-region-note::before {
  content: '·';
  margin-right: 10px;
}

/* ---- Lines between bots that talked in the last 24 hours ---- */
.bm-links {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 40;
  overflow: visible;
  pointer-events: none;
}
.bm-link {
  transition: opacity 0.2s ease;
}
.bm-link.is-lifted {
  opacity: 0;
  transition: none;
}
.bm-link path {
  fill: none;
  stroke-linecap: round;
}
.bm-link-glow {
  stroke: var(--bm-link);
  stroke-width: 10;
  opacity: 0.09;
}
/* Dots that travel from whoever wrote last. */
.bm-link-dots {
  stroke: var(--bm-link);
  stroke-width: var(--bm-link-w, 3.4);
  stroke-dasharray: 0.1 11;
  opacity: 0.62;
  animation: bm-flow 2.2s linear infinite;
}
.bm-link.is-fresh .bm-link-dots {
  opacity: 0.95;
  animation-duration: 0.9s;
}
.bm-link.is-fresh .bm-link-glow {
  opacity: 0.16;
}
/* Both wrote: the dots go back and forth. */
.bm-link.is-two-way .bm-link-dots {
  animation: bm-flow-both 3.2s ease-in-out infinite alternate;
}
.bm-link-hit {
  stroke: transparent;
  stroke-width: 20;
  pointer-events: stroke;
  cursor: pointer;
}
/* The ground moving under the pointer repaints the lines anyway: the dots wait. */
.bm-stage.is-panning .bm-link-dots,
.bm-stage.is-dragging .bm-link-dots {
  animation-play-state: paused;
}
@keyframes bm-flow {
  to {
    stroke-dashoffset: -11.1;
  }
}
@keyframes bm-flow-both {
  from {
    stroke-dashoffset: 22.2;
  }
  to {
    stroke-dashoffset: -22.2;
  }
}
.bm-stage.has-lit .bm-link:not(.is-lit) {
  opacity: 0.2;
}
.bm-link.is-lit .bm-link-dots {
  opacity: 1;
  stroke-width: calc(var(--bm-link-w, 3.4) + 1.2);
}
.bm-link.is-lit .bm-link-glow {
  opacity: 0.3;
}

/* Where what you hold would land. */
.bm-drop {
  z-index: 55;
  pointer-events: none;
  transition: transform 0.09s ease-out;
}
.bm-drop::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 2px dashed var(--accent);
  border-radius: 24px;
  background: var(--accent-soft);
}
.bm-drop:not(.is-bad)::before {
  animation: bm-slot 0.9s ease-in-out infinite;
}
@keyframes bm-slot {
  50% {
    transform: scale(0.94);
    opacity: 0.75;
  }
}
.bm-drop.is-bad::before {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.bm-drop-why {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  max-width: 260px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: var(--text-inverse);
  font-size: 11.5px;
  transform: translateX(-50%);
  white-space: nowrap;
}
.bm-drop-why:empty {
  display: none;
}

/* ---- Controls: panels of the page's own material, floating over the map,
   16px in from its edges ---- */
.bm-hud {
  position: absolute;
  z-index: 120;
  cursor: default;
}
.bm-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: var(--shadow-float);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  pointer-events: auto;
}
.bm-hud-top {
  top: 16px;
  right: 16px;
  left: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
/* The page's voice orb keeps its corner. */
.content-wrap:has(.lm-voice-orb, .voice-orb) .bm-hud-top {
  right: 72px;
}
.bm-title-panel {
  flex-wrap: wrap;
  padding-left: 16px;
}
.bm-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
}
.bm-view-switch {
  padding: 2px;
}
.bm-view-switch .seg-btn {
  height: 26px;
  padding: 0 12px;
  font-size: 12.5px;
}
.bm-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-right: 6px;
}
.bm-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bm-chip::before {
  content: '';
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.bm-chip.is-working {
  background: var(--ok-soft);
  color: var(--ok-text);
}
.bm-chip.is-working::before {
  display: block;
  background: var(--ok);
}
.bm-chip.is-unread {
  background: color-mix(in srgb, var(--bm-unread) 12%, transparent);
  color: color-mix(in srgb, var(--bm-unread) 78%, var(--text));
}
.bm-chip.is-unread::before {
  display: block;
  background: var(--bm-unread);
}
.bm-chip.is-links {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.bm-tools-panel {
  flex-shrink: 0;
}
.bm-search {
  width: 176px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-pill);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  user-select: text;
  -webkit-user-select: text;
}
.bm-search:focus {
  border-color: var(--accent-hover);
  box-shadow: var(--focus-ring);
  outline: none;
}
.bm-hud-bottom {
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.bm-zoom {
  gap: 2px;
  padding: 4px;
}
.bm-icon-btn,
.bm-zoom-label {
  display: grid;
  place-items: center;
  height: 28px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
}
.bm-icon-btn {
  width: 28px;
}
.bm-zoom-label {
  min-width: 48px;
  padding: 0 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.bm-icon-btn:hover,
.bm-zoom-label:hover {
  background: var(--hover);
  color: var(--text);
}
.bm-icon-btn:focus-visible,
.bm-zoom-label:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 1px;
}
.bm-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--text-muted);
  font-size: 11.5px;
  white-space: nowrap;
}
.bm-legend-line {
  position: relative;
  width: 30px;
  height: 4px;
  overflow: hidden;
}
.bm-legend-line::before {
  content: '';
  position: absolute;
  inset: 0 -8px 0 0;
  background: radial-gradient(circle at 2px 2px, var(--bm-link) 1.7px, transparent 2.2px) 0 0 / 8px
    4px repeat-x;
  animation: bm-legend 0.9s linear infinite;
}
@keyframes bm-legend {
  to {
    transform: translateX(-8px);
  }
}

/* The minimap: the whole map, and the part you are looking at. */
.bm-minimap {
  right: 16px;
  bottom: 16px;
  width: 190px;
  height: 126px;
  padding: 6px;
  border-radius: 18px;
  cursor: crosshair;
}
.bm-minimap-svg {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
}
.bm-minimap-zone {
  fill: color-mix(in srgb, var(--zone) 30%, transparent);
  stroke: color-mix(in srgb, var(--zone) 75%, transparent);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}
.bm-minimap-bot {
  fill: var(--text-muted);
}
.bm-minimap-bot.is-working {
  fill: var(--ok);
}
.bm-minimap-bot.is-active {
  fill: var(--accent);
}
.bm-minimap-view {
  fill: color-mix(in srgb, var(--accent) 9%, transparent);
  stroke: var(--accent);
  stroke-width: 1.5px !important;
  vector-effect: non-scaling-stroke;
}

/* A bot's (or a line's) hover card. */
.bm-tip {
  position: absolute;
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: max-content;
  max-width: 270px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
  animation: bm-tip-in 0.14s var(--ease-out);
}
/* One card soon after another (sweeping across bots): no delay, no entrance. */
.bm-tip.is-warm {
  animation: none;
}
@keyframes bm-tip-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
.bm-tip-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.bm-tip-title {
  color: var(--text-muted);
}
.bm-tip-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.bm-tip-links {
  margin-top: 3px;
  color: var(--accent-text);
}

/* A region's colours. */
.bm-popover {
  position: absolute;
  z-index: 140;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 204px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  cursor: default;
}
.bm-popover-title {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bm-colours {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.bm-colour,
.bm-colour-custom {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--zone);
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .bm-colour:hover:not(:disabled) {
    transform: scale(1.18);
  }
}
.bm-colour.is-current {
  box-shadow: 0 0 0 2px var(--text);
}
.bm-colour:disabled,
.bm-colour-custom:disabled {
  cursor: not-allowed;
  opacity: var(--disabled-opacity);
}
.bm-colour:focus-visible,
.bm-colour-custom:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}
.bm-colour-custom {
  overflow: hidden;
  background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #14b8a6, #6366f1, #ec4899, #f43f5e);
}
.bm-colour-custom::-webkit-color-swatch-wrapper,
.bm-colour-custom::-webkit-color-swatch {
  opacity: 0;
}
.bm-colour-custom::-moz-color-swatch {
  opacity: 0;
}
.bm-colour-auto {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.bm-colour-auto:disabled {
  color: var(--text-faint);
  cursor: default;
}
.bm-popover-note {
  color: var(--text-faint);
  font-size: 11.5px;
  line-height: 1.35;
}

/* (The legend steps aside for it.) */
.bm-stage.has-selection .bm-legend {
  visibility: hidden;
}
/* Several selected: what to do with them, bottom centre. */
.bm-selection {
  bottom: 16px;
  left: 50%;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  transform: translateX(-50%);
  white-space: nowrap;
  animation: bm-selection-in 0.24s var(--ease-out);
}
.bm-selection[hidden] {
  display: none;
}
.bm-selection-count {
  margin-right: 4px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
@keyframes bm-selection-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
}

/* A line's card: who wrote to whom, how often, and what was last said. A
   click on the line keeps it open (then it takes the pointer). */
.bm-tip.is-link {
  gap: 8px;
  width: 320px;
  max-width: min(320px, calc(100% - 24px));
}
.bm-tip.is-pinned {
  pointer-events: auto;
  cursor: default;
  user-select: text;
  -webkit-user-select: text;
  border-color: color-mix(in srgb, var(--bm-link) 45%, var(--border-strong));
}
.bm-tip-ways {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}
.bm-tip-way {
  display: flex;
  flex-direction: column;
}
.bm-tip-way + .bm-tip-way {
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.bm-tip-way-names {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-tip-way-count {
  color: var(--text-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.bm-tip-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bm-tip-message {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 10px;
  border-left: 2px solid color-mix(in srgb, var(--bm-link) 45%, transparent);
}
.bm-tip-message-head {
  color: var(--text-muted);
  font-size: 11.5px;
}
.bm-tip-message-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.bm-tip.is-pinned .bm-tip-message-text {
  -webkit-line-clamp: 6;
  line-clamp: 6;
}
.bm-tip-message-text.is-private {
  color: var(--text-faint);
  font-style: italic;
}
.bm-tip-note {
  color: var(--text-faint);
  font-size: 11.5px;
}
.bm-tip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bm-tip-open {
  max-width: 100%;
  padding: 5px 12px;
  overflow: hidden;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.bm-tip-open:hover {
  background: var(--surface-2);
}
.bm-tip-open:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* ---- Beside a chat: the compact map ----
   Its controls step back; one button brings the whole map back. */
.bm-drawer-close {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 125;
  display: none;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: var(--shadow-float);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.bm-root.has-chat .bm-drawer-close {
  display: inline-flex;
}
.bm-root.has-chat .bm-hud-top,
.bm-root.has-chat .bm-hud-bottom,
.bm-root.has-chat .bm-minimap {
  display: none;
}
.bm-drawer-close:hover {
  background: var(--surface);
}
.bm-drawer-close:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

.bm-empty {
  position: absolute;
  inset: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  cursor: default;
}
.bm-empty h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
}
.bm-empty p {
  max-width: 340px;
  margin: 0 0 6px;
  color: var(--text-muted);
}

/* Far out, names give way: the regions' titles carry the map. */
.bm-stage.is-far .bm-bot-name,
.bm-stage.is-far .bm-region-note {
  visibility: hidden;
}

/* A narrow window: the map keeps a rail to come back by, the chat has the rest. */
@media (max-width: 900px) {
  .bots-shell.bots-map-mode {
    --bm-compact: 68px;
  }
  .bm-root.has-chat .bm-world {
    visibility: hidden;
  }
  .bm-root.has-chat .bm-drawer-close {
    left: 14px;
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }
  .bm-root.has-chat .bm-drawer-close-label {
    display: none;
  }
  .bm-legend,
  .bm-minimap,
  .bm-stats {
    display: none;
  }
}

/* Less motion: nothing travels, grows or bounces; what fades still fades. */
@media (prefers-reduced-motion: reduce) {
  .bots-shell.bots-map-mode > .bm-root,
  .bm-bot,
  .bm-bot::before,
  .bm-bot-name,
  .bm-zone,
  .bm-pod,
  .bm-region,
  .bm-drop,
  .bm-world.is-gliding,
  .bm-disc,
  .bm-pod-card,
  .bm-swatch,
  .bm-colour,
  .bm-bot.is-held .bm-disc,
  .bm-bot.is-held .bm-bot-name,
  .bm-zone.is-held .bm-zone-frame,
  .bm-pod.is-held .bm-pod-card {
    transition: none;
  }
  .bm-stage,
  .bm-stage.is-gliding {
    transition: opacity 0.16s ease;
  }
  .bm-ring,
  .bm-link-dots,
  .bm-legend-line::before,
  .bm-pod-card::after,
  .bm-bot.is-selected .bm-disc::before,
  .bm-bot.is-pinged .bm-disc::after,
  .bm-bot.is-landed .bm-disc,
  .bm-bot.is-landed .bm-bot-name,
  .bm-bot.is-held .bm-disc,
  .bm-bot.is-held .bm-disc .bot-avatar,
  .bm-bot.is-refused .bm-disc,
  .bm-bot.is-greeting .bm-disc,
  .bm-zone.is-landed .bm-zone-frame,
  .bm-zone.is-welcoming .bm-zone-frame,
  .bm-pod.is-landed .bm-pod-card,
  .bm-drop::before {
    animation: none !important;
  }
  .bm-tip:not(.is-warm),
  .bm-selection {
    animation: bm-fade 0.15s ease;
  }
  .bm-bot.is-working .bm-ring {
    background: var(--ok);
  }
}
@keyframes bm-fade {
  from {
    opacity: 0;
  }
}
