const char *wideline_vs =
  "#version 400\n"
  "\n"
  "// Per-vertex attributes\n"
  "in vec3 position;     // this endpoint\n"
  "in vec3 otherEnd;     // the other endpoint of the line segment\n"
  "in vec4 color;        // RGBA color at this endpoint\n"
  "in float widthSide;   // half-width * side (-1 or +1)\n"
  "in float lineParam;   // dash parameter (0 for solid lines)\n"
  "\n"
  "uniform mat4 modelView;\n"
  "uniform mat4 projection;\n"
  "\n"
  "out vec4 outColor;\n"
  "out float fragLineParam;\n"
  "\n"
  "void main()\n"
  "{\n"
  "  // Transform both endpoints to view space\n"
  "  vec4 viewPos = modelView * vec4(position, 1.0);\n"
  "  vec3 viewOther = (modelView * vec4(otherEnd, 1.0)).xyz;\n"
  "\n"
  "  // Line direction in view space\n"
  "  vec3 lineDir = viewOther - viewPos.xyz;\n"
  "  float lineLen = length(lineDir);\n"
  "\n"
  "  // View direction in view space (camera looks along -Z)\n"
  "  vec3 viewDir = vec3(0.0, 0.0, 1.0);\n"
  "\n"
  "  vec3 offset;\n"
  "  if (lineLen > 1e-6) {\n"
  "    lineDir /= lineLen;\n"
  "    // Perpendicular to both line direction and view direction\n"
  "    offset = normalize(cross(lineDir, viewDir)) * widthSide;\n"
  "  } else {\n"
  "    // Degenerate line segment - offset in X\n"
  "    offset = vec3(widthSide, 0.0, 0.0);\n"
  "  }\n"
  "\n"
  "  // Extend the endpoint outward by halfWidth for a square cap.\n"
  "  // This fills gaps at corners where two wide lines meet.\n"
  "  float halfWidth = abs(widthSide);\n"
  "  viewPos.xyz += offset - lineDir * halfWidth;\n"
  "\n"
  "  gl_Position = projection * viewPos;\n"
  "  outColor = color;\n"
  "  fragLineParam = lineParam;\n"
  "}\n"
  "\n";
