:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel-border: rgba(255,255,255,.08);
  --text: #eef2ff;
  --muted: #98a2b3;
  --shadow: 0 16px 40px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124,58,237,.25), transparent 32%),
    radial-gradient(circle at top right, rgba(14,165,233,.17), transparent 28%),
    var(--bg);
}
button, input, textarea, select { font: inherit; }
.app-shell {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 18px 16px 22px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.eyebrow {
  margin: 0 0 4px;
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
}
h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); }
.sub { margin: 8px 0 0; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary-btn, .ghost-btn, .danger-btn, .link-btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
}
.primary-btn {
  background: linear-gradient(135deg, #8b5cf6, #0ea5e9);
  color: white;
  box-shadow: var(--shadow);
}
.ghost-btn {
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.08);
}
.link-btn {
  background: rgba(59,130,246,.15);
  color: #1e3a8a;
}
.danger-btn {
  background: rgba(239,68,68,.16);
  color: #7f1d1d;
}
.board-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  color: var(--muted);
  flex-wrap: wrap;
}
.status-pill, .sync-pill, .hint-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}
.hint-pill { color: #cbd5e1; }
.board-wrap {
  position: relative;
  height: calc(100vh - 170px);
  min-height: 580px;
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    rgba(10, 14, 28, 0.75);
  background-size: 32px 32px, 32px 32px, auto;
  backdrop-filter: blur(16px);
}
.zoom-controls {
  position: sticky;
  top: 12px;
  right: 12px;
  z-index: 30;
  margin: 12px 12px 0 auto;
  width: fit-content;
  display: flex;
  gap: 8px;
}
.zoom-btn,
.zoom-readout {
  padding: 10px 14px;
  background: rgba(15,23,42,.88);
  backdrop-filter: blur(10px);
}
.zoom-btn {
  min-width: 44px;
  font-size: 22px;
  line-height: 1;
}
.zoom-readout {
  min-width: 72px;
}
.board-canvas {
  position: relative;
  width: 2400px;
  height: 1600px;
  transform-origin: top left;
}
.links-layer,
.notes-layer {
  position: absolute;
  inset: 0;
  transform-origin: top left;
}
.links-layer {
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.link-line {
  stroke: #94a3b8;
  stroke-width: 3;
  fill: none;
  marker-end: url(#arrowhead);
  opacity: .9;
}
.link-label {
  pointer-events: auto;
  cursor: pointer;
}
.link-delete {
  fill: rgba(15,23,42,.92);
  stroke: rgba(255,255,255,.14);
}
.link-delete-text {
  fill: #fca5a5;
  font-size: 16px;
  text-anchor: middle;
  dominant-baseline: middle;
  font-weight: 700;
}
.note {
  position: absolute;
  width: 280px;
  min-height: 240px;
  border-radius: 20px;
  padding: 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.08);
  color: #111827;
  user-select: none;
}
.note.dragging { opacity: .92; box-shadow: 0 24px 48px rgba(0,0,0,.35); }
.note.linking { outline: 3px solid rgba(59,130,246,.7); }
.note.link-target { outline: 3px dashed rgba(16,185,129,.85); }
.note-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.drag-handle {
  cursor: grab;
  letter-spacing: 2px;
  color: rgba(17,24,39,.6);
  font-weight: 700;
}
.note-title,
.note-text,
.note-color {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.45);
  color: #111827;
}
.note-title, .note-color { padding: 10px 12px; }
.note-title { font-weight: 700; margin-bottom: 8px; }
.note-text {
  padding: 10px 12px;
  resize: vertical;
  min-height: 130px;
}
.note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
@media (max-width: 960px) {
  .topbar { flex-direction: column; }
  .actions { width: 100%; }
  .primary-btn, .ghost-btn { flex: 1; }
  .board-wrap { height: calc(100vh - 220px); }
  .zoom-controls {
    top: 10px;
    right: 10px;
    margin-top: 10px;
  }
}
