      /* The graph is a view of the Memories screen now rather than a screen of
         its own, so it fills whatever space the list would have taken. */
      .mem-graph {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
        position: relative;
      }
      .mem-graph[hidden] {
        display: none;
      }
      .graph-hint {
        font-size: 12px;
        color: var(--text-tertiary);
      }
      .graph-legend {
        display: flex;
        gap: 14px;
        font-size: 11px;
        color: var(--text-secondary);
        flex-wrap: wrap;
      }
      .graph-legend span {
        display: inline-flex;
        align-items: center;
        gap: 5px;
      }
      .graph-legend .gl-dot {
        width: 9px;
        height: 9px;
        border-radius: 50%;
        display: inline-block;
      }
      /* Floating over the canvas: the toolbar row above is already carrying the
         legend and the list/graph toggle, which on a phone is a full row. */
      .graph-controls {
        display: flex;
        gap: 4px;
        position: absolute;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        z-index: 2;
      }
      .graph-controls .graph-btn {
        background: var(--bg-card);
        box-shadow: var(--shadow-card);
      }
      .graph-btn {
        background: none;
        border: 1px solid var(--border-input);
        border-radius: 8px;
        color: var(--text-secondary);
        cursor: pointer;
        font-size: 15px;
        width: 30px;
        height: 30px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0;
      }
      .graph-btn:hover {
        background: var(--accent-soft);
        color: var(--accent);
      }
      #graph-canvas {
        flex: 1 1 auto;
        width: 100%;
        min-height: 320px;
        display: block;
        touch-action: none;
        cursor: grab;
      }
      .graph-empty {
        padding: 48px 24px;
        text-align: center;
        color: var(--text-tertiary);
        font-size: 14px;
      }
      .view-related {
        margin-top: 14px;
        border-top: 1px solid var(--border-input);
        padding-top: 12px;
      }
      .view-related-label {
        font-size: 11px;
        font-weight: 600;
        color: var(--text-tertiary);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 8px;
      }
      .related-item {
        display: flex;
        align-items: stretch;
        width: 100%;
        background: var(--accent-soft);
        border-radius: 8px;
        margin-bottom: 6px;
        font-size: 13px;
        line-height: 1.35;
        color: var(--text-primary);
      }
      .related-open {
        flex: 1;
        min-width: 0;
        text-align: left;
        background: none;
        border: none;
        padding: 8px 10px;
        cursor: pointer;
        font-size: inherit;
        line-height: inherit;
        color: inherit;
        font-family: inherit;
      }
      .related-unlink {
        flex-shrink: 0;
        background: none;
        border: none;
        padding: 0 10px;
        cursor: pointer;
        color: var(--text-tertiary);
        font-size: 14px;
      }
      .related-unlink:hover {
        color: var(--danger);
      }
      .related-item:hover {
        background: rgba(253, 84, 10, 0.12);
      }
      .related-type {
        font-weight: 600;
        color: var(--accent);
        margin-right: 6px;
      }
