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

  body {
    background: #fff;
    color: #333;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
  }

  #graph {
    width: 100%;
    height: 100%;
  }

  .link {
    stroke-opacity: 0.2;
  }

  .node path {
    cursor: pointer;
    shape-rendering: crispEdges;
  }

  .node text {
    pointer-events: none;
    font-size: 12px;
    fill: #333;
    opacity: 0.5;
  }

  #tooltip {
    position: fixed;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    max-width: 220px;
    line-height: 1.6;
    color: #333;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }

  #tooltip strong {
    color: #111;
    display: block;
    margin-bottom: 2px;
  }

  #tooltip span {
    color: #666;
    font-size: 11px;
  }

  #chord-legend-panel {
    position: absolute;
    top: 0.8em;
    left: 0.8em;
    z-index: 1000;

    width: clamp(160px, 22vw, 240px);
    max-width: 100%;

    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);

    font-family: Marianne, arial, sans-serif;
    font-size: clamp(11px, 1.2vw, 13px);

    transition: all 0.3s ease;
  }

  #chord-legend-header {
    padding: 0.6em 0.8em;

    font-weight: 700;
    cursor: pointer;

    display: flex;
    justify-content: space-between;
    align-items: center;

    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
    border-radius: 6px 6px 0 0;
  }

  #chord-legend-collapsible {
    overflow: hidden;
    max-height: min(40vh, 300px);
    transition: max-height 0.3s ease;
  }

  .chord-legend-collapsed #chord-legend-collapsible {
    max-height: 0;
  }

  .chord-legend-collapsed #chord-legend-header {
    border-bottom: none;
    border-radius: 6px;
  }

  #chord-legend-body {
    padding: 0.8em 1em;
    display: flex;
    flex-direction: column;
    gap: 0.6em;
  }

  .chord-legend-title {
    font-size: 1em;
    font-weight: 700;
    margin-bottom: 0.3em;
  }

  .chord-legend-row {
    display: flex;
    align-items: center;
    gap: 0.4em;
  }

  .chord-legend-label {
    font-size: 0.9em;
    font-weight: medium;
    white-space: normal;
  }

  .chord-legend-line {
    flex: 1;
    height: 0.25em;
    border-radius: 2px;
    min-width: 20px;
  }

  