:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3d9cf0;
  --accent-dim: #2563a8;
  --node-bg: #243044;
  --root-bg: #1e3a5f;
  --danger: #e85d5d;
  --radius: 10px;
  --font: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.toolbar {
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.brand {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.hint {
  margin: 0;
  width: 100%;
  font-size: 0.8rem;
  color: var(--muted);
}

.hint kbd {
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.85em;
}

.btn {
  font: inherit;
  font-size: 0.875rem;
  padding: 0.45em 0.9em;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.btn:hover {
  border-color: var(--muted);
}

.btn-primary {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent);
}

.btn-ghost {
  background: transparent;
}

.file-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.canvas-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.map-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: crosshair;
  outline: none;
  background:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
  background-size: 24px 24px;
  background-color: #0c1016;
}

.map-canvas.dragging-node {
  cursor: grabbing;
}

.edges-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.nodes-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mind-node {
  position: absolute;
  min-width: 120px;
  max-width: 280px;
  padding: 0.55rem 0.75rem;
  background: var(--node-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.mind-node.root {
  background: var(--root-bg);
  border-color: var(--accent);
}

.mind-node.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 156, 240, 0.35);
}

.mind-node.dragging {
  cursor: grabbing;
  opacity: 0.92;
  z-index: 50;
}

.mind-node .label {
  font-size: 0.9rem;
  line-height: 1.35;
  word-break: break-word;
  outline: none;
}

.mind-node .label:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.mind-node .meta {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.edge-path {
  fill: none;
  stroke: #4a6078;
  stroke-width: 2;
  stroke-linecap: round;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  z-index: 200;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
