.knowledge-page {
  --km-primary: #2f6df6;
  --km-primary-soft: rgba(47, 109, 246, 0.12);
  --km-line: rgba(60, 75, 100, 0.14);
  --km-muted: var(--anzhiyu-secondtext);
}

.knowledge-page a {
  text-decoration: none !important;
}

.knowledge-hero {
  padding: 34px 34px 30px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 15% 20%, rgba(47, 109, 246, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(47, 109, 246, 0.12), rgba(33, 196, 167, 0.08));
  border: 1px solid var(--km-line);
  margin-bottom: 30px;
}

.knowledge-kicker {
  margin: 0 0 10px;
  color: var(--km-primary);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.knowledge-hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  line-height: 1.25;
}

.knowledge-desc {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--km-muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.knowledge-section {
  margin: 34px 0;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.45rem;
}

.section-heading p {
  margin: 0;
  color: var(--km-muted);
  text-align: right;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.knowledge-card {
  display: flex;
  flex-direction: column;
  min-height: 214px;
  padding: 22px;
  border: 1px solid var(--km-line);
  border-radius: 18px;
  color: var(--anzhiyu-fontcolor) !important;
  background: var(--anzhiyu-card-bg);
  transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.knowledge-card:hover {
  transform: translateY(-4px);
  border-color: rgba(47, 109, 246, 0.38);
  box-shadow: 0 14px 34px rgba(31, 45, 61, 0.11);
}

.knowledge-card.primary {
  background: linear-gradient(135deg, rgba(47, 109, 246, 0.16), rgba(33, 196, 167, 0.10)), var(--anzhiyu-card-bg);
}

.card-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  color: var(--km-primary);
  background: var(--km-primary-soft);
  font-size: 1.2rem;
}

.card-title {
  margin-top: 16px;
  font-size: 1.18rem;
  font-weight: 800;
}

.card-desc {
  margin-top: 10px;
  color: var(--km-muted);
  line-height: 1.65;
}

.card-meta {
  margin-top: auto;
  padding-top: 18px;
  color: var(--km-primary);
  font-size: 0.92rem;
  font-weight: 700;
}

.path-list {
  display: grid;
  gap: 12px;
}

.path-item {
  display: grid;
  grid-template-columns: 54px 170px 1fr;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--km-line);
  border-radius: 16px;
  background: var(--anzhiyu-card-bg);
  color: var(--anzhiyu-fontcolor) !important;
  transition: transform 0.22s ease, border-color 0.22s ease;
}

.path-item:hover {
  transform: translateX(4px);
  border-color: rgba(47, 109, 246, 0.38);
}

.path-item span {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: var(--km-primary);
  font-weight: 800;
}

.path-item strong {
  font-size: 1.05rem;
}

.path-item em {
  color: var(--km-muted);
  font-style: normal;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.rule-card {
  padding: 18px;
  border-radius: 16px;
  background: rgba(47, 109, 246, 0.07);
  border: 1px solid var(--km-line);
}

.rule-card strong {
  display: block;
  margin-bottom: 8px;
}

.rule-card p {
  margin: 0;
  color: var(--km-muted);
  line-height: 1.65;
}

[data-theme="dark"] .knowledge-card:hover {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

@media (max-width: 920px) {
  .knowledge-grid,
  .rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading {
    display: block;
  }

  .section-heading p {
    margin-top: 8px;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .knowledge-hero {
    padding: 26px 20px;
  }

  .knowledge-grid,
  .rule-grid {
    grid-template-columns: 1fr;
  }

  .path-item {
    grid-template-columns: 44px 1fr;
    gap: 12px;
  }

  .path-item em {
    grid-column: 2;
  }
}

.note-tree-page {
  --tree-blue: #2f6df6;
  --tree-green: #13a380;
  --tree-line: rgba(72, 86, 112, 0.16);
  --tree-soft: rgba(47, 109, 246, 0.08);
  --tree-local: var(--anzhiyu-secondtext);
}

.compact-tree-hero {
  margin-bottom: 18px;
}

.compact-tree-hero code {
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--tree-blue);
  background: rgba(47, 109, 246, 0.1);
}

.tree-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tree-stats span {
  padding: 8px 12px;
  border: 1px solid var(--tree-line);
  border-radius: 10px;
  background: var(--anzhiyu-card-bg);
  color: var(--km-muted);
}

.tree-stats strong {
  color: var(--tree-blue);
}

.tree-toolbar {
  position: sticky;
  top: 70px;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  padding: 12px;
  margin: 18px 0;
  border: 1px solid var(--tree-line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--anzhiyu-card-bg) 92%, transparent);
  backdrop-filter: blur(12px);
}

.tree-toolbar input {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--tree-line);
  border-radius: 10px;
  outline: none;
  color: var(--anzhiyu-fontcolor);
  background: var(--anzhiyu-background);
}

.tree-toolbar input:focus {
  border-color: rgba(47, 109, 246, 0.45);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12);
}

.tree-toolbar button {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--tree-line);
  border-radius: 10px;
  color: var(--anzhiyu-fontcolor);
  background: var(--anzhiyu-card-bg);
  cursor: pointer;
}

.tree-toolbar button:hover,
.tree-toolbar button.is-active {
  color: #fff;
  border-color: var(--tree-blue);
  background: var(--tree-blue);
}

.note-tree {
  padding: 18px;
  border: 1px solid var(--tree-line);
  border-radius: 16px;
  background: var(--anzhiyu-card-bg);
}

.tree-branch {
  margin: 6px 0;
}

.tree-branch summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  list-style: none;
}

.tree-branch summary::-webkit-details-marker {
  display: none;
}

.tree-branch summary::before {
  content: ">";
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 2px;
  color: var(--tree-blue);
  font-weight: 800;
  transition: transform 0.18s ease;
}

.tree-branch[open] > summary::before {
  transform: rotate(90deg);
}

.tree-branch summary:hover {
  background: var(--tree-soft);
}

.branch-name {
  flex: 1;
  font-weight: 800;
}

.branch-count {
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--tree-blue);
  background: rgba(47, 109, 246, 0.1);
  font-size: 0.86rem;
  font-weight: 700;
}

.tree-children {
  margin-left: 18px;
  padding-left: 14px;
  border-left: 1px solid var(--tree-line);
}

.tree-leaf {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 34px;
  margin: 4px 0;
  padding: 7px 10px 7px 18px;
  border-radius: 10px;
  color: var(--anzhiyu-fontcolor) !important;
}

.tree-leaf::before {
  content: "";
  position: absolute;
  left: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tree-local);
}

.tree-leaf.is-published {
  text-decoration: none !important;
}

.tree-leaf.is-published::before {
  background: var(--tree-blue);
}

.tree-leaf.is-published:hover {
  background: var(--tree-soft);
}

.tree-leaf.is-local {
  color: var(--tree-local) !important;
}

.leaf-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaf-meta {
  color: var(--tree-local);
  font-size: 0.86rem;
  white-space: nowrap;
}

.tree-leaf.is-published .leaf-meta {
  color: var(--tree-blue);
}

.tree-hidden {
  display: none !important;
}

.tree-match {
  background: rgba(19, 163, 128, 0.1);
}

@media (max-width: 760px) {
  .tree-toolbar {
    position: static;
    grid-template-columns: 1fr 1fr;
  }

  .tree-toolbar input {
    grid-column: 1 / -1;
  }

  .note-tree {
    padding: 12px;
  }

  .tree-children {
    margin-left: 8px;
    padding-left: 10px;
  }

  .tree-leaf {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .leaf-meta {
    white-space: normal;
  }
}

/* Personal note tree refinements */
.note-tree-page .compact-tree-hero {
  padding: 24px 28px;
  border-radius: 14px;
  margin-bottom: 14px;
  background:
    linear-gradient(135deg, rgba(47, 109, 246, 0.10), rgba(19, 163, 128, 0.06)),
    var(--anzhiyu-card-bg);
}

.note-tree-page .knowledge-kicker {
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: none;
}

.note-tree-page .compact-tree-hero h1 {
  font-size: clamp(1.7rem, 2.4vw, 2.15rem);
  line-height: 1.25;
}

.note-tree-page .knowledge-desc {
  max-width: 820px;
  margin-top: 8px;
  font-size: 0.98rem;
}

.note-tree-page .tree-stats {
  margin-top: 14px;
}

.note-tree-page .tree-stats span {
  border-radius: 8px;
  padding: 7px 10px;
}

.note-tree-page .tree-toolbar {
  grid-template-columns: minmax(260px, 1fr) repeat(3, max-content);
  border-radius: 10px;
  margin: 14px 0;
  padding: 10px;
  box-shadow: 0 8px 22px rgba(31, 45, 61, 0.05);
}

.note-tree-page .tree-toolbar input,
.note-tree-page .tree-toolbar button {
  border-radius: 8px;
}

.note-tree-page .note-tree {
  padding: 10px 14px 14px;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(47, 109, 246, 0.035), transparent 42%),
    var(--anzhiyu-card-bg);
}

.note-tree-page .tree-branch {
  margin: 2px 0;
}

.note-tree-page .tree-branch summary {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--anzhiyu-fontcolor);
}

.note-tree-page .tree-branch summary::before {
  content: "";
  width: 0;
  height: 0;
  align-self: center;
  justify-self: center;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--tree-blue);
  margin: 0;
}

.note-tree-page .tree-branch[open] > summary::before {
  transform: rotate(90deg);
}

.note-tree-page .tree-branch.depth-0 > summary {
  min-height: 40px;
  margin-top: 6px;
  background: rgba(47, 109, 246, 0.07);
}

.note-tree-page .tree-branch.depth-0 > summary .branch-name {
  font-size: 1.02rem;
}

.note-tree-page .branch-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.note-tree-page .branch-count {
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.note-tree-page .tree-children {
  margin-left: 11px;
  padding-left: 14px;
  border-left: 1px solid rgba(72, 86, 112, 0.18);
}

.note-tree-page .tree-leaf {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  min-height: 32px;
  margin: 1px 0;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.16s ease, color 0.16s ease;
}

.note-tree-page .tree-leaf::before {
  position: static;
  width: 7px;
  height: 7px;
  align-self: center;
  justify-self: center;
  opacity: 0.85;
}

.note-tree-page .tree-leaf.is-published {
  color: var(--anzhiyu-fontcolor) !important;
}

.note-tree-page .tree-leaf.is-published:hover {
  background: rgba(47, 109, 246, 0.10);
}

.note-tree-page .tree-leaf.is-local {
  color: color-mix(in srgb, var(--anzhiyu-fontcolor) 58%, transparent) !important;
}

.note-tree-page .tree-leaf.is-local::before {
  background: rgba(120, 132, 153, 0.55);
}

.note-tree-page .leaf-title {
  align-self: center;
}

.note-tree-page .leaf-meta {
  align-self: center;
  padding-left: 10px;
  font-size: 0.78rem;
}

.note-tree-page .tree-leaf.is-published .leaf-meta {
  color: var(--tree-green);
}

.note-tree-page .tree-match {
  background: rgba(19, 163, 128, 0.12);
}

@media (max-width: 760px) {
  .note-tree-page .compact-tree-hero {
    padding: 20px 18px;
  }

  .note-tree-page .tree-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .note-tree-page .tree-toolbar input {
    grid-column: 1 / -1;
  }

  .note-tree-page .tree-leaf {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .note-tree-page .leaf-meta {
    grid-column: 2;
    padding-left: 0;
  }
}

/* Static NoteExplorer */
.note-explorer-page {
  --explorer-border: rgba(72, 86, 112, 0.16);
  --explorer-hover: rgba(47, 109, 246, 0.08);
  --explorer-selected: rgba(47, 109, 246, 0.16);
  --explorer-muted: var(--anzhiyu-secondtext);
}

.note-explorer-hero {
  padding: 22px 26px;
  margin-bottom: 14px;
  border: 1px solid var(--explorer-border);
  border-radius: 12px;
  background: var(--anzhiyu-card-bg);
}

.note-explorer-kicker {
  margin: 0 0 6px;
  color: #2f6df6;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.note-explorer-hero h1 {
  margin: 0;
  font-size: clamp(1.65rem, 2.3vw, 2.1rem);
  line-height: 1.25;
}

.note-explorer-hero p:last-child {
  margin: 8px 0 0;
  color: var(--explorer-muted);
}

.note-explorer {
  border: 1px solid var(--explorer-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--anzhiyu-card-bg);
}

.note-explorer-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(3, max-content);
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--explorer-border);
  background: color-mix(in srgb, var(--anzhiyu-card-bg) 94%, #2f6df6 6%);
}

.note-explorer-toolbar input,
.note-explorer-toolbar button {
  height: 34px;
  border: 1px solid var(--explorer-border);
  border-radius: 6px;
  color: var(--anzhiyu-fontcolor);
  background: var(--anzhiyu-background);
}

.note-explorer-toolbar input {
  min-width: 0;
  padding: 0 10px;
  outline: none;
}

.note-explorer-toolbar input:focus {
  border-color: rgba(47, 109, 246, 0.55);
  box-shadow: 0 0 0 2px rgba(47, 109, 246, 0.12);
}

.note-explorer-toolbar button {
  padding: 0 10px;
  cursor: pointer;
}

.note-explorer-toolbar button:hover,
.note-explorer-toolbar button.is-active {
  color: #fff;
  border-color: #2f6df6;
  background: #2f6df6;
}

.note-explorer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--explorer-border);
  color: var(--explorer-muted);
  font-size: 0.9rem;
}

.note-explorer-stats strong {
  color: #2f6df6;
}

.note-explorer-table {
  width: 100%;
}

.note-explorer-header,
.note-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 120px;
  align-items: center;
}

.note-explorer-header {
  min-height: 34px;
  border-bottom: 1px solid var(--explorer-border);
  color: var(--explorer-muted);
  background: color-mix(in srgb, var(--anzhiyu-card-bg) 90%, #000 3%);
  font-size: 0.86rem;
  font-weight: 700;
}

.note-explorer-header > div,
.note-cell {
  min-width: 0;
  padding: 0 12px;
}

.note-row {
  min-height: 34px;
  border-bottom: 1px solid rgba(72, 86, 112, 0.08);
  color: var(--anzhiyu-fontcolor);
  cursor: default;
  user-select: none;
}

.note-row:hover {
  background: var(--explorer-hover);
}

.note-row.is-selected {
  background: var(--explorer-selected);
}

.note-row.is-file.is-linked {
  cursor: pointer;
}

.note-row.is-file.is-local {
  color: color-mix(in srgb, var(--anzhiyu-fontcolor) 58%, transparent);
}

.note-name-inner {
  display: grid;
  grid-template-columns: var(--note-indent) 16px 22px minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
}

.note-name-inner::before {
  content: "";
}

.note-arrow {
  color: #5d6b82;
  font-size: 0.95rem;
  text-align: center;
}

.note-icon {
  width: 22px;
  text-align: center;
  font-size: 1rem;
}

.note-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-count {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  color: #2f6df6;
  background: rgba(47, 109, 246, 0.10);
  font-size: 0.76rem;
}

.note-modified,
.note-type {
  overflow: hidden;
  color: var(--explorer-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.note-row.is-file.is-linked .note-type {
  color: #13a380;
}

.note-explorer-state {
  padding: 22px;
  color: var(--explorer-muted);
  text-align: center;
}

@media (max-width: 760px) {
  .note-explorer-hero {
    padding: 18px;
  }

  .note-explorer-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .note-explorer-toolbar input {
    grid-column: 1 / -1;
  }

  .note-explorer-header,
  .note-row {
    grid-template-columns: minmax(180px, 1fr) 92px;
  }

  .note-explorer-header > div:nth-child(3),
  .note-type {
    display: none;
  }

  .note-explorer-header > div,
  .note-cell {
    padding: 0 8px;
  }

  .note-name-inner {
    grid-template-columns: min(var(--note-indent), 88px) 14px 20px minmax(0, 1fr);
  }

  .note-count {
    display: none;
  }

  .note-modified {
    font-size: 0.78rem;
  }
}

/* Mind-map note explorer */
.note-explorer {
  --mind-border: rgba(72, 86, 112, 0.14);
  --mind-muted: var(--anzhiyu-secondtext);
  --mind-card: var(--anzhiyu-card-bg);
  --mind-surface: color-mix(in srgb, var(--anzhiyu-card-bg) 94%, #f7fbff 6%);
  --mind-shadow: 0 14px 34px rgba(31, 45, 61, 0.08);
  overflow: visible;
  border: 1px solid var(--mind-border);
  border-radius: 12px;
  background: var(--mind-card);
}

.note-mindmap-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 12px;
}

.note-mindmap-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.note-mindmap-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #ff5b5b, #ef4444);
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.28);
  font-size: 1.25rem;
  font-weight: 900;
}

.note-mindmap-brand h2 {
  margin: 0;
  color: var(--anzhiyu-fontcolor);
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  line-height: 1.25;
}

.note-mindmap-brand p {
  margin: 5px 0 0;
  color: var(--mind-muted);
  font-size: 0.92rem;
}

.note-mindmap-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.note-mindmap-search {
  width: min(320px, 38vw);
  height: 40px;
  display: inline-grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--mind-border);
  border-radius: 9px;
  background: var(--anzhiyu-background);
  color: var(--mind-muted);
  box-shadow: 0 6px 18px rgba(31, 45, 61, 0.04);
}

.note-mindmap-search:focus-within {
  border-color: rgba(47, 109, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12);
}

.note-mindmap-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  color: var(--anzhiyu-fontcolor);
  background: transparent;
}

.note-mindmap-zoom {
  display: inline-flex;
  align-items: center;
  height: 40px;
  overflow: hidden;
  border: 1px solid var(--mind-border);
  border-radius: 9px;
  background: var(--anzhiyu-background);
  box-shadow: 0 6px 18px rgba(31, 45, 61, 0.04);
}

.note-mindmap-zoom button {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.note-mindmap-zoom button + button {
  border-left: 1px solid var(--mind-border);
}

.note-mindmap-zoom [data-note-action="zoom-reset"] {
  min-width: 58px;
  color: var(--mind-muted);
  font-variant-numeric: tabular-nums;
}

.note-mindmap-actions button {
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--mind-border);
  border-radius: 9px;
  color: var(--anzhiyu-fontcolor);
  background: var(--anzhiyu-background);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(31, 45, 61, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.note-mindmap-actions button:hover {
  transform: translateY(-1px);
  color: #fff;
  border-color: #2f6df6;
  background: #2f6df6;
}

.note-mindmap-actions .note-mindmap-zoom button {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.note-mindmap-actions .note-mindmap-zoom button:hover {
  transform: none;
  color: #fff;
  background: #2f6df6;
}

.note-mindmap-actions .note-mindmap-zoom [data-note-action="zoom-reset"]:hover {
  color: var(--anzhiyu-fontcolor);
  background: color-mix(in srgb, var(--anzhiyu-card-bg) 88%, #2f6df6 10%);
}

.note-mindmap-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 20px 14px;
  color: var(--mind-muted);
  font-size: 0.88rem;
}

.note-mindmap-stats span {
  padding: 5px 9px;
  border: 1px solid var(--mind-border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--anzhiyu-card-bg) 90%, #2f6df6 5%);
}

.note-mindmap-stats strong {
  color: #2f6df6;
}

.note-mindmap-viewport {
  margin: 0 16px 16px;
  height: min(72vh, 720px);
  min-height: 460px;
  border: 1px solid var(--mind-border);
  border-radius: 10px;
  overflow: auto;
  background: var(--mind-surface);
  cursor: grab;
  overscroll-behavior: contain;
  user-select: none;
}

.note-mindmap-viewport.is-panning {
  cursor: grabbing;
}

.note-mindmap-canvas {
  position: relative;
  min-width: max-content;
  min-height: 980px;
  padding: 56px 72px;
  zoom: var(--mind-scale, 1);
}

.mind-links {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.mind-links path {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.66;
  vector-effect: non-scaling-stroke;
}

.mind-root-wrap,
.mind-branch {
  position: relative;
  display: flex;
  align-items: center;
}

.mind-root-wrap {
  min-width: 1180px;
  min-height: 860px;
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  align-items: center;
  justify-content: center;
  column-gap: 42px;
}

.mind-center {
  position: relative;
  z-index: 2;
}

.mind-side {
  min-width: max-content;
  min-height: 100%;
  display: flex;
  align-items: center;
}

.mind-side.is-left {
  justify-content: flex-end;
}

.mind-side.is-right {
  justify-content: flex-start;
}

.mind-children {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mind-children.is-right {
  padding-left: 78px;
}

.mind-children.is-left {
  align-items: flex-end;
  padding-right: 78px;
}

.mind-children::before {
  content: none;
  display: none;
}

.mind-children.is-right::before {
  content: none;
}

.mind-children.is-left::before {
  content: none;
}

.mind-children::after {
  content: none;
  display: none;
}

.mind-children.is-right::after {
  left: 0;
}

.mind-children.is-left::after {
  right: 0;
}

.mind-branch::before {
  content: none;
  display: none;
}

.mind-branch.is-right::before {
  left: -42px;
}

.mind-branch.is-left {
  flex-direction: row-reverse;
}

.mind-branch.is-left::before {
  right: -42px;
}

.mind-node {
  position: relative;
  z-index: 1;
  width: 210px;
  min-height: 52px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon title toggle"
    "icon meta toggle";
  align-items: center;
  column-gap: 9px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--mind-accent, #2f6df6) 34%, var(--mind-border));
  border-radius: 8px;
  color: var(--anzhiyu-fontcolor);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--mind-accent, #2f6df6) 10%, transparent), transparent 64%),
    var(--mind-card);
  box-shadow: 0 8px 20px rgba(31, 45, 61, 0.06);
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.mind-node:hover,
.mind-node.is-selected {
  transform: translateY(-2px);
  border-color: var(--mind-accent, #2f6df6);
  box-shadow: var(--mind-shadow);
}

.mind-node.is-root {
  width: 230px;
  min-height: 72px;
  color: #fff;
  border-color: rgba(239, 68, 68, 0.82);
  background: linear-gradient(135deg, #ff5b5b, #ef4444);
  box-shadow: 0 18px 38px rgba(239, 68, 68, 0.24);
}

.mind-node.is-article {
  width: 172px;
  min-height: 46px;
  background: var(--mind-card);
}

.mind-node.is-article.is-linked {
  cursor: pointer;
}

.mind-node.is-article.is-local {
  cursor: default;
  opacity: 0.72;
}

.mind-icon {
  grid-area: icon;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--mind-accent, #2f6df6);
  background: color-mix(in srgb, var(--mind-accent, #2f6df6) 11%, transparent);
  font-weight: 900;
}

.mind-node.is-root .mind-icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

.mind-title {
  grid-area: title;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 800;
}

.mind-meta {
  grid-area: meta;
  min-width: 0;
  overflow: hidden;
  color: color-mix(in srgb, var(--anzhiyu-fontcolor) 58%, transparent);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
}

.mind-node.is-root .mind-meta {
  color: rgba(255, 255, 255, 0.78);
}

.mind-toggle {
  grid-area: toggle;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--mind-accent, #2f6df6);
  background: color-mix(in srgb, var(--mind-accent, #2f6df6) 12%, transparent);
  font-weight: 900;
}

.mind-node.is-match {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14), var(--mind-shadow);
}

.mind-node.is-linked .mind-meta {
  color: color-mix(in srgb, var(--mind-accent, #2f6df6) 80%, #16a34a);
}

.mind-branch.is-hovered::before,
.mind-branch:hover::before,
.mind-branch:focus-within::before {
  filter: saturate(1.25);
  opacity: 1;
}

[data-theme="dark"] .note-explorer {
  --mind-shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
  --mind-surface: color-mix(in srgb, var(--anzhiyu-card-bg) 96%, #2f6df6 4%);
}

@media (max-width: 900px) {
  .note-mindmap-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .note-mindmap-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .note-mindmap-search {
    width: min(100%, 420px);
  }
}

@media (max-width: 640px) {
  .note-mindmap-top {
    padding: 16px 14px 10px;
  }

  .note-mindmap-brand {
    gap: 10px;
  }

  .note-mindmap-logo {
    width: 38px;
    height: 38px;
  }

  .note-mindmap-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .note-mindmap-search {
    width: 100%;
    grid-column: 1 / -1;
  }

  .note-mindmap-zoom {
    grid-column: 1 / -1;
    width: 100%;
  }

  .note-mindmap-zoom button {
    flex: 1;
  }

  .note-mindmap-stats {
    padding: 0 14px 12px;
  }

  .note-mindmap-viewport {
    margin: 0 10px 12px;
    height: 68vh;
    min-height: 420px;
  }

  .note-mindmap-canvas {
    min-height: 760px;
    padding: 30px 32px;
  }

  .mind-root-wrap {
    min-width: 820px;
    min-height: 680px;
    column-gap: 28px;
  }

  .mind-children {
    gap: 16px;
  }

  .mind-children.is-right {
    padding-left: 58px;
  }

  .mind-children.is-left {
    padding-right: 58px;
  }

  .mind-children.is-right::before {
    left: 16px;
  }

  .mind-children.is-left::before {
    right: 16px;
  }

  .mind-children::after {
    width: 17px;
  }

  .mind-branch.is-right::before {
    left: -32px;
    width: 32px;
  }

  .mind-branch.is-left::before {
    right: -32px;
    width: 32px;
  }

  .mind-node {
    width: 176px;
    min-height: 48px;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    padding: 8px 9px;
  }

  .mind-node.is-root {
    width: 188px;
  }

  .mind-node.is-article {
    width: 150px;
  }

  .mind-icon {
    width: 27px;
    height: 27px;
  }

  .mind-title {
    font-size: 0.86rem;
  }
}
