:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
  --canvas: #f2f4f7;
  --grid: #d9dfe8;
  --paper: #fafbfd;
  --ink: #202735;
  --muted: #798290;
  --thread: #5372a8;
  --thread-soft: #dce5f3;
  --danger: #a44343;
  --panel: rgba(250, 251, 253, 0.94);
  --panel-strong: rgba(250, 251, 253, 0.98);
  --control: #ebeff4;
  --control-hover: #e7ebf1;
  --danger-soft: #f8eded;
  --border: #dce3ed;
  --field-border: #cdd9eb;
  --node-border: #dfe4ec;
  --placeholder: #98a1ae;
  --target: #f3f6fa;
  --label-muted: #a1a9b5;
  --lasso-fill: rgba(78, 116, 184, 0.08);
  --visual-fill: rgba(250, 251, 253, 0.7);
  --visual-stroke: #7183a1;
  --swatch-border: rgba(80, 91, 108, 0.2);
  --toast-bg: #273040;
  --toast-ink: #ffffff;
  --note-yellow: #fff4c7;
  --note-yellow-border: #e9dca5;
  --note-mint: #e2f3e9;
  --note-mint-border: #c5dfd0;
  --note-blue: #e5effc;
  --note-blue-border: #c8d9ef;
  --note-rose: #f8e7ed;
  --note-rose-border: #e6ccd5;
  --color-yellow: #e8cc66;
  --color-mint: #8fc9b0;
  --color-blue: #82a9df;
  --node-shadow: 0 2px 8px rgba(43, 55, 74, 0.07), 0 12px 28px rgba(43, 55, 74, 0.04);
  --selected-shadow: 0 0 0 3px var(--thread-soft), 0 8px 24px rgba(43, 55, 74, 0.1);
  --floating-shadow: 0 10px 30px rgba(43, 55, 74, 0.16);
  --quiet-shadow: 0 1px 5px rgba(43, 55, 74, 0.08);
  --empty-shadow: drop-shadow(0 5px 9px rgba(43, 55, 74, 0.07));
}

html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #16150f;
  --grid: #2c2a22;
  --paper: #211f18;
  --ink: #eae4d6;
  --muted: #a49d8d;
  --thread: #7fa2dc;
  --thread-soft: rgba(127, 162, 220, 0.22);
  --danger: #e0857e;
  --panel: rgba(28, 26, 19, 0.94);
  --panel-strong: rgba(33, 31, 24, 0.98);
  --control: #28251d;
  --control-hover: #302d24;
  --danger-soft: #3a2225;
  --border: #39362c;
  --field-border: #4c493c;
  --node-border: #3a372d;
  --placeholder: #8f897c;
  --target: #20283a;
  --label-muted: #6e685c;
  --lasso-fill: rgba(127, 162, 220, 0.12);
  --visual-fill: rgba(33, 31, 24, 0.78);
  --visual-stroke: #899ab4;
  --swatch-border: rgba(234, 228, 214, 0.28);
  --toast-bg: #eae4d6;
  --toast-ink: #16150f;
  --note-yellow: #3a321b;
  --note-yellow-border: #66562a;
  --note-mint: #193129;
  --note-mint-border: #315848;
  --note-blue: #1b2c43;
  --note-blue-border: #315078;
  --note-rose: #3a222a;
  --note-rose-border: #68434e;
  --color-yellow: #d6b957;
  --color-mint: #70ad92;
  --color-blue: #7195cd;
  --node-shadow: 0 2px 8px rgba(0, 0, 0, 0.22), 0 12px 28px rgba(0, 0, 0, 0.16);
  --selected-shadow: 0 0 0 3px var(--thread-soft), 0 8px 24px rgba(0, 0, 0, 0.3);
  --floating-shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
  --quiet-shadow: 0 1px 5px rgba(0, 0, 0, 0.24);
  --empty-shadow: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.2));
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--canvas);
  color: var(--ink);
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

#viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  background-color: var(--canvas);
  background-image: radial-gradient(circle, var(--grid) 1px, transparent 1.2px);
  background-position: var(--grid-x, 0) var(--grid-y, 0);
  background-size: var(--grid-size, 28px) var(--grid-size, 28px);
}

#gesture-surface {
  position: absolute;
  inset: 0;
  z-index: 0;
  touch-action: none;
}

#viewport.pan-ready #gesture-surface,
#viewport.pan-ready #world,
#viewport.pan-ready #world * {
  cursor: grab;
}

#viewport.panning #gesture-surface,
#viewport.panning #world,
#viewport.panning #world * {
  cursor: grabbing;
}

#world {
  position: absolute;
  inset: 0 auto auto 0;
  width: 0;
  height: 0;
  z-index: 1;
  transform-origin: 0 0;
  will-change: transform;
}

#viewport.revealing-note {
  transition: background-position 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

#viewport.revealing-note #world {
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

#connections {
  position: absolute;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
}

#connections .edge-line,
#link-preview {
  fill: none;
  stroke: var(--thread);
  stroke-width: 1.85;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

#connections .edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 24;
  pointer-events: stroke;
  cursor: pointer;
  vector-effect: non-scaling-stroke;
}

#connections .edge {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#connections .edge.selected .edge-line,
#connections .edge:focus-visible .edge-line {
  stroke-width: 2.8;
}

#connections .arrowhead {
  fill: var(--thread);
  stroke: none;
}

#connections .edge-label {
  fill: var(--ink);
  stroke: var(--canvas);
  stroke-width: 7;
  stroke-linejoin: round;
  paint-order: stroke fill;
  pointer-events: none;
  font-size: 13px;
  font-weight: 560;
  text-anchor: middle;
  dominant-baseline: central;
}

#link-preview {
  stroke-dasharray: 5 7;
  opacity: 0.75;
}

#lasso-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 2;
}

#lasso-path {
  fill: var(--lasso-fill);
  stroke: var(--thread);
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.node {
  position: absolute;
  width: var(--node-width, 218px);
  min-height: 48px;
  padding: 13px 15px;
  border: 1px solid var(--node-border);
  border-radius: 9px;
  background: var(--note-bg, var(--paper));
  border-color: var(--note-border, var(--node-border));
  box-shadow: var(--node-shadow);
  cursor: grab;
  outline: none;
  touch-action: none;
  transform: translate3d(var(--node-x), var(--node-y), 0);
  will-change: transform;
}

.node[data-color="yellow"] {
  --note-bg: var(--note-yellow);
  --note-border: var(--note-yellow-border);
}

.node[data-color="mint"] {
  --note-bg: var(--note-mint);
  --note-border: var(--note-mint-border);
}

.node[data-color="blue"] {
  --note-bg: var(--note-blue);
  --note-border: var(--note-blue-border);
}

.node[data-color="rose"] {
  --note-bg: var(--note-rose);
  --note-border: var(--note-rose-border);
}

.node:active {
  cursor: grabbing;
}

.node.selected,
.node:focus-visible {
  z-index: 1;
  border-color: var(--thread);
  box-shadow: var(--selected-shadow);
}

.node.search-match {
  box-shadow: 0 0 0 2px var(--thread-soft), var(--node-shadow);
}

.node.search-current {
  border-color: var(--thread);
  box-shadow: var(--selected-shadow);
}

#viewport.multi-selecting .node.selected .node-actions,
#viewport.multi-selecting .node.selected .resize-handle,
#viewport.multi-selecting .node.selected .link-handle {
  display: none;
}

#viewport.multi-selecting .node.selected.selection-primary .link-handle {
  display: grid;
}

.node.editing {
  cursor: text;
  touch-action: auto;
}

.node-text,
.node-editor {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
  font-weight: 430;
  line-height: 1.42;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.node-text {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.node-text a[x-apple-data-detectors],
.node-text a[href^="tel:"] {
  color: inherit !important;
  font: inherit !important;
  text-decoration: none !important;
}

.node.empty-note .node-text,
.node-editor::placeholder {
  color: var(--placeholder);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  opacity: 1;
}

.node-editor {
  display: block;
  min-height: 24px;
  resize: none;
  overflow: hidden;
  touch-action: auto;
  user-select: text;
  -webkit-user-select: text;
}

.node-actions,
.resize-handle,
.link-handle {
  position: absolute;
  display: none;
  opacity: 0;
}

.node.selected .node-actions,
.node.selected .resize-handle,
.node.selected .link-handle,
.node:focus-visible .node-actions,
.node:focus-visible .resize-handle,
.node:focus-visible .link-handle,
.node:focus-within .node-actions,
.node:focus-within .resize-handle,
.node:focus-within .link-handle {
  display: flex;
  opacity: 1;
}

.node.selected .link-handle,
.node:focus-visible .link-handle,
.node:focus-within .link-handle {
  display: grid;
}

.node.editing .node-actions,
.node.editing .resize-handle,
.node.editing .link-handle {
  display: none;
}

.node-actions {
  top: var(--node-actions-top, -66px);
  left: 50%;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel-strong);
  box-shadow: var(--floating-shadow);
  transform: translateX(-50%) scale(var(--control-scale, 1));
  transform-origin: center;
  touch-action: manipulation;
}

.card-action {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  touch-action: manipulation;
}

.card-action svg,
.selection-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-action .color-icon,
.selection-action .color-icon {
  width: 25px;
  height: 25px;
  stroke: var(--paper);
  stroke-width: 1.2;
}

.color-icon circle:nth-child(1) { fill: var(--color-yellow); }
.color-icon circle:nth-child(2) { fill: var(--color-mint); }
.color-icon circle:nth-child(3) { fill: var(--color-blue); }

#disconnect-selection svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

#arrow-selection svg {
  width: 23px;
  height: 23px;
}

[data-direction="none"] .arrow-head,
[data-direction="forward"] .arrow-head-reverse,
[data-direction="reverse"] .arrow-head-forward {
  display: none;
}

.card-action.danger {
  color: var(--danger);
}

.card-action,
.selection-action,
.resize-handle,
.link-handle {
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.card-action:focus-visible,
.selection-action:focus-visible,
.resize-handle:focus-visible,
.link-handle:focus-visible,
.color-swatch:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 1px;
}

.resize-handle {
  left: 50%;
  bottom: var(--direct-control-offset, -56px);
  width: 64px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--thread);
  cursor: ew-resize;
  touch-action: none;
  transform: translateX(-50%) scale(var(--control-scale, 1));
  transform-origin: center;
}

.resize-handle::before {
  content: "";
  position: absolute;
  width: 48px;
  height: 28px;
  border: 1px solid var(--field-border);
  border-radius: 14px;
  background: var(--panel-strong);
  box-shadow: var(--quiet-shadow);
}

.resize-handle svg {
  position: relative;
  width: 32px;
  height: 16px;
  fill: none;
  stroke: var(--thread);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link-handle {
  top: 50%;
  right: var(--direct-control-offset, -36px);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  touch-action: none;
  transform: translateY(-50%) scale(var(--control-scale, 1));
  transform-origin: center;
}

.link-handle::after {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--thread);
  box-shadow: 0 0 0 2px var(--thread-soft);
}

#viewport.keyboard-linking .node.selected .link-handle::after {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 7px var(--thread-soft);
}

.link-handle {
  place-items: center;
}

.node.link-target {
  border-color: var(--thread);
  background: var(--target);
}

.app-mark {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 1px;
  color: var(--muted);
  z-index: 3;
}

.app-logo {
  width: 31px;
  height: 24px;
  flex: none;
  overflow: visible;
  pointer-events: none;
  user-select: none;
}

.boards-button {
  width: 42px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.boards-button:active,
.boards-button[aria-expanded="true"] {
  background: var(--control);
}

.boards-button:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 1px;
}

.boards-disclosure {
  width: 8px;
  height: 5px;
  flex: none;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.38;
  transition: transform 140ms ease;
}

.boards-button[aria-expanded="true"] .boards-disclosure {
  transform: rotate(180deg);
}

.app-logo-dot {
  fill: var(--thread);
}

.app-logo .dot-1 { opacity: 0.48; }
.app-logo .dot-2 { opacity: 0.72; }
.app-logo .dot-3 { opacity: 1; }
.app-logo .dot-4 { opacity: 0.42; }
.app-logo .dot-5 { opacity: 0.78; }
.app-logo .dot-6 { opacity: 0.58; }

#board-title,
#board-title-editor {
  max-width: min(52vw, 420px);
  height: 36px;
  margin: 0;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 620;
  letter-spacing: -0.025em;
  text-align: left;
}

#board-title {
  padding: 3px 6px;
  overflow: hidden;
  background: transparent;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

#board-title-editor {
  width: min(52vw, 420px);
  padding: 3px 8px;
  border: 1px solid var(--field-border);
  outline: 0;
  background: var(--panel-strong);
  box-shadow: var(--floating-shadow);
  user-select: text;
  -webkit-user-select: text;
}

#board-title:focus-visible,
#board-title-editor:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 1px;
}

.board-picker {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 44px));
  left: max(14px, env(safe-area-inset-left));
  width: min(300px, calc(100vw - 28px));
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel-strong);
  box-shadow: var(--floating-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 5;
}

.board-picker-tools {
  display: flex;
  gap: 4px;
  padding-bottom: 5px;
}

.board-picker button,
.board-list-option {
  border: 0;
  color: var(--ink);
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.board-picker-tools button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 22px;
  background: var(--control);
}

.board-picker-tools .danger {
  margin-left: auto;
  color: var(--danger);
  background: var(--danger-soft);
}

.board-picker.confirming-delete > :not(.board-picker-tools),
.board-picker.confirming-delete .board-picker-tools > :not(#cancel-delete-board-button):not(#delete-board-button) {
  display: none;
}

.board-picker.confirming-delete {
  width: auto;
}

.board-picker.confirming-delete .board-picker-tools {
  padding-bottom: 0;
}

.board-picker.confirming-delete .danger {
  margin-left: 0;
}

.board-picker.confirming-delete #delete-board-button {
  background: var(--danger-soft);
}

.board-picker.managing-drive > :not(.board-picker-tools),
.board-picker.managing-drive .board-picker-tools > :not(#cancel-drive-button):not(#disconnect-drive-button) {
  display: none;
}

.board-picker.managing-drive {
  width: auto;
}

.board-picker.managing-drive .board-picker-tools {
  padding-bottom: 0;
}

.drive-sync-button[data-status="connected"],
.drive-sync-button[data-status="syncing"],
.drive-sync-button[data-status="synced"] {
  color: var(--thread) !important;
}

.drive-status-dot,
.drive-status-ring,
.drive-status-alert {
  display: none;
}

.drive-sync-button[data-status="connected"] .drive-status-dot,
.drive-sync-button[data-status="synced"] .drive-status-dot {
  display: block;
  fill: currentColor;
  stroke: var(--panel-strong);
  stroke-width: 1.5;
}

.drive-sync-button[data-status="connected"] .drive-status-dot {
  opacity: .52;
}

.drive-sync-button[data-status="syncing"] .drive-status-ring {
  display: block;
  stroke-dasharray: 9 44;
  transform-origin: 12px 12px;
  animation: drive-sync-spin 1s linear infinite;
}

.drive-sync-button[data-status="error"] {
  color: var(--danger) !important;
}

.drive-sync-button[data-status="error"] .drive-status-alert {
  display: block;
  stroke-width: 2.2;
}

@keyframes drive-sync-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .drive-sync-button[data-status="syncing"] .drive-status-ring {
    animation: none;
  }
}

.board-picker svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.board-list {
  max-height: min(360px, calc(100vh - 130px));
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.board-list-option {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 12px;
  text-align: left;
}

.board-list-option::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--border);
}

.board-list-option[aria-current="true"] {
  background: var(--thread-soft);
}

.board-list-option[aria-current="true"]::before {
  background: var(--thread);
}

.board-list-title {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-picker button:focus-visible,
.board-list-option:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 1px;
}

.empty-state {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(620px, calc(100vw - 32px));
  color: var(--muted);
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.empty-state-visuals {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 4vw, 34px);
  margin-bottom: 18px;
}

.empty-state-visuals svg {
  width: 72px;
  height: 63px;
  overflow: visible;
  fill: var(--visual-fill);
  stroke: var(--visual-stroke);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: var(--empty-shadow);
}

.empty-state-visuals .soft {
  opacity: 0.32;
}

.empty-state-visuals .dashed {
  stroke-dasharray: 4 4;
}

.empty-state p {
  margin: 0;
  font-size: clamp(10px, 1.65vw, 13px);
  font-weight: 450;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.empty-state p span {
  padding: 0 0.45em;
  color: var(--label-muted);
}

.quiet-button {
  border: 0;
  background: var(--panel);
  box-shadow: var(--quiet-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.menu-button {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border-radius: 22px;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 2px;
  z-index: 3;
}

.history-tools {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 44px));
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  gap: 4px;
  z-index: 3;
}

.history-tools button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 22px;
  color: var(--muted);
}

.history-tools svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-tools button:disabled {
  opacity: 0.28;
}

.menu {
  position: fixed;
  top: max(54px, calc(env(safe-area-inset-top) + 44px));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--floating-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 3;
}

.menu button,
.menu a {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
}

.menu button:active,
.menu a:active {
  background: var(--control-hover);
}

.menu button:focus-visible,
.menu a:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 1px;
}

.menu svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#connection-style-button .connection-style-curved {
  display: none;
}

#connection-style-button[data-style="curved"] .connection-style-straight {
  display: none;
}

#connection-style-button[data-style="curved"] .connection-style-curved {
  display: initial;
}

.menu .danger {
  color: var(--danger);
}

.board-picker button:disabled,
.menu button:disabled {
  opacity: 0.48;
  pointer-events: none;
}

.menu.confirming-clear > :not(#cancel-clear-button):not(#clear-button) {
  display: none;
}

.menu.confirming-clear #clear-button {
  background: var(--danger-soft);
}

.menu.choosing-export > :not(.export-choice) {
  display: none;
}

.search-panel {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  width: min(440px, calc(100vw - 108px));
  min-width: 250px;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 5px 4px 12px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--floating-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateX(-50%);
  z-index: 6;
}

.search-mark,
.search-panel button svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-mark {
  color: var(--muted);
}

#search-input {
  min-width: 0;
  flex: 1;
  height: 36px;
  padding: 0 7px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  user-select: text;
  -webkit-user-select: text;
}

#search-input::-webkit-search-cancel-button {
  display: none;
}

#search-count {
  min-width: 32px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.search-panel button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: var(--muted);
}

.search-panel button:disabled {
  opacity: 0.3;
}

.search-panel button:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 0;
}

.theme-button {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 22px;
  color: var(--muted);
  z-index: 3;
}

.theme-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-button:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 1px;
}

.theme-sun {
  display: none;
}

html[data-theme="dark"] .theme-moon {
  display: none;
}

html[data-theme="dark"] .theme-sun {
  display: inline;
}

.selection-bar {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 50px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--floating-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateX(-50%);
  z-index: 3;
}

.selection-bar button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--control);
  color: var(--muted);
}

.selection-bar button:disabled {
  opacity: 0.38;
}

.selection-bar .danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.edge-toolbar {
  position: fixed;
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel-strong);
  box-shadow: var(--floating-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translate(-50%, -50%);
  z-index: 4;
}

.edge-toolbar button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--control);
  color: var(--muted);
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.edge-toolbar button[data-direction="forward"],
.edge-toolbar button[data-direction="reverse"],
.edge-toolbar button.active {
  background: var(--thread-soft);
  color: var(--thread);
}

.edge-toolbar .danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.edge-toolbar svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#edge-delete svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.edge-toolbar button:focus-visible,
.edge-label-editor:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 1px;
}

.edge-label-editor {
  position: fixed;
  width: min(220px, calc(100vw - 32px));
  height: 46px;
  padding: 0 15px;
  border: 1px solid var(--field-border);
  border-radius: 23px;
  outline: 0;
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: var(--floating-shadow);
  font-size: 15px;
  text-align: center;
  user-select: text;
  -webkit-user-select: text;
  touch-action: manipulation;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.color-palette {
  position: fixed;
  display: flex;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 25px;
  background: var(--panel-strong);
  box-shadow: var(--floating-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translate(-50%, -100%);
  z-index: 4;
}

.color-palette.below {
  transform: translate(-50%, 0);
}

.color-swatch {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
}

.color-swatch::after {
  content: "";
  width: 22px;
  height: 22px;
  border: 1px solid var(--swatch-border);
  border-radius: 50%;
  background: var(--swatch);
}

.color-swatch[data-color="plain"] { --swatch: var(--paper); }
.color-swatch[data-color="yellow"] { --swatch: var(--note-yellow); }
.color-swatch[data-color="mint"] { --swatch: var(--note-mint); }
.color-swatch[data-color="blue"] { --swatch: var(--note-blue); }
.color-swatch[data-color="rose"] { --swatch: var(--note-rose); }

.color-swatch[aria-pressed="true"] {
  background: var(--thread-soft);
}

.toast {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  padding: 8px 13px;
  border-radius: 9px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: 13px;
  transform: translateX(-50%);
  box-shadow: var(--floating-shadow);
  z-index: 4;
}

@media (hover: hover) {
  .quiet-button:hover,
  .menu button:hover,
  .menu a:hover,
  .card-action:hover,
  .selection-action:hover,
  .edge-toolbar button:hover {
    background: var(--control-hover);
  }

  .boards-button:hover,
  .board-picker button:hover,
  .board-list-option:hover,
  .search-panel button:hover {
    background: var(--control-hover);
  }

  .card-action.danger:hover,
  .selection-action.danger:hover,
  .edge-toolbar .danger:hover {
    background: var(--danger-soft);
  }
}

@media (max-width: 520px) {
  .search-panel {
    top: max(62px, calc(env(safe-area-inset-top) + 50px));
    width: calc(100vw - 28px);
  }
}

@media (max-width: 360px) {
  #viewport.multi-selecting .theme-button {
    transform: translateY(-58px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .node.selected,
  .node:focus-visible,
  button:focus-visible,
  a:focus-visible,
  .edge:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}
