:root {
  --accent: #5b5bd6;
  --accent-ink: #4b4bc4;
  --accent-soft: #eeeefb;
  --line: #e4e7ee;
  --line-strong: #d5dae3;
  --ink: #1f2532;
  --muted: #808898;
  --panel: rgba(255, 255, 255, 0.93);
  --shadow-panel: 0 8px 30px -14px rgba(20, 27, 47, 0.35);
  --shadow-node: 0 1px 2px rgba(20, 27, 47, 0.05), 0 10px 26px -16px rgba(20, 27, 47, 0.3);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: #f4f5f7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

button, input { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app {
  position: fixed;
  inset: 0;
}

.hidden { display: none !important; }

/* ---------------------------------------------------------------- canvas */

.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background-color: #f4f5f7;
  background-image: radial-gradient(circle, #d4d8e0 1px, transparent 1.1px);
  background-size: 24px 24px;
}
.viewport.panning, .viewport.dragging { cursor: grabbing; }
.viewport.space { cursor: grab; }
.viewport.connecting { cursor: crosshair; }

.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
}

.nodes, .regions {
  position: absolute;
  left: 0;
  top: 0;
}

.edge-layer,
.guide-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

/* Low-detail (LOD) canvas: viewport-space snapshot of the whole board shown
   instead of thousands of DOM nodes at low zoom / high node counts. */
.lod-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Skip per-node mount animations while LOD is virtualising aggressively. */
.lod-mode .node { animation: none; }

.edge-path {
  fill: none;
  stroke: #b7becc;
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke 0.12s ease;
}
.edge-path.selected {
  stroke: var(--accent);
  stroke-width: 2.4;
}
.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
  cursor: pointer;
}
.edge-hit:hover + .edge-path { stroke: #8a90e8; }

.edge-preview {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 6 6;
  stroke-linecap: round;
  opacity: 0.85;
}
.edge-preview.hidden { display: none; }

.guide-line {
  stroke: #f26d9e;
  stroke-width: 1;
  stroke-dasharray: 4 4;
  shape-rendering: crispEdges;
}

.marquee {
  position: absolute;
  border: 1px solid rgba(91, 91, 214, 0.7);
  background: rgba(91, 91, 214, 0.07);
  border-radius: 4px;
  pointer-events: none;
  z-index: 9;
}
.marquee.right-drag {
  border: 1.5px dashed #0e9f8a;
  background: rgba(14, 159, 138, 0.1);
  box-shadow: 0 0 0 1px rgba(14, 159, 138, 0.18) inset;
}
.viewport.right-selecting { cursor: crosshair; }
.viewport.right-selecting .node,
.viewport.right-selecting .region { cursor: crosshair; }

/* --------------------------------------------------------------- regions */

.region {
  position: absolute;
  z-index: 0;
  border: 1.5px solid #b3cff2;
  border-radius: 16px;
  background: rgba(220, 235, 255, 0.42);
  cursor: grab;
  pointer-events: none;
  animation: node-in 0.18s ease-out;
}
.region.selected { outline: 2px solid var(--accent); outline-offset: 3px; }
.region.editing { cursor: default; }

.region-label {
  position: absolute;
  top: -12px;
  left: 13px;
  max-width: calc(100% - 46px);
  padding: 3px 9px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid rgba(20, 27, 47, 0.08);
  box-shadow: 0 2px 6px rgba(20, 27, 47, 0.07);
  color: #3b4252;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  user-select: none;
  pointer-events: auto;
}
.region-label[data-empty="true"]::before {
  content: attr(data-placeholder);
  color: rgba(59, 66, 82, 0.4);
}
.region.editing .region-label {
  cursor: text;
  user-select: text;
  outline: none;
  border-color: var(--accent);
  overflow: visible;
  text-overflow: clip;
  max-width: 82%;
}

.region-grip {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.region-grip::before {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 9px;
  height: 9px;
  border-right: 2px solid rgba(70, 80, 100, 0.42);
  border-bottom: 2px solid rgba(70, 80, 100, 0.42);
  border-radius: 0 0 3px 0;
}
.region.selected .region-grip { opacity: 1; pointer-events: auto; }

.region-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: #6d7486;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  box-shadow: 0 2px 6px rgba(20, 27, 47, 0.12);
}
.region.selected .region-close { opacity: 1; pointer-events: auto; }
.region-close:hover { background: #fdecec; color: #c4433a; border-color: #f2c9c6; }
.region.editing .region-close,
.region.editing .region-grip { opacity: 0 !important; pointer-events: none !important; }

/* ----------------------------------------------------------------- nodes */

.node {
  position: absolute;
  border-radius: 14px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  animation: node-in 0.16s ease-out;
}
@keyframes node-in {
  from { opacity: 0; transform: translateY(4px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.node-note {
  padding: 15px 17px 16px;
  background: #fff1b8;
  border: 1px solid #efd98a;
  color: #3d3520;
  box-shadow: var(--shadow-node);
}
.node-note::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.node-text {
  padding: 4px 8px;
  background: transparent;
  color: #2c313b;
  font-size: 21px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.2px;
}

.node:hover { z-index: 2; }
.node.selected { z-index: 3; outline: 2px solid var(--accent); outline-offset: 2px; }
.node-text.selected { outline-offset: 4px; border-radius: 6px; }

.node-content {
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 1.45em;
  cursor: inherit;
}
.node-note .node-content { font-size: 15px; line-height: 1.6; }
.node-content[data-empty="true"]::before {
  content: attr(data-placeholder);
  color: rgba(40, 34, 20, 0.3);
  pointer-events: none;
}
.node-text .node-content[data-empty="true"]::before { color: rgba(44, 49, 59, 0.28); }

.node.editing { cursor: text; z-index: 5; }
.node.editing .node-content {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

.node-close,
.node-grip,
.port { opacity: 0; pointer-events: none; transition: opacity 0.12s ease; }

.node:hover .node-close,
.node:hover .node-grip,
.node:hover .port,
.node.selected .node-close,
.node.selected .node-grip,
.node.selected .port { opacity: 1; pointer-events: auto; }

.node.editing .node-close,
.node.editing .node-grip,
.node.editing .port { opacity: 0 !important; pointer-events: none !important; }

.node-close {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: #6d7486;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 2px 6px rgba(20, 27, 47, 0.12);
}
.node-close:hover { background: #fdecec; color: #c4433a; border-color: #f2c9c6; }

.node-grip {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 17px;
  height: 17px;
  cursor: nwse-resize;
  z-index: 4;
}
.node-grip::before,
.node-grip::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  border-radius: 1px;
  background: rgba(70, 80, 100, 0.45);
}
.node-grip::before { width: 9px; height: 1.5px; transform: rotate(-45deg); transform-origin: right bottom; }
.node-grip::after { width: 1.5px; height: 9px; transform: rotate(-45deg); transform-origin: right bottom; }

.port {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid #a8b0c0;
  z-index: 4;
  cursor: crosshair;
}
.port::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}
.port:hover { background: var(--accent); border-color: var(--accent); }
.port[data-side="top"] { left: 50%; top: 0; transform: translate(-50%, -50%); }
.port[data-side="right"] { left: 100%; top: 50%; transform: translate(50%, -50%); }
.port[data-side="bottom"] { left: 50%; top: 100%; transform: translate(-50%, 50%); }
.port[data-side="left"] { left: 0; top: 50%; transform: translate(-50%, -50%); }

.node.connect-target { outline: 2px dashed var(--accent); outline-offset: 3px; }

/* --------------------------------------------------------------- toolbar */

.toolbar {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 14px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 4px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.2px;
  color: #2a3040;
  white-space: nowrap;
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, #7b7beb, #a78bfa);
  box-shadow: 0 0 0 2px #ededfb;
  flex: none;
}

.tb-sep {
  width: 1px;
  height: 20px;
  margin: 0 3px;
  background: var(--line);
  flex: none;
}

.tb-btn,
.tb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #3b4252;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}
.tb-icon { width: 32px; padding: 0; color: #555d70; }
.tb-btn:hover, .tb-icon:hover { background: #f1f2f6; }
.tb-btn:active, .tb-icon:active { background: #e9ebf2; }
.tb-icon:disabled { opacity: 0.3; cursor: default; }
.tb-icon:disabled:hover { background: transparent; }

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

.boardbar {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 5px 6px 5px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  max-width: calc(100vw - 28px);
}

.conn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 2px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}
.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #98a2b3;
  flex: none;
}
.conn.online .conn-dot { background: #12b76a; box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.12); }
.conn.online .conn-text { color: #0e9f5e; }
.conn.syncing .conn-dot { background: #f79009; animation: pulse 1s ease-in-out infinite; }
.conn.offline .conn-dot { background: #f04438; }
.conn.offline .conn-text { color: #d92d20; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.board-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  max-width: 230px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #2f3545;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.board-btn:hover { background: #f1f2f6; }
.board-btn svg { flex: none; color: #6b7385; }
.board-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.caret { color: #9aa1b1; font-size: 10px; }

.presence {
  display: flex;
  align-items: center;
  padding-left: 2px;
}
.presence:empty { display: none; }
.presence-avatar,
.presence-more {
  width: 24px;
  height: 24px;
  margin-left: -6px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 10.5px;
  font-weight: 650;
  flex: none;
  box-shadow: 0 1px 3px rgba(20, 27, 47, 0.15);
}
.presence-avatar:first-child { margin-left: 0; }
.presence-more { background: #e9ecf1; color: #687082; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #596174;
  cursor: pointer;
}
.icon-btn:hover { background: #f1f2f6; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 6px 0 3px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #3b4252;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  max-width: 150px;
}
.user-chip:hover { background: #f1f2f6; }
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6c6ce5, #9a7bf0);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}
.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ menu */

.menu {
  position: absolute;
  z-index: 60;
  width: 220px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 18px 44px -18px rgba(20, 27, 47, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: menu-in 0.12s ease-out;
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}
#menu { top: 66px; left: 14px; }
#boardMenu { top: 66px; right: 14px; width: 300px; max-height: min(70vh, 460px); overflow: auto; }
#userMenu { top: 66px; right: 14px; width: 220px; }

.menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: flex-start;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #3b4252;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.menu button:hover { background: #f3f4f8; }
.menu button.danger { color: #c4433a; }
.menu .kbd { margin-left: auto; font-size: 11px; color: #9aa1b1; }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--line); flex: none; }
.menu-head {
  padding: 6px 10px 7px;
  color: #8a91a2;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
}
.menu-user {
  padding: 8px 10px;
  font-size: 12.5px;
  color: #687082;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-row svg { flex: none; color: #6b7385; }

.menu-lang {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  font-size: 12.5px;
  color: #4b5365;
}
.menu-lang select {
  width: auto;
  height: 28px;
  font-size: 12px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.board-list { display: flex; flex-direction: column; gap: 1px; }
.board-item {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.board-item .board-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-item .board-meta {
  flex: none;
  font-size: 10.5px;
  color: #98a0b0;
}
.board-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.board-item.active .board-meta { color: #7777d8; }

/* --------------------------------------------------------- selection bar */

.sel-tools {
  position: absolute;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  transform: translate(-50%, -100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 12px 32px -14px rgba(20, 27, 47, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: pop-in 0.12s ease-out;
  max-width: calc(100vw - 20px);
}
@keyframes pop-in {
  from { opacity: 0; transform: translate(-50%, -100%) translateY(3px); }
  to { opacity: 1; transform: translate(-50%, -100%); }
}

.swatches { display: flex; gap: 5px; }
.swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(20, 27, 47, 0.08);
  cursor: pointer;
  transition: transform 0.1s ease;
  flex: none;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--accent); }

.sel-sep { width: 1px; height: 18px; background: var(--line); flex: none; }
.sel-btn {
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #464d5e;
  font-size: 12px;
  cursor: pointer;
  flex: none;
}
.sel-btn:hover { background: #f1f2f6; }
.sel-btn.danger:hover { background: #fdecec; color: #c4433a; }
.sel-tools.region-mode [data-act="dup"] { display: none; }
.sel-tools.no-notes .swatches,
.sel-tools.no-notes .swatches + .sel-sep { display: none; }

/* --------------------------------------------------------------- overlays */

.zoombar {
  position: absolute;
  left: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.zoombar button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #3b4252;
  font-size: 16px;
  cursor: pointer;
}
.zoombar button:hover { background: #f1f2f6; }
.zoombar .zoom-label {
  width: auto;
  min-width: 58px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #5a6172;
}

.fab {
  position: absolute;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 30;
  width: 50px;
  height: 50px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 26px -8px rgba(91, 91, 214, 0.65);
}
.fab:active { transform: scale(0.96); }

.hint {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 20;
  transform: translateX(-50%);
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #8a90a1;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.hint.warn { color: #a63a32; background: rgba(253, 236, 236, 0.94); }

.empty-state {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 15;
  transform: translate(-50%, -50%);
  width: min(90vw, 340px);
  text-align: center;
  color: #8a90a1;
  pointer-events: none;
  animation: fade-in 0.3s ease-out;
}
.empty-state h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: #5a6172; }
.empty-state p { margin: 0 0 16px; font-size: 13px; line-height: 1.6; }
.empty-btn {
  pointer-events: auto;
  padding: 9px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  box-shadow: 0 8px 18px -8px rgba(91, 91, 214, 0.6);
}
.empty-btn:hover { background: var(--accent-ink); }
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ------------------------------------------------------------------ boot */

.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #f6f7fa;
  color: #7c8496;
  font-size: 13px;
}
.boot.hidden { display: none; }
.boot-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, #6c6ce5, #a78bfa);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 26px -10px rgba(91, 91, 214, 0.55);
}
.boot-mark .brand-dot { background: rgba(255, 255, 255, 0.9); box-shadow: none; }
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #e3e6ee;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- modals */

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 29, 44, 0.36);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: fade-in 0.15s ease-out;
}

.modal-card {
  width: min(400px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  padding: 26px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 34px 80px -24px rgba(20, 27, 47, 0.55);
  animation: modal-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.auth-card { width: min(380px, 100%); }
.auth-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.auth-logo .brand-dot {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  box-shadow: 0 0 0 4px #f0f0fc;
}
.auth-sub { margin: 10px 0 22px; color: #8a91a2; font-size: 13px; }

.auth-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: 20px;
  background: #f2f3f7;
  border-radius: 10px;
}
.auth-tab {
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6c7489;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}
.auth-tab.active {
  background: #fff;
  color: #2b3140;
  box-shadow: 0 2px 8px rgba(20, 27, 47, 0.1);
}

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  margin-bottom: 6px;
  color: #5c6475;
  font-size: 12px;
  font-weight: 550;
}
.field input, .code-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fbfbfd;
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.field input:focus, .code-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.12);
}
.form-error {
  margin: -2px 0 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fdf1f0;
  color: #b83a31;
  font-size: 12.5px;
  line-height: 1.5;
}
.primary-btn {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.primary-btn:hover { background: var(--accent-ink); }
.primary-btn:disabled { opacity: 0.6; cursor: default; }
.auth-foot {
  margin: 18px 0 0;
  text-align: center;
  color: #a0a6b4;
  font-size: 11.5px;
  line-height: 1.6;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 650; }
.modal-close {
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7b8395;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: #f2f3f7; }
.modal-text { margin: 0 0 18px; color: #6c7489; font-size: 13px; line-height: 1.7; }
.modal-hint { margin: 14px 0 0; color: #9aa1b1; font-size: 11.5px; line-height: 1.6; text-align: center; }

.invite-code {
  margin-bottom: 16px;
  padding: 16px 12px;
  border: 1px dashed #c9c9f0;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 5px;
  text-align: center;
  user-select: all;
}
.code-input {
  height: 50px;
  margin-bottom: 14px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ----------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: 300;
  transform: translateX(-50%);
  max-width: min(90vw, 420px);
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(32, 37, 51, 0.94);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 14px 34px -12px rgba(10, 14, 25, 0.55);
  animation: toast-in 0.18s ease-out;
  pointer-events: none;
}
.toast.error { background: rgba(180, 45, 37, 0.96); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(5px); }
  to { opacity: 1; transform: translateX(-50%); }
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .tb-label { display: none; }
  .tb-btn { width: 34px; padding: 0; }
  .brand-name { display: none; }
  .brand { padding: 0 4px; }
}

@media (max-width: 940px) {
  .user-name { display: none; }
  .user-chip { padding: 0 3px; }
  .board-btn { max-width: 170px; }
}

@media (max-width: 720px) {
  .toolbar {
    top: calc(10px + env(safe-area-inset-top));
    left: 10px;
    padding: 4px;
    gap: 1px;
    border-radius: 12px;
  }
  .brand, .brand-sep, .fit-only { display: none; }
  .tb-btn, .tb-icon { width: 32px; height: 32px; padding: 0; }
  .tb-sep { margin: 0 2px; height: 18px; }

  .boardbar {
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
    height: 40px;
    padding: 4px 5px 4px 8px;
    gap: 4px;
    border-radius: 12px;
  }
  .board-btn { max-width: 120px; height: 30px; padding: 0 5px; }
  .icon-btn { width: 30px; height: 30px; }
  .invite-btn { display: none; }
  .user-chip { height: 30px; }
  .conn { gap: 4px; padding-right: 0; }

  .zoombar { left: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .fab { display: flex; right: calc(12px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); }

  #menu { left: 10px; top: 56px; }
  #boardMenu { right: 10px; top: 56px; width: min(300px, calc(100vw - 20px)); }
  #userMenu { right: 10px; top: 56px; }

  .modal { padding: 12px; }
  .modal-card { padding: 20px; border-radius: 16px; }
  .invite-code { font-size: 21px; letter-spacing: 4px; }

  .sel-tools { gap: 5px; padding: 5px; overflow-x: auto; }
  .swatch { width: 26px; height: 26px; }
  .sel-btn { height: 32px; font-size: 12.5px; }
  .hint { display: none; }
  .conn-text { display: none; }
}

@media (max-width: 560px) {
  .board-name, .caret { display: none; }
  .board-btn { padding: 0 4px; }
  .presence-avatar, .presence-more { width: 22px; height: 22px; font-size: 9.5px; }
  .presence-avatar:nth-child(n+3) { display: none; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

@media (hover: none) {
  .node-close { width: 26px; height: 26px; top: -12px; right: -12px; font-size: 16px; }
  .node-grip { width: 24px; height: 24px; }
  .port { width: 14px; height: 14px; }
  .port::before { inset: -10px; }
  .region-grip { width: 28px; height: 28px; }
  .region-close { width: 26px; height: 26px; font-size: 16px; }
  .swatch { width: 26px; height: 26px; }
  .menu button { padding: 11px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .node, .region, .sel-tools, .empty-state, .menu, .modal-card, .toast { animation: none; }
  .spinner { animation-duration: 1.6s; }
}
@media (max-width: 720px) {
  .tb-btn, .tb-icon { width: 36px; height: 36px; }
  .zoombar button { width: 34px; height: 34px; }
}
@media (hover: none) {
  .region-label { padding: 5px 11px; font-size: 13px; }
}
.menu .board-item { justify-content: space-between; }
@media (max-width: 720px) {
  .field input, .code-input { font-size: 16px; }
}
.node, .viewport { -webkit-touch-callout: none; }
@media (max-width: 380px) {
  .tb-btn, .tb-icon { width: 32px; height: 32px; }
  .presence { display: none; }
  .boardbar { gap: 3px; }
}
.role-pill {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff4e5;
  color: #b25e09;
  border: 1px solid #f7d9b6;
  font-size: 10.5px;
  font-weight: 650;
}
.node:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.modal-card select { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fbfbfd; color: var(--ink); font-size: 14px; }
.field.compact { margin-bottom: 0; }
.invite-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.invite-form .primary-btn { grid-column: 1 / -1; }
.invite-result { margin-bottom: 18px; }
.invite-result .invite-code { margin-bottom: 10px; }
.invite-list-wrap h4 { margin: 18px 0 8px; font-size: 12px; color: #7c8496; font-weight: 600; }
.invite-list, .member-list, .audit-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; }
.invite-row, .member-row, .audit-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fbfbfd;
  font-size: 12.5px; color: #4b5365;
}
.invite-row .meta, .member-row .meta, .audit-row .meta { color: #8a91a2; font-size: 11px; }
.invite-row .row-main, .member-row .row-main, .audit-row .row-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-row button, .member-row button { flex: none; border: 0; background: transparent; color: #c4433a; cursor: pointer; font-size: 12px; padding: 4px 6px; border-radius: 6px; }
.invite-row button:hover, .member-row button:hover { background: #fdecec; }
.member-row select { width: auto; height: 30px; font-size: 12px; padding: 0 6px; }
.member-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; }
.member-actions .sel-btn { border: 1px solid var(--line); }
.member-actions .sel-btn.danger { color: #c4433a; }
.audit-row { flex-direction: column; align-items: flex-start; gap: 2px; }
.audit-row .time { color: #9aa1b1; font-size: 10.5px; }
.audit-row .audit-detail { color: #6b7385; font-size: 11px; }
.trash-row { flex-direction: row; align-items: center; gap: 10px; }
.trash-row .row-main { flex: 1; }
.trash-row .time { flex: none; }
.trash-row button { flex: none; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; font-size: 12px; padding: 5px 10px; border-radius: 7px; }
.trash-row button:hover { background: #f2f3f8; }
.trash-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.perm-groups { display: flex; flex-direction: column; gap: 12px; max-height: 340px; overflow: auto; }
.perm-group-title { font-size: 11px; color: #8a91a2; letter-spacing: .4px; margin-bottom: 5px; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
.perm-check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #4b5365; padding: 4px 2px; }
.perm-check input { width: 15px; height: 15px; }
.perm-actions { align-items: center; }
.perm-actions .primary-btn { margin-left: auto; width: auto; padding: 0 16px; height: 36px; }
@media (max-width: 720px) { .perm-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .invite-form { grid-template-columns: 1fr; }
  .invite-form .primary-btn { grid-column: auto; }
  .modal-card select { font-size: 16px; }
  .member-row { flex-wrap: wrap; }
}
.readonly .node-close,
.readonly .node-grip,
.readonly .port,
.readonly .sel-tools { display: none !important; }
.readonly .node,
.readonly .region-label { cursor: default; }
.no-node-delete .node-close,
.no-node-resize .node-grip,
.no-edge-create .port,
.no-region-delete .region-close,
.no-region-resize .region-grip { display: none !important; }
.region-label:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.node-content { touch-action: manipulation; }

/* -------------------------------------------------- auth password reveal */

.auth-hint { margin: -6px 0 12px; font-size: 11.5px; color: #8a91a2; text-align: right; }
.shape-section { margin-bottom: 16px; }
.shape-section h4 { margin: 0 0 8px; font-size: 12px; color: #7c8496; font-weight: 600; }
.shape-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.shape-preset { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fbfbfd; color: #4b5365; font-size: 12.5px; cursor: pointer; }
.shape-preset.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.shape-swatch { width: 26px; height: 18px; display: inline-block; background: #dcebff; border: 1px solid #b3cff2; flex: none; }
.shape-swatch.shape-rounded { border-radius: 6px; }
.shape-swatch.shape-pill { border-radius: 999px; }
.shape-swatch.shape-ellipse { border-radius: 50%; }
.shape-swatch.shape-rect { border-radius: 2px; }
.size-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.shape-dims { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.shape-dims .field { margin: 0; }
.node.shape-rect { border-radius: 4px; }
.node.shape-rounded { border-radius: 14px; }
.node.shape-pill { border-radius: 999px; }
.node.shape-ellipse { border-radius: 50%; }
.node.fixed-size .node-content { max-height: calc(100% - 31px); overflow: auto; overscroll-behavior: contain; }
.node.shape-ellipse .node-content,
.node.shape-pill .node-content { padding: 8px 12%; }
.node.fixed-size.shape-ellipse .node-content,
.node.fixed-size.shape-pill .node-content { padding: 10px 12%; }
.auth-lang { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: -4px 0 10px; font-size: 12px; color: #7c8496; }
.auth-lang select { height: 28px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fbfbfd; color: var(--ink); font-size: 12px; }
.pass-wrap { position: relative; display: block; }
.pass-wrap input { padding-right: 62px; }
.toggle-pass {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  height: 32px;
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #6c7489;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}
.toggle-pass:hover { background: #f1f2f6; color: #3b4252; }
.toggle-pass:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.toggle-pass::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 9px;
}

/* ------------------------------------------------------- name char count */

#nameForm .field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
#nameForm .field > span:first-child { flex: 1 0 100%; }
#nameForm .field input { flex: 1 0 100%; }
.field .char-count {
  margin-left: auto;
  margin-top: 4px;
  margin-bottom: 0;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  color: #8a91a2;
}

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

.board-search {
  width: 100%;
  height: 34px;
  margin: 4px 0 8px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fbfbfd;
  color: var(--ink);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.board-search:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.12);
}

/* ---------------------------------------------------------- touch targets */

.node-close,
.region-close,
.icon-btn,
.tb-btn,
.tb-icon,
.modal-close,
.zoom-label { position: relative; }

.node-close::after,
.region-close::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}
.icon-btn::after,
.modal-close::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
}
.tb-btn::after,
.tb-icon::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
}
.zoom-label::after {
  content: "";
  position: absolute;
  inset: -6px 0;
  border-radius: inherit;
}

.sel-btn { min-height: 30px; }
.member-row { flex-wrap: wrap; row-gap: 6px; }
.member-row button { min-height: 30px; padding: 6px 8px; }
.member-row button.perm-btn { color: #4b5365; }
.member-row button.perm-btn:hover { background: #f1f2f6; color: #3b4252; }
.invite-row button { min-height: 30px; }
.trash-row button { min-height: 30px; }
.perm-check { padding: 6px 2px; }
.perm-check input { width: 16px; height: 16px; }

@media (hover: none) {
  .node-close,
  .region-close { width: 28px; height: 28px; font-size: 16px; }
  .node.selected .node-close,
  .node:hover .node-close,
  .region.selected .region-close,
  .region:hover .region-close {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ---------------------------------------------------------------- minimap */

.minimap {
  position: absolute;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 25;
  width: 168px;
  height: 116px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  animation: fade-in 0.2s ease-out;
}
.minimap canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
}

/* ------------------------------------------------------------ context menu */

.context-menu {
  position: fixed;
  z-index: 90;
  width: auto;
  min-width: 180px;
  max-width: 260px;
}
.context-menu button {
  justify-content: flex-start;
  width: 100%;
  text-align: left;
}
.context-menu button.danger { color: #c4433a; }

/* --------------------------------------------------------------- help modal */

.help-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 4px;
}
.help-grid > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 7px 2px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: #4b5365;
}
.help-grid > div > span { min-width: 0; }
.help-grid > div:last-child { border-bottom: 0; }
.help-grid kbd {
  flex: none;
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #f7f8fb;
  color: #5a6172;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
}
@media (min-width: 560px) {
  .help-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .help-grid > div:nth-last-child(2) { border-bottom: 0; }
}

/* -------------------------------------------------------------- audit tools */

.audit-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.audit-tools select {
  flex: 1;
  width: auto;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fbfbfd;
  color: var(--ink);
  font-size: 12.5px;
}
.audit-tools .sel-btn { flex: none; border: 1px solid var(--line); }
#auditMore { display: block; width: 100%; margin-top: 8px; border: 1px solid var(--line); }

/* --------------------------------------------------------- board delete btn */

.board-row { display: flex; align-items: center; gap: 4px; }
.board-row .board-item { flex: 1; min-width: 0; }
.board-del {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  margin-left: auto;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #c4433a;
  font-size: 11.5px;
  line-height: 1;
  cursor: pointer;
}
.board-del:hover { background: #fdecec; }
/* keep the delete affordance compact even inside `.menu button` rules */
.menu button.board-del {
  width: auto;
  min-width: 28px;
  min-height: 28px;
  margin-left: auto;
  padding: 0 6px;
  color: #c4433a;
}
.menu button.board-del:hover { background: #fdecec; color: #c4433a; }

/* ------------------------------------------------ selection type-switch btn */

.sel-btn[data-act="type"] { color: #4b5365; }

/* ------------------------------------------------ enlarged touch targets */

.toolbar { padding: 4px 6px; }
.tb-btn,
.tb-icon { height: 40px; }
.tb-btn { padding: 0 10px; }
.tb-icon { width: 40px; padding: 0; }

.zoombar button { width: 38px; height: 38px; }
.zoombar .zoom-label { min-width: 62px; }

.sel-btn { min-height: 34px; padding: 0 9px; }

.member-row button,
.invite-row button,
.trash-row button { min-height: 34px; }

.swatch { width: 24px; height: 24px; }

.perm-check { padding: 8px 2px; }

.menu button { min-height: 40px; }

.node-close::after,
.region-close::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
}
.modal-close::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: inherit;
}
.user-chip,
.board-btn { position: relative; }
.user-chip::after,
.board-btn::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
}

@media (max-width: 1180px) {
  .tb-btn { width: 40px; padding: 0; }
}

@media (max-width: 720px) {
  .toolbar { padding: 4px 5px; }
  .tb-btn,
  .tb-icon { width: 40px; height: 40px; padding: 0; }
  .zoombar button { width: 38px; height: 38px; }
  .swatch { width: 28px; height: 28px; }
  .member-row button,
  .invite-row button,
  .trash-row button { min-height: 40px; }

  .minimap {
    width: 120px;
    height: 86px;
    bottom: calc(74px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 560px) {
  .minimap { width: 104px; height: 76px; }
}

@media (max-width: 380px) {
  .toolbar { gap: 0; padding: 3px 4px; }
  .tb-sep { margin: 0 1px; }
  .boardbar { gap: 3px; }
  .tb-btn,
  .tb-icon { width: 40px; height: 40px; }
}

@media (hover: none) {
  .menu button { min-height: 44px; }
}
