/* ── Labyrinth ───────────────────────────────────────────────────────────── */
/* Top-down note-graph map. A slim controls row sits above a full-bleed canvas;
   the canvas owns its own pan/zoom so it never uses native scroll. */

.labyrinth-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: 0 var(--space-4) var(--space-3);
  user-select: none;
}

.labyrinth-ctl-btn {
  font: inherit;
  font-size: var(--text-xs);
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-soft);
  padding: 4px 12px;
  cursor: pointer;
  min-height: 28px;
}

.labyrinth-ctl-btn:hover {
  color: var(--text);
  background: var(--surface-2, rgba(128, 128, 128, 0.1));
}

#labyrinth-container {
  position: relative;
  width: 100%;
  height: calc(100% - 2.4em);
  background: var(--bg);
  border-radius: var(--radius-soft);
  overflow: hidden;
  /* Own the gesture: pan + pinch belong to the canvas camera, not the page. */
  touch-action: none;
}

#labyrinth-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.labyrinth-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.85em;
  line-height: 1.6;
  padding: 3em 1.5em;
}

.labyrinth-empty code {
  background: var(--code-bg, rgba(128, 128, 128, 0.15));
  border-radius: var(--radius-soft);
  padding: 0 4px;
  font-size: 0.92em;
}

/* Selected-chamber card (bottom-left). Overlay card → box-shadow, no border. */
.labyrinth-inspector {
  position: absolute;
  left: var(--space-4);
  bottom: var(--space-4);
  max-width: 260px;
  background: var(--bg);
  border-radius: var(--radius-soft);
  padding: 10px 12px;
  color: var(--text);
  box-shadow: 0 4px 16px var(--shadow);
  z-index: var(--z-panel);
}

.labyrinth-inspector-name {
  font-weight: 600;
  font-size: 0.9em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.labyrinth-inspector-meta {
  font-size: var(--text-xs);
  color: var(--muted);
  margin: 2px 0 8px;
}

.labyrinth-inspector-row {
  display: flex;
  gap: var(--space-2);
}

.labyrinth-inspector-open,
.labyrinth-inspector-create {
  font: inherit;
  font-size: var(--text-xs);
  color: var(--text);
  background: var(--accent-faint, rgba(162, 114, 176, 0.22));
  border: none;
  border-radius: var(--radius-soft);
  padding: 5px 12px;
  cursor: pointer;
  min-height: 30px;
}

.labyrinth-inspector-open:hover,
.labyrinth-inspector-create:hover {
  background: var(--accent);
  color: var(--accent-contrast, #fff);
}

.labyrinth-inspector-anchor {
  font: inherit;
  font-size: var(--text-xs);
  color: var(--text);
  background: var(--surface-2, rgba(128, 128, 128, 0.14));
  border: none;
  border-radius: var(--radius-soft);
  padding: 5px 12px;
  cursor: pointer;
  min-height: 30px;
}

.labyrinth-inspector-anchor:hover {
  background: var(--accent-faint, rgba(162, 114, 176, 0.22));
}

/* Recluster-diff suggestion queue (top-right) */
.labyrinth-suggest {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 250px;
  max-height: 60%;
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--radius-soft);
  box-shadow: 0 4px 16px var(--shadow);
  padding: 8px 10px;
  z-index: var(--z-panel);
}

.labyrinth-suggest-head {
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: 6px;
}

.labyrinth-suggest-item {
  padding: 6px 0;
}

.labyrinth-suggest-item + .labyrinth-suggest-item {
  margin-top: 4px;
}

.labyrinth-suggest-reason {
  font-size: 0.78em;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 5px;
}

.labyrinth-suggest-actions,
.labyrinth-thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.labyrinth-suggest-accept,
.labyrinth-suggest-decline,
.labyrinth-thread-link-btn,
.labyrinth-thread-skip,
.labyrinth-thread-close,
.labyrinth-sr-apply,
.labyrinth-sr-cancel {
  font: inherit;
  font-size: var(--text-xs);
  border: none;
  border-radius: var(--radius-soft);
  padding: 4px 10px;
  cursor: pointer;
  min-height: 28px;
  color: var(--text);
  background: var(--surface-2, rgba(128, 128, 128, 0.14));
}

.labyrinth-suggest-accept,
.labyrinth-thread-link-btn,
.labyrinth-sr-apply {
  background: var(--accent-faint, rgba(162, 114, 176, 0.22));
}

.labyrinth-suggest-accept:hover,
.labyrinth-thread-link-btn:hover,
.labyrinth-sr-apply:hover {
  background: var(--accent);
  color: var(--accent-contrast, #fff);
}

.labyrinth-suggest-decline:hover,
.labyrinth-thread-skip:hover,
.labyrinth-thread-close:hover,
.labyrinth-sr-cancel:hover {
  background: var(--surface-2, rgba(128, 128, 128, 0.24));
}

/* Thread card (bottom-right): similar-but-unlinked suggestions + link form */
.labyrinth-thread {
  position: absolute;
  right: var(--space-4);
  bottom: var(--space-4);
  width: 280px;
  background: var(--bg);
  border-radius: var(--radius-soft);
  box-shadow: 0 4px 16px var(--shadow);
  padding: 10px 12px;
  z-index: var(--z-panel);
}

.labyrinth-thread-head {
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--muted);
}

.labyrinth-thread-pair {
  font-size: 0.86em;
  font-weight: 600;
  color: var(--text);
  margin: 6px 0 2px;
  line-height: 1.3;
  word-break: break-word;
}

.labyrinth-thread-link {
  color: var(--accent);
}

.labyrinth-thread-why,
.labyrinth-thread-body {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

.labyrinth-thread-why em {
  color: var(--text);
  font-style: normal;
}

/* Thread "link in context" search-&-replace form */
.labyrinth-sr-hint {
  font-size: var(--text-xs);
  color: var(--muted);
  margin: 4px 0 8px;
  line-height: 1.35;
}

.labyrinth-sr-note {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text);
  margin: 6px 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.labyrinth-sr-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.labyrinth-sr-arrow {
  color: var(--muted);
  flex: none;
}

.labyrinth-sr-find,
.labyrinth-sr-rep {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: var(--text-xs);
  color: var(--text);
  background: var(--surface-2, rgba(128, 128, 128, 0.12));
  border: none;
  border-radius: var(--radius-soft);
  padding: 4px 6px;
}

.labyrinth-sr-find:focus,
.labyrinth-sr-rep:focus {
  outline: 1px solid var(--accent);
}
