.topic-post-card-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: 0 1rem 1rem;
  margin-top: auto;
}
.topic-post-card { display: flex; flex-direction: column; }
.topic-post-card-link { flex: 1 1 auto; height: auto; }
.topic-post-card-actions .topic-post-card-open { margin: 0; }
.topic-post-card-explore {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--world-accent, #2563eb);
  font: inherit;
  font-weight: 800;
  padding: .2rem 0;
  cursor: pointer;
}
.topic-post-card-explore:hover,
.topic-post-card-explore:focus-visible { text-decoration: underline; }

.connection-explorer {
  width: min(1120px, calc(100vw - 2rem));
  height: min(760px, calc(100dvh - 2rem));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--world-accent, #6aa6ff) 38%, #dbe4f0);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .32);
}
.connection-explorer:not([open]) { display: none; }
.connection-explorer::backdrop {
  background: rgba(15, 23, 42, .62);
  backdrop-filter: blur(5px);
}
.connection-explorer-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
}
.connection-explorer-header,
.connection-explorer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
}
.connection-explorer-header { border-bottom: 1px solid #e5eaf2; }
.connection-explorer-heading { min-width: 0; }
.connection-explorer-header h2 {
  margin: .15rem 0 .2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.connection-explorer-instructions { margin: 0; font-size: .92rem; }
.connection-explorer-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #dbe6f5;
  border-radius: 50%;
  background: #eef4fc;
  color: #36506f;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .10);
}
.connection-explorer-close:hover,
.connection-explorer-close:focus-visible { background: #e2edfb; color: #172033; }
.connection-explorer-toolbar {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem 1.25rem;
  overflow-x: auto;
  border-bottom: 1px solid #e7edf5;
  background: #fff;
}
.connection-explorer-toolbar button {
  appearance: none;
  flex: 0 0 auto;
  min-width: 42px;
  height: 42px;
  padding: 0 .95rem;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--world-accent, #5f95df) 88%, white);
  color: #fff;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(37, 99, 235, .16);
}
.connection-explorer-stage {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  background: radial-gradient(circle at center, rgba(255,255,255,.98) 0, rgba(248,251,255,.97) 62%, rgba(242,247,253,.98) 100%);
  cursor: grab;
  touch-action: none;
}
.connection-explorer-stage.is-dragging { cursor: grabbing; }

.connection-explorer-loading,
.connection-explorer-error {
  display: grid;
  height: 100%;
  min-height: 300px;
  place-items: center;
  padding: 2rem;
  color: #64748b;
  font-weight: 750;
  text-align: center;
}
.connection-map-canvas {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.connection-map-canvas svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.connection-map-canvas line {
  stroke: color-mix(in srgb, var(--world-accent, #6aa6ff) 78%, white);
  stroke-width: 3;
  stroke-dasharray: 10 8;
}
.connection-map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 210px;
  min-height: 66px;
  padding: .62rem .78rem;
  border: 1px dashed color-mix(in srgb, var(--world-accent, #6aa6ff) 46%, #dbe4f0);
  border-radius: 999px;
  background: rgba(255,255,255,.97);
  color: #172033;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(15,23,42,.08);
}
.connection-map-root {
  width: 260px;
  border-style: solid;
  border-width: 2px;
  border-color: color-mix(in srgb, var(--world-accent, #6aa6ff) 70%, white);
}
.connection-map-node:hover,
.connection-map-node:focus-visible,
.connection-map-node.is-opening {
  border-color: var(--world-accent, #2563eb);
  box-shadow: 0 13px 32px rgba(37,99,235,.18);
}
.connection-map-icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--world-accent, #6aa6ff) 80%, white);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 5px 12px rgba(37,99,235,.18);
}
.connection-map-node.kind-video .connection-map-icon { background: #dc3b42; }
.connection-map-node.kind-article .connection-map-icon,
.connection-map-node.kind-link .connection-map-icon,
.connection-map-node.kind-website .connection-map-icon { background: #8b5cf6; }
.connection-map-node strong,
.connection-map-node small { display: block; overflow: hidden; text-overflow: ellipsis; }
.connection-map-node strong { white-space: nowrap; font-size: .88rem; }
.connection-map-node small { margin-top: .13rem; color: #64748b; font-size: .72rem; line-height: 1.2; }
.connection-explorer-footer { border-top: 1px solid #e5eaf2; }
body.connection-explorer-open { overflow: hidden; }

@media (max-width: 720px) {
  .connection-explorer {
    width: 100vw;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .connection-explorer-header {
    align-items: flex-start;
    padding: .8rem .85rem .7rem;
  }
  .connection-explorer-header h2 { font-size: 1.15rem; }
  .connection-explorer-header .eyebrow { margin-bottom: .15rem; }
  .connection-explorer-instructions { display: none; }
  .connection-explorer-close {
    width: 40px;
    height: 40px;
    font-size: 1.55rem;
  }
  .connection-explorer-toolbar {
    gap: .4rem;
    padding: .55rem .75rem;
  }
  .connection-explorer-toolbar button {
    height: 38px;
    min-width: 38px;
    padding: 0 .78rem;
    font-size: .9rem;
  }
  .connection-explorer-footer {
    padding: .65rem .8rem;
  }
  .connection-explorer-footer > span { font-size: .85rem; }
  .connection-explorer-footer .button {
    padding: .65rem .85rem;
    white-space: nowrap;
  }
  .connection-map-node { width: 190px; min-height: 60px; }
  .connection-map-root { width: 220px; }
}
