*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #3d2c1e;
  background: #f7f1e8;
}

.graph-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #e0d4c4;
  background: #fff8ee;
}

.graph-header h1 {
  margin: 0;
  font-size: 1.15rem;
  color: #5c3d1e;
  white-space: nowrap;
}

.graph-back {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #b45309;
  text-decoration: none;
}

.graph-back:hover {
  text-decoration: underline;
}

.graph-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: #8a7358;
}

.graph-legend {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #6b5742;
  flex-shrink: 0;
}

.graph-legend-gradient {
  display: inline-block;
  width: 5.5rem;
  height: 0.55rem;
  border-radius: 45px;
  background: linear-gradient(to right, hsl(28, 10%, 90%), hsl(28, 100%, 48%));
  border: 1px solid rgba(92, 61, 30, 0.12);
}

.graph-legend-range {
  font-variant-numeric: tabular-nums;
}

.graph-stage {
  position: relative;
  height: calc(100% - 52px);
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(217, 119, 6, 0.05), transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(92, 61, 30, 0.05), transparent 40%),
    #f7f1e8;
}

.graph-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.graph-svg.is-panning {
  cursor: grabbing;
}

.graph-link {
  stroke-linecap: round;
  transition: opacity 0.12s ease;
  pointer-events: none;
}

.graph-link.is-hidden {
  opacity: 0;
}

.graph-node {
  cursor: pointer;
  transition: opacity 0.12s ease;
}

.graph-node circle {
  fill: #fff3e0;
  stroke: #d97706;
  stroke-width: 1.5;
  transition: fill 0.15s ease, stroke-width 0.15s ease;
}

.graph-node.is-highlight circle {
  fill: #ffe8c7;
  stroke-width: 2.5;
}

.graph-node.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.graph-node.is-active circle {
  fill: #ffd89a;
  stroke: #b45309;
  stroke-width: 2.5;
}

.graph-node text {
  font-size: 11px;
  fill: #5c3d1e;
  pointer-events: none;
  user-select: none;
}

.graph-tooltip {
  position: absolute;
  max-width: 16rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #e0d4c4;
  background: #fff8ee;
  box-shadow: 0 4px 16px rgba(60, 40, 20, 0.16);
  font-size: 0.78rem;
  line-height: 1.45;
  pointer-events: none;
  z-index: 2;
}

.graph-tooltip.hidden {
  display: none;
}

.graph-tooltip strong {
  display: block;
  margin-bottom: 0.15rem;
  color: #5c3d1e;
}

.graph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #6b5742;
  padding: 1rem;
}

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

.graph-empty-hint {
  font-size: 0.82rem;
  color: #8a7358;
}

@media (max-width: 720px) {
  .graph-header {
    padding: 0.75rem 1rem;
    gap: 0.65rem;
  }

  .graph-header h1 {
    font-size: 0.95rem;
  }

  .graph-legend {
    font-size: 0.7rem;
  }

  .graph-legend-gradient {
    width: 4rem;
  }

  .graph-stage {
    height: calc(100% - 52px);
  }

  .graph-node text {
    font-size: 9px;
  }
}
