.note-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 1.2rem 1.25rem 1.05rem;
  margin-bottom: 1rem;
  transition: box-shadow var(--duration) var(--ease-out);
}

.note-card.is-pinned {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.note-card__head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-2);
  padding-right: 7.5rem;
}

.note-card__title {
  font-size: 1.08rem;
}

.note-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: var(--space-3);
}

.note-card__cover {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
  border: 1px solid var(--border);
}

.note-card__body {
  margin-bottom: 0;
  font-size: 0.98rem;
  line-height: 1.65;
}

.note-fab {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.28rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.note-fab .dropdown {
  display: flex;
}

.note-fab__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.note-fab__btn:hover,
.note-fab__btn.is-on {
  background: var(--accent-soft);
  color: var(--accent);
}

.note-fab__btn:active {
  transform: scale(0.92);
}

@media (hover: hover) and (pointer: fine) {
  .note-fab {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
  }

  .note-card:hover .note-fab,
  .note-card:focus-within .note-fab,
  .note-fab:focus-within {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
}

.note-card.is-drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface));
}

.note-card__drop-hint {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.note-toc {
  margin: 0 0 var(--space-4);
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.note-toc__title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.note-toc__list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.note-toc__link {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
}

.note-toc__link--h2 { padding-left: 0.75rem; }
.note-toc__link--h3 { padding-left: 1.2rem; font-size: 0.84rem; }

.note-toc__link:hover,
.note-toc__link.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.note-card__backlinks {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.note-card__backlinks-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.note-card__backlinks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.note-card__backlink {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.note-card__backlink:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}

.md-wikilink {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent);
}

.md-wikilink:hover {
  border-bottom-style: solid;
}
