.knowledge-graph-dialog {
  width: min(1040px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
}

.planet-graph-frame {
  width: 100%;
  height: min(44vh, 360px);
  min-height: 320px;
  margin-top: var(--s16);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--page);
  touch-action: none;
}

.planet-graph-frame canvas {
  display: block;
  max-width: none;
}

.knowledge-graph-dialog .library-dialog-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

[data-planet-graph-relations] {
  max-width: 100%;
}

[data-planet-graph-relations] button {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

@media (max-width: 600px) {
  .knowledge-graph-dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .planet-graph-frame {
    height: 280px;
    min-height: 280px;
    margin-top: var(--s12);
  }

  [data-planet-graph-relations] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s8);
    margin-top: var(--s16);
  }
}
