.material-graph-shell {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 620px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 8%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0) 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.74));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 0 -1px 0 rgba(148, 163, 184, 0.16);
  backdrop-filter: blur(18px) saturate(1.12);
}

.material-graph-toolbar {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  pointer-events: none;
}

.material-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  color: rgba(51, 65, 85, 0.78);
  font-size: 0.72rem;
  font-weight: 650;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(16px) saturate(1.15);
}

.material-graph-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.material-graph-legend-dot {
  width: 0.56rem;
  height: 0.56rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}

.material-graph-legend-line {
  width: 1.4rem;
  height: 1px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.42);
}

.material-graph-legend-dot-material {
  background: linear-gradient(90deg, #2f7ebc, #ff7f24, #42a13d, #df71b8);
}

.material-graph-legend-dot-product {
  background: #2f7ebc;
}

.material-graph-canvas {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 620px;
}

.material-graph-canvas svg {
  display: block;
  width: 100%;
  min-height: 620px;
  overflow: visible;
}

.material-graph-link {
  fill: none;
  stroke: rgba(100, 116, 139, 0.5);
  stroke-linecap: round;
  stroke-opacity: 0.22;
  transition: stroke-opacity 140ms ease, stroke-width 140ms ease;
}

.material-graph-link.is-active {
  stroke-opacity: 0.58;
}

.material-graph-node {
  cursor: default;
  outline: none;
}

.material-graph-node circle {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 1.35;
  filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.12));
  transition: stroke 140ms ease, filter 140ms ease;
}

.material-graph-node.is-active circle,
.material-graph-node:focus circle {
  stroke: rgba(9, 18, 27, 0.72);
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.22));
}

.material-graph-node-material circle {
  stroke-width: 1.8;
}

.material-graph-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px);
}

.material-graph-empty.hidden {
  display: none;
}

.material-json-panel {
  max-height: 460px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(15, 23, 42, 0.92);
  color: rgba(226, 232, 240, 0.95);
  padding: 1rem;
  font-size: 0.73rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.material-tooltip {
  position: fixed;
  z-index: 60;
  max-width: min(360px, calc(100vw - 2rem));
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.16);
  padding: 0.85rem 0.95rem;
  color: rgba(15, 23, 42, 0.86);
  font-size: 0.78rem;
  line-height: 1.45;
  pointer-events: none;
  backdrop-filter: blur(14px);
}

.material-tooltip[hidden] {
  display: none;
}

.material-tooltip strong {
  display: block;
  margin-bottom: 0.25rem;
  color: rgba(15, 23, 42, 0.94);
  font-size: 0.88rem;
}

.material-tooltip span {
  display: block;
  color: rgba(51, 65, 85, 0.76);
}

@media (max-width: 767px) {
  .material-graph-shell,
  .material-graph-canvas,
  .material-graph-canvas svg {
    min-height: 540px;
  }

  .material-graph-toolbar {
    position: static;
    align-items: flex-start;
    padding: 1rem 1rem 0;
    pointer-events: auto;
  }

  .material-graph-legend {
    border-radius: 0.75rem;
  }

  .material-graph-canvas {
    overflow-x: hidden;
  }
}
